nagios nsclient 安装

安装

nsclient install (windows)
1.解压到: C:\NSClient++
2.修改nsc.ini文件:  allowed_hosts=192.168.X.X
3.注册NSCient++的服务: nsclient++ /install
4.在服务列表中找到NSClientpp的服务。双击打开该服务的配置窗口侧在登录分页中将“允许服务与桌面交互”勾选上。
5.重启NSClientapp服务。

 

配置

#############Windows Nsclient############
define service{
        use                     generic-service
        hostgroup_name          windows-servers
        service_description     Uptime
        check_command           check_nt!UPTIME   --> 系统运行时间
        }
define service{
        use                     generic-service
        hostgroup_name          windows-servers
        service_description     CPU Load
        check_command           check_nt!CPULOAD!-l 5,80,90 --> 系统运行负载
        }
define service{
        use                     generic-service
        hostgroup_name          windows-servers
        service_description     Memory Usage
        check_command           check_nt!MEMUSE!-w 90 -c 95  -->  系统内存占用量
        }

define service{
        use                     generic-service
        hostgroup_name          windows-servers
        service_description     C:\ Drive Space
        check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90 -->系统C盘磁盘空间
        }
define service{
        use                     generic-service
        hostgroup_name          windows-servers
        service_description     D:\ Drive Space
        check_command           check_nt!USEDDISKSPACE!-l d -w 80 -c 90  -->系统D盘磁盘空间

define service{
        use                     generic-service
        host_name               192.168.185.4
        service_description     MMLogOrder
        check_command           check_nt!PROCSTATE!-d SHOWALL -l MakeMM.exe  -->系统管理器中MakeMM.exe进程存活性
        }

排错:

 

命令行测试发现

[root@all-wap service]# /usr/lib64/nagios/plugins/check_nt -H 192.168.145.3 -p 12489 -s xxx -v UPTIME
NSClient - ERROR: Could not get value

远程(cmd --> mstsc)登录后执行下列命令发现(红色部分显示countername 没找到,貌似语言字符集问题)

C:\NSClient++>nsclient++ /test 

d \PDHCollector.cpp(123) Found countername: CPU:    \????(_total)\????
d \NSClient++.cpp(773) Loading plugin: NRPE server...
d \PDHCollector.cpp(124) Found countername: UPTIME: \????\????
d \PDHCollector.cpp(125) Found countername: MCL:    \????\????
d \PDHCollector.cpp(126) Found countername: MCB:    \????\????
e \PDHCollector.cpp(133) Failed to open performance counters: \????(_total)\???
: PdhAddCounter failed: -1073738824: 在系统上找不到指定的对象。

d \PDHCollector.cpp(169) We aparently failed to load counters trying to use def
ult (English) counters or those configured in nsc.ini
e \PDHCollector.cpp(178) Failed to open performance counters: \Memory\Commit Li
it: PdhAddCounter failed: -1073738824: The specified object is not found on the
system.

e \PDHCollector.cpp(212) No performance counters were found we will not wait fo
 the end instead...
d \NSClient++.cpp(773) Loading plugin: NSClient server...
e \Socket.h(645) bind failed: 10048: 通常每个套接字地址(协议/网络地址/端口)只允
许使用一次。

d \NSClient++.cpp(773) Loading plugin: SystemTray...

###################################

执行下列命令解决

C:\NSClient++>lodctr /R

<--  lodctr命令备注:

lodctr /R:<Backup-FileName>

使用 <Backup-FileName> 还原 perf 注册表字符串和信息

lodctr /R

基于当前情况从头开始重建 perf 注册表字符串和信息

-->
C:\NSClient++>"NSClient++.exe" -stop
Stopping service.

C:\NSClient++>"NSClient++.exe" -start
Starting NSClientpp

 

重启后在监控主机上测试显示获取数据成功

[root@all-wap service]# /usr/lib64/nagios/plugins/check_nt -H 192.168.145.3 -p 12489 -s  xxx -v UPTIME
System Uptime - 6 day(s) 0 hour(s) 7 minute(s)

#################################################################### 

http://hi.baidu.com/cavaran/blog/item/413f952b4ec56683023bf679.html

http://hongliangpan.iteye.com/blog/218489

你可能感兴趣的:(nagios,nsclient)