TUT:Configuring Net-SNMP Applications

From Net-SNMP Wiki
(Redirected from Configuration)
Jump to: navigation, search

All of the Net-SNMP applications use similar configuration file structures. Global configuration that affects every application can be placed in a snmp.conf file, and application specific configuration can be placed in application specific files like snmpd.conf and snmptrapd.conf.


By default, configuration file tokens are grouped into 2 contexts: application specific configuration tokens and Net-SNMP-wide configuration tokens. If you have a Net-SNMP-wide configuration token you want to apply to a particular application you can proceed it with the proper context surronded by []s and place it in the application specific file. For example:

 # /usr/local/share/snmp/snmptrapd.conf:
 [snmp] mibs +MY-SPECIAL-TRAPS-MIB

Include File

Requires Net-SNMP 5.6

Note: Features discussed on this page require Net-SNMP version 5.6 or higher.

You can include other files from within .conf files. Such as:

 # $HOME/.snmp/snmp.conf:
 include another.conf

Host Specific Configuration Files

Requires Net-SNMP 5.6

Note: Features discussed on this page require Net-SNMP version 5.6 or higher.

Host specific configuration files are also possible in order to set specific variables that are intended only for certain hosts. For example, if you you have a $HOME/.snmp/hosts/host1.example.com.conf file that contains:

 16bitIDs true

Then when you run snmpget or any other application it will refrain from using 32bit messageIDs (a SNMP bug that exists in certain devices).

This is especially powerful when combined with the include statement:

 # $HOME/.snmp/snmp.conf:
 defVersion 3
 defSecurityLevel authPriv
 # ...
 # $HOME/.snmp/hosts/router.conf:
 include insecure.conf
 # $HOME/.snmp/insecure.conf:
 # this file overrides the default access settings in the snmp.conf file for our lame servers that don't support SNMPv3
 defVersion 1
 defCommunity public

Host specific transport specifiers

If you have a particular way you wish to talk to "host1" you can also add a "transport" token to the host1.conf file:

 # $HOME/.snmp/hosts/host1.conf
 transport tls:host1.example.com:10161

Which lets you run "snmpwalk host1 system" for example and have it automatically use the "tls:host1.example.com:10161" complete transport specification to make the connection with.

Application specific configuration


TBD: Describe how init_snmp("appname") triggers reading of appname.conf files