This chapter describes the snmp
application in OTP. The SNMP application provides the following
services:
The following configuration parameters are defined for the SNMP application. Refer to application(3) for more information about configuration parameters.
A minimal config file for starting a node with both a manager and an agent:
[{snmp,
[{agent, [{db_dir, "/tmp/snmp/agent/db"},
{config, [{dir, "/tmp/snmp/agent/conf"}]}]},
{manager, [{config, [{dir, "/tmp/snmp/manager/conf"},
{db_dir, "/tmp/snmp/manager/db"}]}]}]}
]
}
].
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()} |
{target_cache, target_cache()} |
{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().target_cache() = [target_cache_opt()]
target_cache_opt() = {verbosity, verbosity()}target_cache_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 an 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, 15 seconds (15000), 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.application(3), disk_log(3)