SNMP.CONFSection: File Formats (5)
Updated: 28 Aug 2001
Return to Main Contents
NAMEsnmp_config - describes how to configure the ucd-snmp applications.
DESCRIPTIONThe ucd-snmp package uses various configuration files to configure its applications. This manual page merely describes the overall nature of them, so that the other manual pages don't have to.
DIRECTORIES SEARCHEDFirst off, there are numerous places that configuration files can be found and read from. By default, the applications look for configuration files in the following 3 directories, in order: /etc/snmp, /usr/lib/snmp, and $HOME/.snmp. In each of these directories, it looks for files with the extension of both .conf and .local.conf (reading the second on last). In this manner, there are 6 default places a configuration file can exist for any given configuration file type.
Additionally, the above default search path can be overridden by setting the environment variable SNMPCONFPATH to a ':' separated list of directories to search for.
CONFIGURATION FILE TYPESEach application may use multiple configuration files, which will configure various different aspects of the application. For instance, the SNMP agent (snmpd) knows how to understand configuration directives in both the snmpd.conf and the snmp.conf files. In fact, most applications understand how to read the contents of the snmp.conf files. Note, however, that configuration directives understood in one file may not be understood in another file. For further information, read the associated manual page with each configuration file type. Also, most of the applications support a '-H' switch on the command line that will list the configuration files it will look for and the directives in each one that it understands.
The snmp.conf configuration file is intended to be a application suite wide configuration file that supports directives that are useful for controlling the fundamental nature of all of the snmp applications, such as how they all manipulate and parse the textual SNMP mib files.
SWITCHING CONFIGURATION TYPES IN MID-FILEIt's possible to switch in mid-file the configuration type that the parser is supposed to be reading. Since that sentence doesn't make much sense, lets give you an example: say that you wanted to turn on packet dumping output for the agent by default, but you didn't want to do that for the rest of the applications (ie, snmpget, snmpwalk, ...). Normally to enable packet dumping in the configuration file you'd need to put a line like:
into the snmp.conf file. But, this would turn it on for all of the applications. So, instead, you can put the same line in the snmpd.conf file so that it only applies to the snmpd demon. However, you need to tell the parser to expect this line. You do this by putting a special type specification token inside a  set. In other words, inside your snmpd.conf file you could put the above snmp.conf directive by adding a line like so:
This tells the parser to parse the above line as if it were inside a snmp.conf file instead of an snmpd.conf file. If you want to parse a bunch of lines rather than just one then 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:
Information about writing C code that makes use of this system in either the agent's mib modules or in applications can be found in the read_config(3) manual page.
This document was created by man2html, using the manual pages.
Time: 01:06:19 GMT, March 05, 2024