yum update
yum -y install net-snmp net-snmp-utils wget
wget -O /etc/snmp/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro;chmod +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
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"
sysName hostname
syslocation 5FG
syscontact email@email
EOF
systemctl start snmpd;systemctl enable snmpd;sleep 3;systemctl restart snmpd
測試
snmpwalk -v 2c -c public localhost
沒有留言:
張貼留言