nagios监控windows的问题
写了一个vbs脚本,想监控windows中raid状态,把脚本放在C:\Program Files\NSClient++\scripts\lib,想问下nsclient++的配置文件是怎么写?网上查了一下,check_raid=cscript.exe //NoLogo //T:40 scripts\lib\check_raid.vbs
但是通过监控端check_nrpe -H 172.20.22.226 -c check_raid
报错No handler for command: check_raid
请问是怎么回事啊?求各位大大帮忙解决,万分感谢。
nsclient++版本0.4.1 不同版本的nsclient++的配置稍微有些不同,以我的0.4.1为例:
1、确保配置文件 nsclient.ini 里面的 allowed hosts 参数允许Nagios服务器的IP地址
2、在 nsclient.ini 的结尾增加以下内容; A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments>
check_raid = cscript.exe //T:30 //NoLogo scripts\\lib\\check_raid.vbs
; A list of wrappped scripts (ie. using the template mechanism)
; A list of templates for wrapped scripts
; BATCH FILE WRAPPING -
bat = scripts\\%SCRIPT% %ARGS%
; POWERSHELL WRAPPING -
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
; VISUAL BASIC WRAPPING -
vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%
3、重启nsclient++的服务 回复 2# Shell_HAT
非常感谢啊,终于有人回复了,不过现在是报CHECK_NRPE: Socket timeout after 10 seconds。不知道是不是我的脚本有问题?
还想问下,如果直接用bat脚本的话,会报“输入错误: 没有文件扩展“.bat”的脚本引擎。”
怎么样解决?
Socket timeout after 10 seconds
这个跟脚本没关系,应该是网络的问题。
nsclient++的默认端口号是5666,你试试telnet通不
再ping一下看看是否丢包 ; A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments>
check_vbs_test = cscript.exe //T:30 //NoLogo scripts\\test_ok.vbs
check_bat_test = cmd /c scripts\\check_ok.bat
; A list of wrappped scripts (ie. using the template mechanism)
; A list of templates for wrapped scripts
; BATCH FILE WRAPPING -
bat = scripts\\%SCRIPT% %ARGS%
; POWERSHELL WRAPPING -
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
; VISUAL BASIC WRAPPING -
vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%
这样设置nsclient.ini,可以执行BAT脚本。 本帖最后由 hblicy 于 2014-07-23 11:52 编辑
回复 5# Shell_HAT
OK了,谢谢。
我用下面命令运行,发现了可能是VBS的问题。
#/usr/local/nagios/libexec/check_nrpe -H 10.244.144.226 -c check_raid -t 30
No output available from command (cscript.exe //NoLogo //T:30 scripts\\lib\\check_raid.vbs).
用bat发现没问题了,应该就是添加上面那些ini的内容了。
另外还想问下,ipmitool您有用过吗?我在windows 2003上面运行ipmitool sdr总是不成功?在liinux下好像要加载openipmi的驱动,才可以运行。 windows没有找到。E:\ipmitool\ipmitool>ipmitool.exe sdr
No hostname specified!
ipmi_lan_send_cmd failed to open intf
Get Device ID command failed
Unable to open SDR for reading
E:\ipmitool\ipmitool>ipmitool.exe -I open sdr
Error loading interface open
E:\ipmitool\ipmitool>
回复 6# hblicy
是的,要用Nagios监控,你的脚本里面需要输出返回给Nagios的内容,以及设置相应的退出码,否则Nagios无法判断服务的状态。 回复 7# Shell_HAT
嗯,是的,我原来是写了个bat,我想用vbs放在后台运行,发现用vbs居然无输出了,用回bat还是可以的。
你有在windows下用过ipmitool吗?
回复 8# hblicy
没用过ipmitool:mrgreen: 回复 9# Shell_HAT
哦,还是谢谢你了。
页:
[1]