How to install snmp service on proxmox ve

How to setup snmp service to let us to use librenms to moniting our proxmox ve healthy status is very important for us.

Install snmpd on proxmox ve

apt update
apt install -y snmpd

Configure snmpd.conf

  • backup original configuration file.

mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.backup

  • Create a new config file.
cat > /etc/snmp/snmpd.conf << EOF
# this create a  SNMPv1/SNMPv2c community named ""
# and restricts access to LAN adresses 192.168.0.0/22 (last two 0's are ranges)
rocommunity OkayWorld 192.168.0.0/22
# setup info
syslocation  "rack 1, room 3, serverrroom"
syscontact  "xxx@xxx.xxx"
# open up
agentAddress  udp:161
# run as
agentuser  root
# dont log connection from UDP:
dontLogTCPWrappersConnects yes
# fix for disks larger then 2TB
realStorageUnits 0
EOF

Firewall allow lan can access

iptables -A INPUT -s 192.168.0.0/22 -p udp --dport 161 -j ACCEPT

Restart snmpd service to apply settings


systemctl restart snmpd

Testing

snmpwalk -c OkayWorld -v1 $servername$ SNMPv2-MIB::sysDescr.0

QA

error on subcontainer ‘ia_addr’ insert (-1)

After systemd migration starting from Debian 9 Stretch, you need to change /lib/systemd/system/snmpd.service file, not /etc/default/snmpd file:

sed -i "s|-Lsd|-LS6d|" /lib/systemd/system/snmpd.service
systemctl daemon-reload
systemctl restart  snmpd

Reference