此种方式通过snmp协议来获取Windows主机的相关系统信息。因此Windows端必须配置SNMP服务,Nagios端要安装net-snmp包;
安装配置过程如下:
Windows 端:
配置SNMP Service:
按照以下方式配置,

安装:
1、安装并启动snmp服务

20070925_6d691227614737d67129D8JRqyvKazHP.gif
1.GIF


20070925_4833b441c66ecb1c4eef5nAe9f66Iwr4.gif
2.GIF



2、配置snmp community 和允许的主机列表

20070925_e6650615dbc9e20f2b4dmmZnUz7WWJE5.gif
3.GIF

3、开通防火墙的snmp协议端口udp 161(例如可以只允许Nagios Server如nagios.itnms.net访问)。
4、简单测试如下:
检测snmp service的运行状态:
H:\Chenl\bin>net start | grep -i snmp
   SNMP Service
检查端口Listen情况:
H:\Chenl\bin>netstat -an | grep 161
  UDP    0.0.0.0:161            *:*

Nagios Server端:
Server的安装配置已经说过很多,此处不在重复。有不明了的可以参考本论坛以前的文档。
其重要注明的有以下几点:
1)Server端需要安装net-snmp包。
可从如下地址下载, [url]http://net-snmp.sourceforge.net/[/url]
也可以通过安装盘,或者通过yum,apt等工具在线安装。
2)除了标准的plugins之后,还需要安装nagios-snmp-plugins,本文中使用的是V-1.1.1版本。
可从以下地址获取最新版本: [url]http://sourceforge.net/projects/nagios-snmp[/url]
3)本文中还是用了一些自定义的plugins(使用net-snmp-utils和bash编写)如其中check_snmp_conn及check_snmp_proc。
这些plugins在CentOS4.4下测试通过,不保证在所有的平台下都可以正常工作。

部分配置文件示例如下:
checkcommands.cfg:
# 'check_snmp_stor" command definition
define command{
        command_name    check_snmp_stor
        command_line    $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG1$ -m $ARG2$ -w $ARG3$ -c $ARG4$
        }
# 'check_snmp_load" command definition
define command{
        command_name    check_snmp_load
        command_line    $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG1$ -w $ARG2$ -c $ARG3$
        }
# 'check_snmp_proc" command definition
define command{
        command_name    check_snmp_proc
        command_line    $USER1$/check_snmp_proc $HOSTADDRESS$  $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
        }
# 'check_snmp_conn" command definition
define command{
        command_name    check_snmp_conn
        command_line    $USER1$/check_snmp_conn $HOSTADDRESS$  $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
        }
v-win2003.cfg:
define service{
        use                             generic-service         ; Name of service template to use
        host_name                       v-win2003
        service_description             check_disk_c
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              4
        normal_check_interval           5
        retry_check_interval            1
        contact_groups                  admins
notification_options  w,u,c,r
        notification_interval           960
        notification_period             24x7
check_command   check_snmp_stor!naios4windows!"^C"!80!90
        }


define service{
        use                             generic-service         ; Name of service template to use
        host_name                       v-win2003
        service_description             check_mem_phy
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              4
        normal_check_interval           5
        retry_check_interval            1
        contact_groups                  admins
notification_options  w,u,c,r
        notification_interval           960
        notification_period             24x7
check_command   check_snmp_stor!naios4windows!"^Physical Memory$"!60!90
        }
        
define service{
        use                             generic-service         ; Name of service template to use
        host_name                       v-win2003
        service_description             check_load
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              4
        normal_check_interval           5
        retry_check_interval            1
        contact_groups                  admins
notification_options  w,u,c,r
        notification_interval           960
        notification_period             24x7
check_command   check_snmp_load!naios4windows!75%!90%
        }        

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       v-win2003
        service_description             check_proc_mysqld-nt
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              4
        normal_check_interval           5
        retry_check_interval            1
        contact_groups                  admins
notification_options  w,u,c,r
        notification_interval           960
        notification_period             24x7
check_command   check_snmp_proc!naios4windows!.1.3.6.1.2.1.25.4.2!mysqld-nt.exe!1!0
        }        


define service{
        use                             generic-service         ; Name of service template to use
        host_name                       v-win2003
        service_description             check_proc_w3wp
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              4
        normal_check_interval           5
        retry_check_interval            1
        contact_groups                  admins
notification_options  w,u,c,r
        notification_interval           960
        notification_period             24x7
check_command   check_snmp_proc!naios4windows!.1.3.6.1.2.1.25.4.2!w3wp.exe!1!0
        }        

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       v-win2003
        service_description             check_conn_554
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              4
        normal_check_interval           5
        retry_check_interval            1
        contact_groups                  admins
notification_options  w,u,c,r
        notification_interval           960
        notification_period             24x7
check_command   check_snmp_conn!naios4windows!.1.3.6.1.2.1.6.13!554!5!3
        }        
define service{
        use                             generic-service         ; Name of service template to use
        host_name                       v-win2003
        service_description             check_conn_80
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              4
        normal_check_interval           5
        retry_check_interval            1
        contact_groups                  admins
notification_options  w,u,c,r
        notification_interval           960
        notification_period             24x7
check_command   check_snmp_conn!naios4windows!.1.3.6.1.2.1.6.13!80!5!3
        }