DoubleLi

qq: 517712484 wx: ldbgliet

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  4737 随笔 :: 2 文章 :: 542 评论 :: 1615万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

一、被监控的windows xp客户端的配置

1、安装NSClient++并安装
下载地址: http://sourceforge.net/projects/nscplus
NSClient++-0.3.8-Win32.msi  
NSClient++-0.3.8-x64.msi

2、安装NSClient++
双击安装 -> next -> 同意 -> next  -> next -> next -> 设置允许IP,设置密码(这里密码一般可以不设置),Modules to load (选前三个模块就可以了,第2个为chect_nt用于监控windows,第3个为checp_nrpe用于监控linux) -> next  -> install  -> finish

3、启动NSClientpp服务,并允许服务交互式

4、如果windows开启了自带的防火墙,那么必须设置让该程序通过




二、监控端主机的设置(Nagios服务器)

1、检查Nagios目录下的libexec子目录,一定要存在check_nt(例如:/usr/local/nagios/libexec/check_nt)



2、配置command.cfg文件(例如:/usr/local/nagios/etc/objects/command.cfg),增加如下几行(默认应该已经有了)

 

#/usr/local/nagios/etc/objects/command.cfg

 

# 'check_nt' command definition


define command{
command_name    check_nt
command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}

3、编译nagios.cfg文件

 

#/usr/local/nagios/etc/nagios.cfg,打开下面这一行

 

# Definitions for monitoring a Windows machine

 

cfg_file=/usr/local/nagios/etc/objects/windows.cfg



#vi  /usr/local/nagios/etc/objects/windows.cfg,下面为配置主要的监控项目



#定义要被监控的windows主机名与主机的IP地址

define host{

 

use             windows-server 

 

host_name       ruanxi         

 

alias           My Windows Server

 

address         192.168.0.5    

 

}



#定义一个主机名组(可以不用管它)

define hostgroup{

 

hostgroup_name  windows-servers

 

alias           Windows Servers

 

}



#检查windows主机是否已经安装了NSClient++,及它的版本号

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     NSClient++ Version

 

check_command           check_nt!CLIENTVERSION

 

}



#监控 windows 主机的开机运作时间

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     Uptime

 

check_command           check_nt!UPTIME

 

}



#监控 windows 主机的 CPU 负载

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     CPU Load

 

check_command           check_nt!CPULOAD!-l 5,80,90    #CPU如果到达80%则报警,到达90%则警笛

 

}



#监控 windows 主机的内存使用状况 

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     Memory Usage

 

check_command           check_nt!MEMUSE!-w 80 -c 90  #内存使用到达80%则warn,到达90%则Critical

 

}



#监控 windows 主机的 C:\ 的空间使用量 

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     C:\ Drive Space

 

check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90

 

}



#监控 windows主机的W3SVC设置的动作状况

                         ------>此服务为WEB服务器有关日志的服务程序

 

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     W3SVC

 

check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC

 

}



#监控 windows 主机的 Explorer.exe 执行程序的运作状况,如程序终止了,则会发 CRITICA

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     Explorer

 

check_command           check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe

 

}



#监控 windows 主机的 MSSQLSERVER 服务的运作状况,如服务终止了,则会发 CRITICAL 

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     MSSQL

 

check_command           check_nt!SERVICESTATE!-d SHOWALL -l MSSQLSERVER

 

}



说明:如果有多台的windows xp客户端要监控,那么就以上述这样写多个就可以了


3、检查nagios.cfg文件有没有错误

 

#nagios -c  nagios.cfg



4、重新启动一下nagios服务

 

#service nagios restart



5、访问页面进行查看

 

#elinks http://localhost/nagios/

posted on   DoubleLi  阅读(1818)  评论(1编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2016-09-20 Visual C++ for Linux Development
2016-09-20 微软为Visual Studio开发助手拓展C++支持
2016-09-20 在Linux中使用VS Code编译调试C++项目
2016-09-20 Linux常见设备及相应/dev/xxx文件名、Mount Point、挂载点、Mount命令、fstab、挂载分区
2012-09-20 ORACLE OEM
点击右上角即可分享
微信分享提示