Nagios-Windows主机监控
2012-09-14 13:52
501 查看
本文转自:http://www.yylog.org/?p=4279
Windows监控端配置
NSClient++安装
下载NSClient++最新版,官网下载地址:http://www.nsclient.org
运行NSClient++-0.3.9-x64.msi安装包,进入向导模式安装,点击下一步即可。安装过程配置如图:Allowed hosts:设置Nagios服务器地址,NSClient password:设置NSClient端与Nagios服务器通讯时的口令,可以不设。下一步完成安装。
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_01.png)
安装完以后,Windows服务里会增加一项NSClient++ (x64)服务,如图:
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_02.png)
点击该服务的对话框,将登录项的“允许服务与桌面交互”勾上后保存退出。
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_03.png)
在命令行中执行nsclient++ SysTray install
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_04.png)
进入以安装的NSClient++-0.3.8-Win32下,编辑nsc.ini文件。
将[modules]项中的所有.dll文件注释取消,CheckWMI.dll和RemoteConfiguration.dll除外。
![](http://www.yylog.org/wp-content/uploads/2012/02/NSClient-conf_01.png)
在[Settings]项中去掉allowed_hosts前注释,填入Nagios服务器地址,或设为空,让主机自动连接Nagios服务器。
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_05.png)
在[NSClient]项中去掉port前注释,启用该端口,默认为端口号为:12489。
![](http://www.yylog.org/wp-content/uploads/2012/02/NSClient-conf_03.png)
打开命令行窗口,输入nsclient++ /start启动NSClient服务就可以了。检查12489端口是否监听,端口在监听下,以上windows客户端就配置就ok了!
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_cmd.png)
Nagios服务端配置
编辑nagios.cfg配置文件,定义cfg_file=/usr/local/nagios/etc/objects/windows7.cfg
# Definitions for monitoring the local (Linux) host
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
cfg_file=/usr/local/nagios/etc/objects/192.168.1.60.cfg
cfg_file=/usr/local/nagios/etc/objects/windows7.cfg
复制windows.cnf模版文件
[root@localhost objects]#cp windows.cfg windows7.cfg
修改windows7.cnf复制过来的模版文件,定义Windows监控对象。
[root@localhost objects]# vi windows7.cfg
#定义监控客户端主机
define host{
use windows-server ; Inherit default values from a template
host_name windows7; The name we’re giving to this host
alias My Windows Server ; A longer name associated with the host
address 192.168.1.18 ; IP address of the host
}
#定义监控客户端版本
define service{
use generic-service
host_name windows7
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
#定义监控客户端开机时间
define service{
use generic-service
host_name windows7
service_description Uptime
check_command check_nt!UPTIME
}
#定义监控客户端CPU使用率
define service{
use generic-service
host_name windows7
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}
#定义监控客户端内存使用率
define service{
use generic-service
host_name windows7
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90
}
#定义监控客户端C:盘使用率
define service{
use generic-service
host_name windows7
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
#定义监控客户端IIS服务
define service{
use generic-service
host_name windows7
service_description W3SVC
check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
}
#定义Explorer进程监控
define service{
use generic-service
host_name windows7
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}
检查nagios配置文件
[root@localhost ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
重启nagios服务
[root@localhost ~]# service nagios restart
Running configuration check…done.
Stopping nagios: done.
Starting nagios: done.
最后我们查看Nagios监控系统,发现Windows客户端已被监控。这样windows监控就配置完成了!
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_06.png)
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_07.png)
Windows监控端配置
NSClient++安装
下载NSClient++最新版,官网下载地址:http://www.nsclient.org
运行NSClient++-0.3.9-x64.msi安装包,进入向导模式安装,点击下一步即可。安装过程配置如图:Allowed hosts:设置Nagios服务器地址,NSClient password:设置NSClient端与Nagios服务器通讯时的口令,可以不设。下一步完成安装。
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_01.png)
安装完以后,Windows服务里会增加一项NSClient++ (x64)服务,如图:
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_02.png)
点击该服务的对话框,将登录项的“允许服务与桌面交互”勾上后保存退出。
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_03.png)
在命令行中执行nsclient++ SysTray install
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_04.png)
进入以安装的NSClient++-0.3.8-Win32下,编辑nsc.ini文件。
将[modules]项中的所有.dll文件注释取消,CheckWMI.dll和RemoteConfiguration.dll除外。
![](http://www.yylog.org/wp-content/uploads/2012/02/NSClient-conf_01.png)
在[Settings]项中去掉allowed_hosts前注释,填入Nagios服务器地址,或设为空,让主机自动连接Nagios服务器。
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_05.png)
在[NSClient]项中去掉port前注释,启用该端口,默认为端口号为:12489。
![](http://www.yylog.org/wp-content/uploads/2012/02/NSClient-conf_03.png)
打开命令行窗口,输入nsclient++ /start启动NSClient服务就可以了。检查12489端口是否监听,端口在监听下,以上windows客户端就配置就ok了!
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_cmd.png)
Nagios服务端配置
编辑nagios.cfg配置文件,定义cfg_file=/usr/local/nagios/etc/objects/windows7.cfg
# Definitions for monitoring the local (Linux) host
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
cfg_file=/usr/local/nagios/etc/objects/192.168.1.60.cfg
cfg_file=/usr/local/nagios/etc/objects/windows7.cfg
复制windows.cnf模版文件
[root@localhost objects]#cp windows.cfg windows7.cfg
修改windows7.cnf复制过来的模版文件,定义Windows监控对象。
[root@localhost objects]# vi windows7.cfg
#定义监控客户端主机
define host{
use windows-server ; Inherit default values from a template
host_name windows7; The name we’re giving to this host
alias My Windows Server ; A longer name associated with the host
address 192.168.1.18 ; IP address of the host
}
#定义监控客户端版本
define service{
use generic-service
host_name windows7
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
#定义监控客户端开机时间
define service{
use generic-service
host_name windows7
service_description Uptime
check_command check_nt!UPTIME
}
#定义监控客户端CPU使用率
define service{
use generic-service
host_name windows7
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}
#定义监控客户端内存使用率
define service{
use generic-service
host_name windows7
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90
}
#定义监控客户端C:盘使用率
define service{
use generic-service
host_name windows7
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
#定义监控客户端IIS服务
define service{
use generic-service
host_name windows7
service_description W3SVC
check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
}
#定义Explorer进程监控
define service{
use generic-service
host_name windows7
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}
检查nagios配置文件
[root@localhost ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Checking for circular paths between hosts... Checking for circular host and service dependencies... Checking global event handlers... Checking obsessive compulsive processor commands... Checking misc settings... Total Warnings: 0 Total Errors: 0
重启nagios服务
[root@localhost ~]# service nagios restart
Running configuration check…done.
Stopping nagios: done.
Starting nagios: done.
最后我们查看Nagios监控系统,发现Windows客户端已被监控。这样windows监控就配置完成了!
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_06.png)
![](http://www.yylog.org/wp-content/uploads/2012/08/20120813_NS_07.png)
相关文章推荐
- nagios系列(八)之nagios通过nsclient监控windows主机
- Nagios监控Windows主机
- nagios服务器搭建实现对Linux和windows主机监控及短信报警
- nagios系列(八)之nagios通过nsclient监控windows主机
- Nagios利用NSClient++监控Windows主机
- nagios实现对linux-server、windows-server主机的监控
- Nagios利用NSClient++监控Windows主机
- Nagios中NSClient++监控Windows主机
- 网络监控软件Nagios, Nagios是一款开源的免费网络监视工具,能有效监控Windows、Linux和Unix的主机状态,交换机路由器等网络设备,打印机等。在系统或服务状态异常时发出邮件或短信报
- 安装Nagios来监控远程Windows主机和Linux主机 推荐
- nagios监控windows主机
- Centos nagios监控windows主机并开启PNP模块
- 使用Ruby编写nagios监控脚本监控Windows主机
- Nagios 监控网络流量(Windows主机和交换机)
- 在nagios中监控windows主机系统地址的状态
- Nagios监控Linux和windows主机
- 监控之--Nagios监控远程windows主机及邮件告警功能的配置
- Nagios 监控Windows主机
- 设置ICMP例外(nagios监控windows主机)
- Nagios监控Windows主机