1、安装NSClient++
安装输入Nagios服务IP地址
密码可为空
勾选Enable common check plugins
Enable nsclient server (check_nt)
Enable NRPE server (check_nrpe)
默认配置实现监控硬盘空间、CPU负载、内存等信息:
被监控端(Windows服务器)配置自带防火墙例外或者关闭自带防火墙,开放TCP 5666和TCP 12489端口。
Nagios服务器端:
2、配置/usr/local/nagios/etc/nagios.cfg,将如下一行前面的注释取消:
cfg_file=/usr/local/nagios/etc/objects/windows.cfg 添加如下
define service{
use generic-service
host_name winserver
service_description check_key
check_command check_nrpe!check_key ####check_key这个参数是在windows客户端定义
}
cfg_file=/usr/local/nagios/etc/objects/commands.cfg 添加如下
# 'check_nt' command definition
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}
# 'check_nrpe' command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
3、NSClient++参数设置
[modules] ##开启模块,
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
NSClientListener.dll
NRPEListener.dll
SysTray.dll
CheckEventLog.dll
CheckHelpers.dll
CheckWMI.dll
script_dir="C:\Program Files\NSClient++\scripts\"
[Settings]
use_file=1
allowed_hosts=192.168.20.137
[NSClient]
port=12489
allowed_hosts=192.168.20.137
[NRPE]
port=5666
allowed_hosts=192.168.20.137
[Script Wrappings]
vbs=cscript.exe T:30 NoLogo scripts\lib\wrapper.vbs %SCRIPT% %ARGS%
ps1=cmd /c echo scripts\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
bat=scripts\%SCRIPT% %ARGS%
[External Scripts]
check_es_long=scripts\long.bat
check_es_ok=scripts\ok.bat
check_es_nok=scripts\nok.bat
check_vbs_sample=cscript.exe //T:30 //NoLogo scripts\check_vb.vbs
check_powershell_warn=cmd /c echo scripts\powershell.ps1 | powershell.exe -command -
[NRPE Handlers]
check_key=scripts\check_key.bat $ARG1$
nrpe_ok=scripts\ok.bat
4、把目录filechack的所有文件放到c:\windows\system32\
filechac是查找文件的程序