snmp_config - handling of Net-SNMP configuration files
Additionally, the above default search path can be overridden by setting the environment variable SNMPCONFPATH to a colon-separated list of directories to search for. The path for the persistent data should be included when running applications that use persistent storage, such as snmpd.
Applications will read persistent configuration files in the following order of preference:
file in SNMP_PERSISTENT_FILE environment variable
directories in SNMPCONFPATH environment variable
directory defined by persistentDir snmp.conf variable
directory in SNMP_PERSISTENT_DIR environment variable
default /var/lib/snmp directory
Finally, applications will write persistent configuration files in the following order of preference:
file in SNMP_PERSISTENT_FILE environment variable
directory defined by persistentDir snmp.conf variable
directory in SNMP_PERSISTENT_DIR environment variable
default /var/lib/snmp directory
Note: When using SNMP_PERSISTENT_FILE, the filename should match the application name. For example, /var/net-snmp/snmpd.conf.
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.
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 daemon. 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:
# make this file handle snmp.conf tokens: [snmp] dumpPacket true logTimestamp true # return to our original snmpd.conf tokens: [snmpd] rocommunity mypublic
Any lines beginning with the character '#' in the configuration files are treated as a comment and are not parsed.
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.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |