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
1
2
| apt update
apt install -y snmpd
|
- backup original configuration file.
1
2
|
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.backup
|
- Create a new config file.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| 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
1
| iptables -A INPUT -s 192.168.0.0/22 -p udp --dport 161 -j ACCEPT
|
Restart snmpd service to apply settings
1
2
|
systemctl restart snmpd
|
Testing
1
| snmpwalk -c OkayWorld -v1 $servername$ SNMPv2-MIB::sysDescr.0
|
QA
###1. 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:
1
2
3
| sed -i "s|-Lsd|-LS6d|" /lib/systemd/system/snmpd.service
systemctl daemon-reload
systemctl restart snmpd
|
Reference