Overview
These 4 commands are based on CentOS. These should work for most other distros too.
Since the default snmpd.conf file can contain a lot of info I'm going to create the simplest conf we can to minimize errors. The snmpd.conf file lives in /etc/snmp/ on most linux distros.
Prerequisites
If you haven't already installed snmp on your linux server then you'll want to grab both the net-snmp and net-snmp-utils packages. If you don't know the exact distro that you're running then use this command: cat /etc/*-release
CentOS 6 or older: yum install net-snmp net-snmp-utils
CentOS 7: dnf install net-snmp net-snmp-utils
Ubuntu: apt-get install snmp
Configuration
Backup original snmpd.conf file
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
Create a new snmpd.conf file and populate it with a single line.
touch /etc/snmp/snmpd.conf
echo "rocommunity public" > /etc/snmp/snmpd.conf
Restart the SNMP service.
service snmpd restart
If snmp works after the configuration above then it is either an misconfigured snmpd.conf file or snmp view limitations. If you prefer, you can leave the new snmpd.conf file in place.
Troubleshoot
If the above configuration does not fix the issues then try these steps
- Test if snmp is listening. Replace public with your community string. If this works then the screen should fill with lots of SNMP info.
- command: snmpwalk –v2c –c public localhost
- Test if iptables (firewall) is running.
- command: service iptables status
- If it is running, try service iptables stop and then test snmp from Orion again.
- If it works with iptables off then add some rules to iptables to allow it instead of keeping it off. Shout out to animelov for the commands/help!
iptables -I INPUT -p udp -m udp --dport 161 -j ACCEPT
iptables -I INPUT -p udp -m udp --dport 162 -j ACCEPT
iptables-save > /etc/sysconfig/iptables
service iptables restart
- If Orion still cannot connect to SNMP on the device the there is a firewall in-between Orion and the Linux host.