2019年3月22日 星期五

Proxmox 加入 Librenms

apt-get install snmp snmpd
apt-get install libpve-apiclient-perl sudo
wget https://raw.githubusercontent.com/librenms/librenms-agent/master/agent-local/proxmox -O /etc/snmp/proxmox
chmod +x /etc/snmp/proxmox

wget -O /etc/snmp/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
chmod +x /etc/snmp/distro

#修改 /etc/sudoers
echo "Debian-snmp     ALL=(ALL) NOPASSWD: /etc/snmp/proxmox">> /etc/sudoers

#修改 /etc/snmp/snmpd.conf
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ori

cat <<EOF $gt;/etc/snmp/snmpd.conf
rocommunity public localhost
rocommunity public 192.168.0.0/16

#sysName hostname
syslocation 5FG
syscontact email@email
extend hardware "/bin/cat /sys/devices/virtual/dmi/id/product_name"
extend manufacturer "/bin/cat /sys/devices/virtual/dmi/id/sys_vendor"
extend distro "/etc/snmp/distro"
extend proxmox  "/usr/bin/sudo /etc/snmp/proxmox"
EOF

systemctl enable snmpd
systemctl start snmpd

沒有留言: