{
    "content": [
        {
            "type": "text",
            "text": "# snmp_config (man)\n\n## NAME\n\nsnmpconfig - handling of Net-SNMP configuration files\n\n## DESCRIPTION\n\nThe  Net-SNMP  package  uses various configuration files to configure its applications.  This\nmanual page merely describes the overall nature of them, so that the other manual pages don't\nhave to.\n\n## Sections\n\n- **NAME**\n- **DESCRIPTION**\n- **DIRECTORIES SEARCHED**\n- **CONFIGURATION FILE TYPES**\n- **SWITCHING CONFIGURATION TYPES IN MID-FILE**\n- **COMMENTS**\n- **INCLUDING OTHER CONFIGURATION FILES**\n- **API INTERFACE**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "snmp_config",
        "section": "",
        "mode": "man",
        "summary": "snmpconfig - handling of Net-SNMP configuration files",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "snmpconf",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/snmpconf/1/json"
            },
            {
                "name": "netsnmpconfigapi",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/netsnmpconfigapi/3/json"
            },
            {
                "name": "snmp.conf",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/snmp.conf/5/json"
            },
            {
                "name": "snmpd.conf",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/snmpd.conf/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DIRECTORIES SEARCHED",
                "lines": 32,
                "subsections": []
            },
            {
                "name": "CONFIGURATION FILE TYPES",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "SWITCHING CONFIGURATION TYPES IN MID-FILE",
                "lines": 49,
                "subsections": []
            },
            {
                "name": "COMMENTS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "INCLUDING OTHER CONFIGURATION FILES",
                "lines": 23,
                "subsections": []
            },
            {
                "name": "API INTERFACE",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "snmpconfig - handling of Net-SNMP configuration files\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The  Net-SNMP  package  uses various configuration files to configure its applications.  This\nmanual page merely describes the overall nature of them, so that the other manual pages don't\nhave to.\n",
                "subsections": []
            },
            "DIRECTORIES SEARCHED": {
                "content": "First off, there are numerous places that configuration files can be found and read from.  By\ndefault, the applications look for configuration files in the following 4 directories, in or‐\nder: /etc/snmp, /usr/share/snmp, /usr/lib/x8664-linux-gnu/snmp, and $HOME/.snmp.  In each of\nthese directories, it looks for files snmp.conf, snmpd.conf and/or snmptrapd.conf, as well as\nsnmp.local.conf,  snmpd.local.conf  and/or snmptrapd.local.conf. *.local.conf are always read\nlast. In this manner, there are 8 default places a configuration file can exist for any given\nconfiguration file type.\n\nAdditionally,  the  above  default  search  path can be overridden by setting the environment\nvariable SNMPCONFPATH to a colon-separated list of directories to search for.  The  path  for\nthe persistent data should be included when running applications that use persistent storage,\nsuch as snmpd.\n\nApplications will read persistent configuration files in the following order of preference:\n\nfile in SNMPPERSISTENTFILE environment variable\ndirectories in SNMPCONFPATH environment variable\ndirectory defined by persistentDir snmp.conf variable\ndirectory in SNMPPERSISTENTDIR environment variable\ndefault /var/lib/snmp directory\n\nFinally, applications will write persistent configuration files in  the  following  order  of\npreference:\n\nfile in SNMPPERSISTENTFILE environment variable\ndirectory defined by persistentDir snmp.conf variable\ndirectory in SNMPPERSISTENTDIR environment variable\ndefault /var/lib/snmp directory\n\nNote:   When using SNMPPERSISTENTFILE, the filename should match the application name.  For\nexample, /var/net-snmp/snmpd.conf.\n",
                "subsections": []
            },
            "CONFIGURATION FILE TYPES": {
                "content": "Each application may use multiple configuration files, which will configure various different\naspects  of  the  application.   For instance, the SNMP agent (snmpd) knows how to understand\nconfiguration directives in both the snmpd.conf and the snmp.conf files.  In fact,  most  ap‐\nplications  understand  how to read the contents of the snmp.conf files.  Note, however, that\nconfiguration directives understood in one file may not be understood in another  file.   For\nfurther  information,  read  the  associated  manual  page with each configuration file type.\nAlso, most of the applications support a -H switch on the command line  that  will  list  the\nconfiguration files it will look for and the directives in each one that it understands.\n\nThe  snmp.conf  configuration  file  is intended to be a application suite wide configuration\nfile that supports directives that are useful for controlling the fundamental nature  of  all\nof  the  SNMP  applications,  such  as how they all manipulate and parse the textual SNMP MIB\nfiles.\n",
                "subsections": []
            },
            "SWITCHING CONFIGURATION TYPES IN MID-FILE": {
                "content": "It's possible to switch in mid-file the configuration type that the parser is supposed to  be\nreading.  Since that sentence doesn't make much sense, lets give you an example: say that you\nwanted to turn on packet dumping output for the agent by default, but you didn't want  to  do\nthat  for  the  rest  of  the  applications (ie, snmpget, snmpwalk, ...).  Normally to enable\npacket dumping in the configuration file you'd need to put a line like:\n\ndumpPacket true\n\ninto the snmp.conf file.  But, this would turn it on for all of the  applications.   So,  in‐\nstead,  you can put the same line in the snmpd.conf file so that it only applies to the snmpd\ndaemon.  However, you need to tell the parser to expect this line.  You do this by putting  a\nspecial  type  specification  token  inside a [] set.  In other words, inside your snmpd.conf\nfile you could put the above snmp.conf directive by adding a line like so:\n\n[snmp] dumpPacket true\n\nThis tells the parser to parse the above line as if it were inside a snmp.conf  file  instead\nof  an  snmpd.conf file.  If you want to parse a bunch of lines rather than just one then you\ncan make the context switch apply to the remainder of the file  or  until  the  next  context\nswitch directive by putting the special token on a line by itself:\n\n# make this file handle snmp.conf tokens:\n[snmp]\ndumpPacket true\nlogTimestamp true\n# return to our original snmpd.conf tokens:\n[snmpd]\nrocommunity mypublic\n\nThe  same approach can be used to set configuration directives for a particular client appli‐\ncation  (or  group  of   applications).    For   example,   any   program   that   uses   the\n'snmpparseargs()'  call  to  handle command-line arguments (including the standard command-\nline tools shipped as part of the Net-SNMP distributions) will automatically read the  config\nfile  'snmpapp.conf'.   To  set  library-level settings for these applications (but not other\nmore-specific tools), use configuration such as the following:\n\n[snmp] defCommunity myCommunity\n\nfor a single directive, or\n\n# make this file handle snmp.conf tokens:\n[snmp]\ndefCommunity myCommunity\ndefVersion   2c\n# return to our original snmpapp.conf tokens:\n[snmpapp]\n\nfor multiple settings.  Similarly for any other application token (as passed to initsnmp()).\n",
                "subsections": []
            },
            "COMMENTS": {
                "content": "Any lines beginning with the character '#' in the configuration files are treated as  a  com‐\nment and are not parsed.\n",
                "subsections": []
            },
            "INCLUDING OTHER CONFIGURATION FILES": {
                "content": "It  is  possible to include other configuration files for processing during normal configura‐\ntion file processing.:\n\n# include site specific config\nincludeFile site.conf\n\nThis will load the specified configuration file. The\npath to file must be either absolute, starting with '/',\nor relative. The relative path is then relative to the directory\nwhere the parent file with 'includeFile' directive resides.\n\nThe included file name does not need to have '.conf' suffix.\n\n# include a all *.conf files in a directory\nincludeDir /etc/snmp/config.d\n\nThis will search specified directory for all files with '.conf'\nsuffix and process them as if they were included using includeFile\ndirective. The configuration files are not processed in any particular\norder.\n\nThe specified directory must be absolute directory path.\n",
                "subsections": []
            },
            "API INTERFACE": {
                "content": "Information about writing C code that makes use of this system in either the agent's MIB mod‐\nules or in applications can be found in the netsnmpconfigapi(3) manual page.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "snmpconf(1), netsnmpconfigapi(3), snmp.conf(5), snmpd.conf(5)\n\n\n\nV5.9.1                                       08 Mar 2010                              SNMPCONFIG(5)",
                "subsections": []
            }
        }
    }
}