The chapter Running the Agent describes how the agent is configured and started. The topics include:
Refer also to the chapter Definition of Configuration Files which contains more detailed information about the configuration files.
The following two directories must exist in the system:
The agent 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:
audit_trail_log = false | write_log | read_write_log
<optional>
disk_log
module is used to maintain a wrap log. If
write_log
is specified, only set requests are logged. If
read_write_log
, all requests are logged. Default is
false
.
audit_trail_log_dir = string() <optional>
audit_trail_log
specifies that logging should take
place, this parameter must be defined.
audit_trail_log_size = {MaxBytes, MaxFiles}
<optional>
disk_log
. If
audit_trail_log
specifies that logging should take place,
this parameter must be defined.
bind_to_ip_address = bool() <optional>
true
the agent binds to the agent IP adress.
If false
the agent listens on any IP address on the host
where it is running. Default is false
.
force_config_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. Default is
false
.
no_reuse_address = bool() <optional>
true
the agent does not specify that the IP
and port address should be reusable. If false
the agent
the address is set to reusable. Default is false
.
snmp_agent_type = master | sub <optional>
master
, one master agent is
started. Otherwise, no agents are started. Default is
master
.
snmp_config_dir = string() <mandatory>
snmp_db_dir = string() <mandatory>
snmp_master_agent_mibs = [string()] <optional>
snmp_config_dir
.
snmp_multi_threaded = bool() <optional>
true
, the agent is multi-threaded, with one
thread for each get request. Default is false
.
snmp_req_limit = integer() | infinity <optional>
infinity
.
snmp_priority = atom() <optional>
normal
.
v1 = bool() <optional>
true
.
v2 = bool() <optional>
true
.
v3 = bool() <optional>
true
.
snmp_local_db_auto_repair = false | true | true_verbose
<optional>
false
, and some errors occur, a new
datebase is created instead. If true
, erroneous transactions
(in the logfile) are ignored. If true_verbose
, erroneous
transactions (in the logfile) are igored and an error message is
written. Default is true
.
snmp_mibentry_override = bool() <optional>
false
.
snmp_trapentry_override = bool() <optional>
false
.
snmp_error_report_mod = atom() <optional>
snmp_error
and snmp_error_io
.
Default is snmp_error
.
snmp_master_agent_verbosity = silence | info | log | debug | trace <optional>
silence
.
snmp_symbolic_store_verbosity = silence | info | log | debug | trace <optional>
silence
.
snmp_note_store_verbosity = silence | info | log | debug | trace <optional>
silence
.
snmp_net_if_verbosity = silence | info | log | debug | trace <optional>
silence
.
snmp_mibserver_verbosity = silence | info | log | debug | trace <optional>
silence
.
snmp_mib_storage = ets | {dets,Dir} | {dets,Dir,Action} | {mnesia,Nodes} | {mnesia,Nodes,Action} <optional>
ets
.
Dir = string()
. Dir is the directory where the (dets)
files will be created.
Nodes = [node()]
. 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
table already exist.
To to start the agent, the agent 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> application:start(crypto). ok 2> snmp:config(). Simple SNMP configuration tool (v3.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 1. System name (sysName standard variable) [mbj's agent] 2. Engine ID (snmpEngineID standard variable)[mbj's engine] 3. The UDP port the agent listens to. (standard 161) [4000] 4. IP address for the agent (only used as id when sending traps) [dront.ericsson.se] 5. IP address for the manager (only this manager will have access to the agent, traps are sent to this one) [dront.ericsson.se] 6. To what UDP port at the manager should traps be sent (standard 162)? [5000] 7. What SNMP version should be used (1,2,3,1&2,1&2&3,2&3)? [3] 7b. Should notifications be sent as traps or informs? [trap] 8. Do you want a none- minimum- or semi-secure configuration? Note that if you chose v1 or v2, you will not get any security for these requests (none, minimum, semi) [minimum] 8b. Give a password of at least length 8. It is used to generate private keys for the configuration.secretpasswd 9. Where is the configuration directory (absolute)? [/home/mbj/snmp_conf] 10. Current configuration files will now be overwritten. Ok [y]/n? ------------------------ 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. The following files were written: agent.conf, community.conf, standard.conf, target_addr.conf, target_params.conf, notify.conf vacm.conf, sys.config, usm.conf ------------------------ ok
Start Erlang with the command:
erl -config /home/mbj/snmp_conf/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 process of the agent (possibly with
the exception of the net_if module, which could be supplied by a user
of the application). This can be done in two ways. Either by
calling the snmp:verbosity/2
function 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
.
The old debugging is still available and produces more or less the same output, i.e. the debug flag can be turned on to verify that the configuration is correct and that the instrumentation functions behave as expected. The agent then shows all network communication (incoming/outgoing traffic), and calls to the instrumentation functions.
3> snmp:debug(snmp_master_agent, true). ok 4> %% 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
snmp_local_db:print/0,1,2
. For example, this function can
show the counters snmpInPkts
and snmpOutPkts
. Enter
the following command:
4> snmp_local_db:print(). %% A lot of information.