The chapter Running the application describes how the application is configured and started. The topics include:
Refer also to the chapter(s) Definition of Agent Configuration Files and Definition of Manager Configuration Files which contains more detailed information about the agent and manager configuration files.
The following two directories must exist in the system to run the agent:
The following directory must exist in the system to run the manager:
The agent and manager uses (application) configuration parameters to find out where these directories are located. The parameters should be defined in an Erlang system configuration file. The following configuration parameters are defined for the SNMP application:
agent = [agent_opt()]
agent_opt() = {restart_type, restart_type()} |
{agent_type, agent_type()} |
{agent_verbosity, verbosity()} |
{versions, versions()} |
{priority, priority()} |
{multi_threaded, multi_threaded()} |
{db_dir, db_dir()} |
{db_init_error, db_init_error()} |
{local_db, local_db()} |
{net_if, agent_net_if()} |
{mibs, mibs()} |
{mib_storage, mib_storage()} |
{mib_server, mib_server()} |
{audit_trail_log, audit_trail_log()} |
{error_report_mod, error_report_mod()} |
{note_store, note_store()} |
{symbolic_store, symbolic_store()} |
{config, agent_config()}manager = [manager_opt()]
manager_opt() = {restart_type, restart_type()} |
{net_if, manager_net_if()} |
{server, server()} |
{note_store, note_store()} |
{config, manager_config()} |
{inform_request_behaviour, manager_irb()} |
{mibs, manager_mibs()} |
{priority, priority()} |
{audit_trail_log, audit_trail_log()} |
{versions, versions() |
{def_user_module, def_user_module() |
{def_user_data, def_user_data()}
Agent specific config options and types:
agent_type() = master | sub <optional>
master, one master agent is
started. Otherwise, no agents are started. master.multi_threaded() = bool() <optional>
true, the agent is multi-threaded, with one
thread for each get request. false.db_dir() = string() <mandatory>
local_db() = [local_db_opt()] <optional>
local_db_opt() = {repair, agent_repair()} |
{auto_save, agent_auto_save()} |
{verbosity, verbosity()}local_db_opt().agent_repair() = false | true | force <optional>
false, and some errors occur, a new
database is created instead. If true, an existing file
will be repaired. If force, the table will be repaired
even if it was properly closed. true.agent_auto_save() = integer() | infinity <optional>
5000.agent_net_if() = [agent_net_if_opt()] <optional>
agent_net_if_opt() = {module, agent_net_if_module()} |
{verbosity, verbosity()} |
{options, agent_net_if_options()}agent_net_if_opt().agent_net_if_module() = atom() <optional>
snmpa_net_if.agent_net_if_options() = [agent_net_if_option()] <optional>
agent_net_if_option() = {bind_to, bind_to()} |
{sndbuf, sndbuf()} |
{recbuf, recbuf()} |
{no_reuse, no_reuse()} |
{req_limit, req_limit()}agent_net_if_module().agent_net_if_option().req_limit() = integer() | infinity <optional>
infinity.agent_mibs() = [string()] <optional>
STANDARD-MIB
SNMPv2
SNMPv2, SNMP-FRAMEWORK-MIB
and SNMP-MPD-MIB
[].mib_storage() = ets | {ets, Dir} | {ets, Dir, Action} | dets | {dets, Dir} | {dets, Dir, Action} | mnesia | {mnesia, Nodes} | {mnesia, Nodes, Action} <optional>
mib_storage is {ets, Dir}, the table will also be
stored on file. If Dir is default, then db_dir
will be used.mib_storage is dets or if Dir is
default, then db_dir will be used for Dir.mib_storage is mnesia then erlang:nodes()
will be used for Nodes.ets. Dir = default | string(). Dir is the directory where the
files will be stored. If default, then db_dir will be
used.Nodes = visible | connected | [node()].
Nodes = visible is translated to
erlang:nodes(visible).
Nodes = connected is translated to
erlang:nodes(connected).
If Nodes = [] then the own node is assumed.Action = clear | keep. Default is keep.
Action is used to specify what shall be done if the
mnesia/dets table already exist.mib_server() = [mib_server_opt()] <optional>
mib_server_opt() = {mibentry_override, mibentry_override()} |
{trapentry_override, trapentry_override()} |
{verbosity, verbosity()}mib_server_opt().mibentry_override() = bool() <optional>
false.trapentry_override() = bool() <optional>
false.error_report_mod() = atom() <optional>
snmpa_error_logger and snmpa_error_io.snmpa_error_logger.symbolic_store() = [symbolic_store_opt()]
symbolic_store_opt() = {verbosity, verbosity()}symbolic_store_opt().agent_config() = [agent_config_opt()] <mandatory>
agent_config_opt() = {dir, agent_config_dir()} |
{force_load, force_load()} | {verbosity, verbosity()}agent_config_opt().agent_config_dir = dir() <mandatory>
force_load() = bool() <optional>
true the configuration files are re-read
during startup, and the contents of the configuration
database ignored. Thus, if true, changes to
the configuration database are lost upon reboot of the
agent. false.Manager specific config options and types:
server() = [server_opt()] <optional>
server_opt() = {timeout, server_timeout()} |
{verbosity, verbosity()}silence.server_timeout() = integer() <optional>
server_timeout() time.
The information will have a best before time,
defined by the Expire time given when calling the
request function (see ag,
agn and
as).30000.manager_config() = [manager_config_opt()] <mandatory>
manager_config_opt() = {dir, manager_config_dir()} |
{db_dir, manager_db_dir()} |
{db_init_error, db_init_error()} |
{repair, manager_repair()} |
{auto_save, manager_auto_save()} |
{verbosity, verbosity()}manager_config_opt().manager_config_dir = dir() <mandatory>
manager_db_dir = dir() <mandatory>
manager_repair() = false | true | force <optional>
true.manager_auto_save() = integer() | infinity <optional>
5000.manager_irb() = auto | user | {user, integer()} <optional>
auto - The manager will autonomously send response
(acknowledgement> to inform-request messages.{user, integer()} - The manager will send response
(acknowledgement) to inform-request messages when the
handle_inform
function completes. The integer is the time, in milli-seconds,
that the manager will consider the stored inform-request info
valid.user - Same as {user, integer()}, except that
the default time, 15000 milli-seconds, is used.auto.manager_mibs() = [string()] <optional>
[].manager_net_if() = [manager_net_if_opt()] <optional>
manager_net_if_opt() = {module, manager_net_if_module()} |
{verbosity, verbosity()} |
{options, manager_net_if_options()}
manager_net_if_opt().manager_net_if_options() = [manager_net_if_option()] <optional>
manager_net_if_option() = {bind_to, bind_to()} |
{sndbuf, sndbuf()} |
{recbuf, recbuf()} |
{no_reuse, no_reuse()}
manager_net_if_module().manager_net_if_option().manager_net_if_module() = atom() <optional>
snmpm_net_if.def_user_module() = atom() <optional>
snmpm_user_default.def_user_data() = term() <optional>
undefined.Common config types:
restart_type() = permanent | transient | temporary
permanent for the agent and transient
for the manager.db_init_error() = terminate | create
terminate means that the
agent/manager will terminate and create means that the
agent/manager will remove the faulty file(s) and create new ones.terminate.priority() = atom() <optional>
normal.versions() = [version()] <optional>
version() = v1 | v2 | v3[v1,v2,v3].verbosity() = silence | info | log | debug | trace <optional>
silence.bind_to() = bool() <optional>
true, net_if binds to the IP adress.
If false, net_if listens on any IP address on the host
where it is running. false.no_reuse() = bool() <optional>
true, net_if does not specify that the IP
and port address should be reusable. If false,
the address is set to reusable. false.recbuf() = integer() <optional>
gen_udp.sndbuf() = integer() <optional>
gen_udp.note_store() = [note_store_opt()] <optional>
note_store_opt() = {timeout, note_store_timeout()} |
{verbosity, verbosity()}note_store_opt().note_store_timeout() = integer() <optional>
timeout the note_store
process performs a GC to remove the expired note's. Time in
milli-seconds.30000.audit_trail_log() [audit_trail_log_opt()] <optional>
audit_trail_log_opt() = {type, atl_type()} |
{dir, atl_dir()} |
{size, atl_size()} |
{repair, atl_repair()}
disk_log module is used
to maintain a wrap log. If present, the dir and
size options are mandatory.atl_type() = read | write | read_write <optional>
write is specified, only set requests are logged.
read is specified, only get requests are logged.
read_write, all requests are logged.
write is specified, only sent messages are logged.
read is specified, only received messages are logged.
read_write, both outgoing and incomming messages are
logged.
read_write.atl_dir = dir() <mandatory>
audit_trail_log specifies that logging should take
place, this parameter must be defined.atl_size() = {integer(), integer()} <mandatory>
disk_log. audit_trail_log specifies that logging should
take place, this parameter must be defined.atl_repair() = true | false | truncate | snmp_repair <optional>
snmp_repair
it is sent to disk_log. If, on the other hand, the value is
snmp_repair, snmp attempts to handle certain faults on it's
own. And even if it cannot repair the file, it does not truncate it
directly, but instead moves it aside for later off-line
analysis.true.To to start the application (agent and/or manager), the configuration files must be modified and there are two ways of doing this. Either edit the files manually, or run the configuration tool as follows.
If authentication or encryption is used (SNMPv3 only), start
the crypto application.
1> snmp:config().
Simple SNMP configuration tool (version 4.0)
------------------------------------------------
Note: Non-trivial configurations still has to be
done manually. IP addresses may be entered
as dront.ericsson.se (UNIX only) or
123.12.13.23
------------------------------------------------
Configure an agent (y/n)? [y]
Agent system config:
--------------------
1. Agent process priority (low/normal/high) [normal]
2. What SNMP version(s) should be used (1,2,3,1&2,1&2&3,2&3)? [3] 1&2&3
3. Configuration directory (absolute path)? [/ldisk/snmp] /ldisk/snmp/agent/conf
4. Config verbosity (silence/info/log/debug/trace)? [silence]
5. Database directory (absolute path)? [/ldisk/snmp] /ldisk/snmp/agent/db
6. Mib storage type (ets/dets/mnesia)? [ets]
7. Symbolic store verbosity (silence/info/log/debug/trace)? [silence]
8. Local DB verbosity (silence/info/log/debug/trace)? [silence]
9. Local DB repair (true/false/force)? [true]
10. Local DB auto save (infinity/milli seconds)? [5000]
11. Error report module? [snmpa_error_logger]
12. Agent type (master/sub)? [master]
13. Master-agent verbosity (silence/info/log/debug/trace)? [silence] log
14. Shall the agent re-read the configuration files during startup
(and ignore the configuration database) (true/false)? [true]
15. Multi threaded agent (true/false)? [false] true
16. Check for duplicate mib entries when installing a mib (true/false)? [false]
17. Check for duplicate trap names when installing a mib (true/false)? [false]
18. Mib server verbosity (silence/info/log/debug/trace)? [silence]
19. Note store verbosity (silence/info/log/debug/trace)? [silence]
20. Note store GC timeout? [30000]
21. Shall the agent use an audit trail log (y/n)? [n] y
21b. Audit trail log type (write/read_write)? [read_write]
21c. Where to store the audit trail log? [/ldisk/snmp] /ldisk/snmp/agent/log
21d. Max number of files? [10]
21e. Max size (in bytes) of each file? [10240]
21f. Audit trail log repair (true/false/truncate)? [true]
22. Which network interface module shall be used? [snmpa_net_if]
23. Network interface verbosity (silence/info/log/debug/trace)? [silence] log
24. Bind the agent IP address (true/false)? [false]
25. Shall the agents IP address and port be not reusable (true/false)? [false]
26. Agent request limit (used for flow control) (infinity/pos integer)? [infinity] 32
27. Receive buffer size of the agent (in bytes) (default/pos integer)? [default]
Agent snmp config:
------------------
1. System name (sysName standard variable) [bmk's agent]
2. Engine ID (snmpEngineID standard variable) [bmk's engine]
3. Max message size? [484]
4. The UDP port the agent listens to. (standard 161) [4000]
5. IP address for the agent (only used as id
when sending traps) [127.0.0.1]
6. IP address for the manager (only this manager
will have access to the agent, traps are sent
to this one) [127.0.0.1]
7. To what UDP port at the manager should traps
be sent (standard 162)? [5000]
8. Do you want a none- minimum- or semi-secure configuration?
Note that if you chose v1 or v2, you won't get any security for these
requests (none, minimum, semi_des, semi_aes) [minimum]
making sure crypto server is started...
8b. Give a password of at least length 8. It is used to generate
private keys for the configuration: kalle-anka
9. Current configuration files will now be overwritten. Ok (y/n)? [y]
- - - - - - - - - - - - -
Info: 1. SecurityName "initial" has noAuthNoPriv read access
and authenticated write access to the "restricted"
subtree.
2. SecurityName "all-rights" has noAuthNoPriv read/write
access to the "internet" subtree.
3. Standard traps are sent to the manager.
4. Community "public" is mapped to security name "initial".
5. Community "all-rights" is mapped to security name "all-rights".
The following agent files were written: agent.conf, community.conf,
standard.conf, target_addr.conf, target_params.conf,
notify.conf, vacm.conf and usm.conf
- - - - - - - - - - - - -
Configure a manager (y/n)? [y]
Manager system config:
----------------------
1. Manager process priority (low/normal/high) [normal]
2. What SNMP version(s) should be used (1,2,3,1&2,1&2&3,2&3)? [3] 1&2&3
3. Configuration directory (absolute path)? [/ldisk/snmp] /ldisk/snmp/manager/conf
4. Config verbosity (silence/info/log/debug/trace)? [silence] log
5. Database directory (absolute path)? [/ldisk/snmp] /ldisk/snmp/manager/db
6. Database repair (true/false/force)? [true]
7. Database auto save (infinity/milli seconds)? [5000]
8. Server verbosity (silence/info/log/debug/trace)? [silence] log
9. Server GC timeout? [30000]
10. Note store verbosity (silence/info/log/debug/trace)? [silence]
11. Note store GC timeout? [30000]
12. Which network interface module shall be used? [snmpm_net_if]
13. Network interface verbosity (silence/info/log/debug/trace)? [silence] log
14. Bind the manager IP address (true/false)? [false]
15. Shall the manager IP address and port be not reusable (true/false)? [false]
16. Receive buffer size of the manager (in bytes) (default/pos integer)? [default]
17. Shall the manager use an audit trail log (y/n)? [n] y
17b. Where to store the audit trail log? [/ldisk/snmp] /ldisk/snmp/manager/log
17c. Max number of files? [10]
17d. Max size (in bytes) of each file? [10240]
17e. Audit trail log repair (true/false/truncate)? [true]
18. Do you wish to assign a default user [yes] or use
the default settings [no] (y/n)? [n]
Manager snmp config:
--------------------
1. Engine ID (snmpEngineID standard variable) [bmk's engine]
2. Max message size? [484]
3. IP address for the manager (only used as id
when sending requests) [127.0.0.1]
4. Port number (standard 162)? [5000]
5. Configure a user of this manager (y/n)? [y]
5b. User id? kalle
5c. User callback module? snmpm_user_default
5d. User (callback) data? [undefined]
5. Configure a user of this manager (y/n)? [y] n
6. Configure an agent handled by this manager (y/n)? [y]
6b. User id? kalle
6c. Target name? [bmk's agent]
6d. Version (1/2/3)? [1] 3
6e. Community string ? [public]
6f. Engine ID (snmpEngineID standard variable) [bmk's engine]
6g. IP address for the agent [127.0.0.1]
6h. The UDP port the agent listens to. (standard 161) [4000]
6i. Retransmission timeout (infinity/pos integer)? [infinity]
6j. Max message size? [484]
6k. Security model (any/v1/v2c/usm)? [any] usm
6l. Security name? ["initial"]
6m. Security level (noAuthNoPriv/authNoPriv/authPriv)? [noAuthNoPriv] authPriv
6. Configure an agent handled by this manager (y/n)? [y] n
7. Configure an usm user handled by this manager (y/n)? [y]
7a. Engine ID [bmk's engine]
7b. User name? hobbes
7c. Security name? [hobbes]
7d. Authentication protocol (no/sha/md5)? [no] sha
7e Authentication [sha] key (length 0 or 20)? [""] [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
7d. Priv protocol (no/des/aes)? [no] des
7f Priv [des] key (length 0 or 16)? [""] 10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25
7. Configure an usm user handled by this manager (y/n)? [y] n
8. Current configuration files will now be overwritten. Ok (y/n)? [y]
- - - - - - - - - - - - -
The following manager files were written: manager.conf, agents.conf , users.conf and usm.conf
- - - - - - - - - - - - -
--------------------
Configuration directory for system file (absolute path)? [/ldisk/snmp]
ok
Start Erlang with the command:
erl -config /tmp/snmp/sys
If authentication or encryption is used (SNMPv3 only), start
the crypto application. If this step is forgotten, the
agent will not start, but report a
{config_error,{unsupported_crypto,_}} error.
1> application:start(crypto).
ok
2> application:start(snmp).
ok
It is possible to debug every (non-supervisor) process of the
application (both agent and manager), possibly with the exception
of the net_if module(s), which could be supplied by a user of the
application). This is done by calling the
snmpa:verbosity/2 and snmpm:verbosity/2 function(s)
and/or using
configuration parameters.
The verbosity itself has several levels: silence | info |
log | debug | trace. For the lowest verbosity silence,
nothing is printed. The higher the verbosity, the more is printed.
Default value is always silence.
3> snmpa:verbosity(master_agent, log).
ok
5> snmpa:verbosity(net_if, log).
ok
6>
%% Example of output from the agent when a get-next-request arrives:
** SNMP NET-IF LOG:
got paket from {147,12,12,12}:5000
** SNMP NET-IF MPD LOG:
v1, community: all-rights
** SNMP NET-IF LOG:
got pdu from {147,12,12,12}:5000 {pdu, 'get-next-request',
62612569,noError,0,
[{varbind,[1,1],'NULL','NULL',1}]}
** SNMP MASTER-AGENT LOG:
apply: snmp_generic,variable_func,[get,{sysDescr,persistent}]
** SNMP MASTER-AGENT LOG:
returned: {value,"Erlang SNMP agent"}
** SNMP NET-IF LOG:
reply pdu: {pdu,'get-response',62612569,noError,0,
[{varbind,[1,3,6,1,2,1,1,1,0],
'OCTET STRING',
"Erlang SNMP agent",1}]}
** SNMP NET-IF INFO: time in agent: 19711 mysec
Another useful function for debugging is
snmpa_local_db:print/0,1,2. For example, this function can
show the counters snmpInPkts and snmpOutPkts. Enter
the following command:
4> snmpa_local_db:print().
%% A lot of information.