SNMP Troubleshooting Tips
SNMP logs events to /var/log/messages
The key to solving SNMP issues is to examine that log file.
Also check /etc/hosts.deny it could be that someone has disabled snmpd by adding an entry there. This will look similar to this:
cat /etc/hosts.deny snmpd:ALL
To see if the service is running, do one of the following two things:
service snmpd status
or
ps -ef | grep snmpd
Both these commands will also show you with what flags snmpd
was started.
The configuration file for snmp is in /etc/snmpd/snmpd.conf and the service startup (snmpd) configuration file is in a different location depending on the distribution.
Try this on Ubuntu
/etc/default/snmpd
or this on CentOS/Redhat
/etc/sysconfig/snmpd
To configure snmpd, use this utility:
snmpconf -g basic_setup
PHP 7.4 / 8.0 and SNMP
To get PHP working with SNMP, you can’t rely on the built-in Ubuntu packages. You have to do this:
sudo add-apt-repository ppa:ondrej/php sudo apt install php7.4-snmp
To see if it worked, watch the console for errors or do this:
php -m | grep snmp
Follow the tags in our knowledgebase to get more tips on working with SNMP.