网上虽然有很多这方面的资料,不过都很乱,感觉说的也不太好,所以我总结了一下,我在windows 7上可以成功配置好
1. 下载安装
net-snmp安装程序:net-snmp-5.4.2.1-1.win32.exe
Perl安装程序:ActivePerl-5.10.0.1004-MSWin32-x86-287188.msi
安装过程默认就好
2.配置snmpd.conf文件
在路径(软件安装路径)\etc\snmp\下,添加文件snmpd.conf,注意去掉.txt后缀,另外此路径下已经有了一个snmp.conf文件,不要混乱两者,
然后一下两种方式二选一:
a.简单配置:在snmpd.conf加入:rocommunity public
b.详细配置:在snmpd.conf加入:
####
# First, map the community name (COMMUNITY) into a security name
# (local and mynetwork, depending on where the request is coming
# from):
# sec.name source community
com2sec local localhost root
com2sec local 192.168.1.110 root
com2sec mynetwork 192.168.1.0/24 public
####
# Second, map the security names into group names:
# sec.model sec.name
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup usm mynetwork
####
# Third, create a view for us to let the groups have rights to:
# incl/excl subtree mask
view all included .1 80
####
# Finally, grant the 2 groups access to the 1 view with different
# write permissions:
# context sec.model sec.level match read write notif
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
####
(注意每次改动snmpd.conf文件后都要重启snmp服务)
3.注册snmp agent服务,在(软件安装路径)\路径下,打开文件registeragent.bat就行,自动注册服务
4.然后重新启动snmp
>net stop "net-snmp agent"
>net start "net-snmp agent"
5.OK,可以使用了,测试一下吧:
>snmpwalk -v 2c -c root localhost if
>snmpwalk -v 2c -c root 192.168.1.110 if
>snmpget -v 2c -c root localhost 1.3.6.1.2.1.1.1.0