This came about when investigating an issue where SNMPd would not respond, when everything indicated that it should.
First, confirm your snmpd.conf (or snmpd.local.conf) is correct. Use a the default, one built with the snmpconf -g basic_setup or a known good config.
If this still doesn't work as you expect, confirm that snmp is starting with the correct options.
The default snmp process is started in the following manner:
/usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a
Confirm that -C isn't being used accidentally (Instruct snmpd to not read the config).
You can run effectively run snmpd in the foreground using the following method:
/usr/sbin/snmpd -Lo -p /var/run/snmpd.pid –a
This will output snmpd's normal output to stdout (the command line).
Pay particular attention to the first few lines. There is a fair enough of information that may be presented in the first few lines. If your config is incorrect, has tokens that snmp doesn't understand etc. all these errors will appear at the start.
A particularly tricky one however is:
Warning: no access control information configured.
It's unlikely this agent can serve any useful purpose in this state.
Run "snmpconf -g basic_setup" to help you configure the snmpd.conf file for this agent.
You get this error when snmpd starts without any kind of access control in the config. Check your config that you've specified all the requirements for snmpd to repsond to a specific community string.
If you're using the default .conf, or one build with snmpconf -g basic_setup and you still get this error, chances are snmpd isn't reading the config at all.
You can confirm this by using the following method:
/usr/sbin/snmpd -c /etc/snmp/snmpd.conf -Lo -p /var/run/snmpd.pid -a
This explicitly specifies the config to read when snmpd starts up. Again this outputs to the command line. All being correct, you should get no errors. If you still get access control errors then your config if definitely wrong.
So you've found the problem, snmpd isn't reading your config, but how do you make it? Easier said than done. You can try and upgrade/downgrade your net-snmp package (and dependancies), but this might not resolve the issue.
There is a work-around, which is to check the snmpd start up script (init.d) and see where it loads the startup options from.
Example of /etc/init.d/snmpd
OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"
if [ -e /etc/sysconfig/snmpd.options ]; then
Here we can see that the OPTIONS are specified in the startup script, unless they are read from /etc/sysconfig/snmpd.options and are over written.
Looking at the contents of /etc/sysconfig/snmpd.options shows:
- snmpd command line options# OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"
So everything is commented out by default, so the default OPTIONS value from the startup script is used.
To override these options with config specifying ones, we simply change the .options file to:
- snmpd command line options# OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"OPTIONS="-c /etc/snmp/snmpd.conf -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"
NB. You can of course specify /etc/snmp/snmpd.local.conf in the startup options, or for that matter, and file.