snmp問題,請高手指點
snmp.conf文件內容如下(這台主機的ip為192.168.0.9):
# First, map the community name "public" into a "security name"
# sec.name source community
#com2sec notConfigUser default public
com2sec notConfigUser default public
####
# Second, map the security name into a group name:
# groupName securityModel securityName
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
####
# Third, create a view for us to let the group have rights to:
# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
view all included .1
####
# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact systemview none none
access notConfigGroup "" any noauth exact all none none
access notConfigGroup "" any noauth exact mib2 none none
exec .1.3.6.1.4.1.2021.56 mem /bin/bash /tmp/memtest.sh
exec .1.3.6.1.4.1.2021.57 cpu /bin/bash /tmp/cpustat.sh
我在192.168.0.15主機上測試,輸入命令snmpwalk -v 1 192.168.0.9 -c public .1.3.6.1.4.1.2021.57,怎麼提示END MIB.
cat memtest.sh
#!/bin/bash
free -m|grep -i mem|awk '{print $3}'
free -m|grep -i mem|awk '{print $2}'
cat cpustat.sh
#!/bin/bash
idle=`sar -u 1 3|grep -i average|awk '{print $7}'`
used=`echo "100 - $idle"|bc -l -s`
echo $idle
echo $used
《解決方案》
那位大哥知道,賜教一下.
《解決方案》
在頂一下,cu沒人了嗎???