ITPub博客

首页 > Linux操作系统 > Linux操作系统 > nagios 监控windows环境简要说明

nagios 监控windows环境简要说明

原创 Linux操作系统 作者:btldxx 时间:2014-08-08 15:57:42 0 删除 编辑
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博客 ” ,链接:https://blog.itpub.net/14594028/viewspace-1247936/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-01-21

  • 博文量
    4
  • 访问量
    102869