网络监控之神(四)

来源:互联网 发布:西门子编程电缆那种好 编辑:程序博客网 时间:2024/04/27 23:40
添加第二台windows服务器


我们要添加第二台win服务器来监控,其实也很简单!!这台服务器hostname是vhost,ip是1.x.x.x

==============================
第二台win服务器也要安装nsclient++
安装方法和第一台win服务器安装方法一样
这里就不再叙述
安装之后,需要开放12489端口!
并且netstat查看是否在侦听
并且 nagios服务器telnet到win-server 12489端口
====================================================
下面是服务器配置

1。如果是nagios3.x版本,那么/usr/local/nagios/etc/object/commands.cfg不需要修改的!

2。我们在/usr/local/nagios/etc/object/下新建一个vhost.cfg文件(其实哪里都无所谓,最后你都要修改nagios.cfg的)

vi /usr/local/nagios/etc/object/vhost.cfg

里面添加:
define host{
        use             windows-server 
        host_name       aiyo-vhost223
        alias           My Windows Server      
        address         1.x.x.x
        }

define hostgroup{
        hostgroup_name   aiyo-windows-servers        #这里要填写和windows.cfg不一样的,否则会出错 
        alias                     Windows Servers
        }


define service{
        use                     generic-service
        host_name               aiyo-vhost223
        service_description     NSClient++ Version
        check_command           check_nt!CLIENTVERSION
        }


define service{
        use                     generic-service
        host_name               aiyo-vhost223
        service_description     Uptime
        check_command           check_nt!UPTIME
        }

define service{
        use                     generic-service
        host_name               aiyo-vhost223
        service_description     CPU Load

        check_command           check_nt!CPULOAD!-l 5,80,90
        }

define service{
        use                     generic-service
        host_name               aiyo-vhost223
        service_description     C:/ Drive Space
        check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
        }

define service{
        use                     generic-service
        host_name               aiyo-vhost223
        service_description     W3SVC
        check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
        }

define service{
        use                     generic-service
        host_name               aiyo-vhost223
        service_description     Explorer
        check_command           check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
        }


define service{
        use                     generic-service
        host_name               aiyo-vhost223
        service_description     Memory Usage
        check_command           check_nt!MEMUSE!-w 80 -c 90
        }

保存退出!


3。编辑主配置文件nagios.cfg

里面添加:cfg_file=/usr/local/nagios/etc/objects/vhost.cfg

然后检测/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

如果没有出错,!那么可以启动了!

原创粉丝点击