Difference between revisions of "TUT:Configuring Net-SNMP Applications"

From Net-SNMP Wiki
Jump to: navigation, search
(Internals)
Line 41: Line 41:
 
   defVersion 1
 
   defVersion 1
 
   defCommunity public
 
   defCommunity public
 +
 +
== Application specific configuration ==
 +
 +
* [[TUT:Configuring snmpd]]
 +
* [[TUT:Configuring snmptrapd]]
  
 
== Internals ==
 
== Internals ==
  
 
TBD: Describe how init_snmp("appname") triggers reading of appname.conf files
 
TBD: Describe how init_snmp("appname") triggers reading of appname.conf files

Revision as of 21:58, 17 June 2010

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.

Contexts

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

Application specific configuration

Internals

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