snmpwalk样例
1.编辑/etc/snmp/snmpd.conf文件
vim /etc/snmp/snmpd.conf
找到:#Executables /scripts
在后面加入,并保存:
exec echotest /bin/echo hello world
exec shelltest /bin/sh /tmp/shtest
进入/tmp/目录,加入如下内容,并保存:
cd /tmp
vim shtest
#!/bin/sh
echo hello world
echo hi there
exit 35
2.重启snmpd
命令:
systemctl restart snmpd
[root@logstash snmp]# systemctl restart snmpd
[root@logstash snmp]# systemctl status snmpd
● snmpd.service - Simple Network Management Protocol (SNMP) Daemon.Loaded: loaded (/usr/lib/systemd/system/snmpd.service; disabled; vendor preset: disabled)Active: active (running) since Wed 2024-09-04 10:17:58 CST; 6s agoMain PID: 7452 (snmpd)Tasks: 1Memory: 4.3MCGroup: /system.slice/snmpd.service└─7452 /usr/sbin/snmpd -LS0-6d -fSep 04 10:17:58 logstash systemd[1]: Starting Simple Network