---
title: "Nagios 远程监控 (win)"
author: "xiaolin0199"
date: "2014-11-24T16:31:49Z"
tags: []
categories: ["互联网"]
slug: "nagios-win"
draft: false
lastmod: "2014-11-24T16:39:39Z"
id: 2159775
url: "https://xiaolin0199.iteye.com/blog/2159775"
---

参考 :  [http://www.mamicode.com/info-detail-135011.html](http://www.mamicode.com/info-detail-135011.html)

[http://blog.chinaunix.net/uid-24960107-id-1569675.html](http://blog.chinaunix.net/uid-24960107-id-1569675.html)

[http://yahoon.blog.51cto.com/13184/41897/](http://yahoon.blog.51cto.com/13184/41897/)

 

先前我们讲到要控制远端Linux主机需要用到 NRPE，那 Win主机呢，需要的就是NSClient++这个东西了 ...

 

1\.  如何 安装 NSClient

 

写道

从http://www.nsclient.org/nscp/downloads 下载最新版的NSClient++

安装的过程和其他windows应用程序的安装过程类似，next即可，选项我们都保持默认

安装过程中需要填写监控端的IP地址和密码，以及把下面的Modules全部勾选上。

我下的是最新的 NSCP-0.4.2.93-x64

 

![](http://dl2.iteye.com/upload/attachment/0103/5972/5faa81d6-525a-38f7-8a34-812e67f00a07.jpg)  
   
 

2\. 检查NSClient服务是否启动正常

![](http://dl2.iteye.com/upload/attachment/0103/5968/296e46a0-bb5a-30c6-9ec3-ef24c82de4d3.jpg)  
 

3\.  进入 services.msc 查看 nsclient++服务是否 为自动启动;

![](http://dl2.iteye.com/upload/attachment/0103/5970/05cc5ff8-ca9a-378e-9782-58538e721687.png)  
 

4\. 关于nsclient++的配置文件

写道

默认是安装在C:\\Program Files\\NSClient++ 目录下

nsclient.ini即为NSClient服务的配置文件，一般我们无需修改，

但是当我们监控端的IP地址改变时，或者密码忘记，即可以在这里修改了。

 

5.最后记得防火墙，步骤2中 的服务端口 一定要记得开放....

 

 

------------------    华丽的分割线     ------------------------

 

上面5步就完成了win主机被控端的设置 ， 下面我们看看在控制端如何去监控信息...

多的不说了，直接上代码及图

 

```
#############

# COMMAND
define command {
        command_name    check_nt_bbt
        command_line    /usr/lib/nagios/plugins/check_nt -H '$HOSTADDRESS$' -p 12489 -v '$ARG1$' -l '$ARG2$' -d '$ARG3$'
}

define hostgroup {
        hostgroup_name       BBT-TEST-WIN
	alias                             BBT TEST SERVER FOR WIN
	members                     win-220
        }


#  HOST
define host{
    use                        generic-host
    host_name                  win-220
    alias                      10.10.10.220
    address                    10.10.10.220
    hostgroups                 BBT-TEST-WIN
    }


# win system
define service{
    use                        generic-service
    hostgroup_name             BBT-TEST-WIN
    service_description        Systme Uptime
    check_command              check_nt_bbt!UPTIME
    }

define service{
    use                        generic-service
    hostgroup_name             BBT-TEST-WIN
    service_description        Cpu Load
    check_command              check_nt_bbt!CPULOAD!5,80,90
    }

define service{
    use                        generic-service
    hostgroup_name             BBT-TEST-WIN
    service_description        Mem Use
    check_command              check_nt_bbt!MEMUSE!-w 80 -c 90
    }

define service{
    use                        generic-service
    hostgroup_name             BBT-TEST-WIN
    service_description        Monitoring C
    check_command              check_nt_bbt!USEDDISKSPACE!c
    }


# win service
define service{
    use                        generic-service
    hostgroup_name             BBT-TEST-WIN
    service_description        OEBBTServer
    check_command              check_nt_bbt!SERVICESTATE!OEBBTServer!SHOWALL
    }

define service{
    use                        generic-service
    hostgroup_name             BBT-TEST-WIN
    service_description        OEMySql
    check_command              check_nt_bbt!SERVICESTATE!OEMySql!SHOWALL
    }

define service{
    use                        generic-service
    hostgroup_name             BBT-TEST-WIN
    service_description        memcached Server
    check_command              check_nt_bbt!SERVICESTATE!memcached Server!SHOWALL
    }

define service{
    use                        generic-service
    hostgroup_name             BBT-TEST-WIN
    service_description        tvnserver
    check_command              check_nt_bbt!SERVICESTATE!tvnserver!SHOWALL
    }



# win process
define service{
    use                        generic-service
    hostgroup_name             BBT-TEST-WIN
    service_description        OeRunServer.exe
    check_command              check_nt_bbt!PROCSTATE!OeRunServer.exe!SHOWALL
    }

define service{
    use                        generic-service
    hostgroup_name             BBT-TEST-WIN
    service_description        httpd.exe
    check_command              check_nt_bbt!PROCSTATE!httpd.exe!SHOWALL
    }

define service{
    use                        generic-service
    hostgroup_name             BBT-TEST-WIN
    service_description        memcached.exe
    check_command              check_nt_bbt!PROCSTATE!memcached.exe!SHOWALL
    }

define service{
    use                        generic-service
    hostgroup_name             BBT-TEST-WIN
    service_description        tvnserver.exe
    check_command              check_nt_bbt!PROCSTATE!tvnserver.exe!SHOWALL
    }
```

 

![](http://dl2.iteye.com/upload/attachment/0103/5977/23f4448a-757c-302f-9e65-e0cd6ce2e1dd.png)