nagios 監控windows環境簡要說明

btldxx發表於2014-08-08
linux客戶端需要安裝nrpe,windows中的nrpe名字叫 NSClient++或者nscp
伺服器端監控windows可以通過三種方式
check_snmp
check_nt  安裝完nscp就可以直接呼叫,命令已整合在module目錄的.dll檔案中
eg:check_command           check_nt!CPULOAD!-l 5,80,90
check_nrpe 首先需要在nsclient.ini中配置監控命令別名,然後才能在nagios中呼叫
eg:
windows端
; alias_cpu - Alias for alias_cpu. To configure this item add a section called: /settings/external scripts/alias/alias_cpu
alias_cpu = checkCPU warn=80 crit=90 time=5m time=1m time=30s
Linux 端
[root@majian libexec]# ./check_nrpe -H 192.168.253.129 -c alias_cpu
OK CPU Load ok.|'5m'=14%;80;90 '1m'=2%;80;90 '30s'=1%;80;90

nscp支援的自定義指令碼有三種,vbs,bat,ps
在nsclient.ini.ini中新增配置如下:
[/settings/external scripts/scripts]
vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\vbs.vbs
bat= scripts\\lib\\bat.bat
;ps1=cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -


將vbs.vbs,bat.bat等指令碼放到 script/lib目錄中


[root@majian libexec]# ./check_nrpe -H 192.168.253.129 -c vbs
hello majian
[root@majian libexec]# ./check_nrpe -H 192.168.253.129 -c bat
OK: AAAEverything is going to be OK!HELLO
[root@majian libexec]# 

Section: /settings/external scripts/wrappings
Keys:
Key Title Description
vbs VISUAL BASIC WRAPPING
bat BATCH FILE WRAPPING
ps1 POWERSHELL WRAPPING
Sample:

vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\vbs.vbs
bat= scripts\\lib\\bat.bat
ps1=cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -


參考文件:
http://nsclient.org/nscp/wiki/CheckExternalScripts


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/14594028/viewspace-1247936/,如需轉載,請註明出處,否則將追究法律責任。

相關文章