您的位置:首页 > 移动开发 > IOS开发

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服务器通讯时的口令,可以不设。下一步完成安装。





安装完以后,Windows服务里会增加一项NSClient++ (x64)服务,如图:





点击该服务的对话框,将登录项的“允许服务与桌面交互”勾上后保存退出。





在命令行中执行nsclient++ SysTray install





进入以安装的NSClient++-0.3.8-Win32下,编辑nsc.ini文件。

[modules]项中的所有.dll文件注释取消,CheckWMI.dll和RemoteConfiguration.dll除外。





[Settings]项中去掉allowed_hosts前注释,填入Nagios服务器地址,或设为空,让主机自动连接Nagios服务器。





[NSClient]项中去掉port前注释,启用该端口,默认为端口号为:12489。





打开命令行窗口,输入nsclient++ /start启动NSClient服务就可以了。检查12489端口是否监听,端口在监听下,以上windows客户端就配置就ok了!





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监控就配置完成了!







内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: