Windows 安装和配置 net-snmp 代理

下载安装

net-snmp下载地址:http://sourceforge.net/projects/net-snmp/

下载的安装程序:net-snmp-5.6.1.1-1.x86.exe

Perl下载地址:http://www.perl.org/get.html#win32

下载的安装程序:ActivePerl-5.16.3.1603-MSWin32-x86-296746.msi

配置snmp

在路径(软件安装路径)\etc\snmp\下,添加文件snmpd.conf,另外此路径下已经有了一个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                  public
com2sec local         192.168.1.x          public
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服务)

注册snmp agent服务

在(软件安装路径)\路径下,打开文件registeragent.bat就行,自动注册服务

重新启动snmp

>net stop "net-snmp agent"
>net start "net-snmp agent"

也可以打开所有程序->管理工具->服务,找到Net-SNMP Agent服务,然后重新启动

配置监控

假如要允许让某台服务器监控,假设此服务器IP为1.2.3.4,则在com2sec mynetwork 192.168.1.0/24 public

此行下面添加如下com2sec mynetwork 1.2.3.0/24 public

然后重启Net-SNMP Agent服务即可。