2020年9月8日 星期二

Debian snmpd 設定

apt-get install -y snmp snmpd wget
wget -O /etc/snmp/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro

chmod a+x /etc/snmp/distro
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.$(date +%s)

cat <<EOF >/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"

#access   notConfigGroup ""       any       noauth     exact   all     none none
#view all    included  .1
EOF

systemctl enable snmpd;systemctl start snmpd

測試
snmpwalk -v 2c -c public localhost

沒有留言: