- overview of Net-SNMP configuration files
This page gives an overview of the various configuration files used by the Net-SNMP software that is shipped with the Solaris operating system.
In a configuration file, lines beginning with a hash character (#) are treated as a comment and are not parsed.
By default, the Net-SNMP applications look for configuration files in the following directories in the order listed:
In each of these directories, the Net-SNMP applications look for files with the extensions .conf and local.conf, in that order.
The default search path described above can be overridden by setting the environment variable SNMPCONFPATH to a colon-separated list of directories. SNMPCONFPATH is used to allow users to place configuration files in specific directories for their application needs. Currently defaulted to /etc/sma/snmp and /usr/local/share/snmp.
Applications that store persistent data will also look in the /var/net-snmp directory for configuration files.
You can switch in mid-file the configuration type that the parser is supposed to be reading. For example, assume you want to turn on packet dumping output for the agent by default, but you do not want to turn on packet dumping for the rest of the applications (such as snmpget and snmpwalk). Normally, to enable packet dumping, you would enter a line such as the one below in the snmp.conf file:
Such a line turns on packet dumping for all of the applications. Instead, you can put the same line in the snmpd.conf file so that it applies only to the snmpd daemon. However, you need to tell the parser to expect this line. You do this by putting a special, type-specification token inside square brackets. For example, inside your snmpd.conf file you can enter:
[snmp] dumpPacket true
This tells the parser to parse the line as if it were inside a snmp.conf file instead of an snmpd.conf file. If you want to parse multiple lines rather than just one, you can make the context switch apply to the remainder of the file or until the next context switch directive by putting the special token on a line by itself:
# make this file handle snmp.conf tokens: [snmp] dumpPacket true logTimestamp true # return to our original snmpd.conf tokens: [snmpd] rocommunity mypublic
See attributes(5) for descriptions of the following attributes: