免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6656 | 回复: 4
打印 上一主题 下一主题

[其他] nagios监控windows的问题 [复制链接]

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
1 [报告]
发表于 2014-07-17 14:31 |显示全部楼层
不同版本的nsclient++的配置稍微有些不同,以我的0.4.1为例:

1、确保配置文件 nsclient.ini 里面的 allowed hosts 参数允许Nagios服务器的IP地址

2、在 nsclient.ini 的结尾增加以下内容
  1. ; A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments>
  2. [/settings/external scripts/scripts]
  3. check_raid = cscript.exe //T:30 //NoLogo scripts\\lib\\check_raid.vbs

  4. ; A list of wrappped scripts (ie. using the template mechanism)
  5. [/settings/external scripts/wrapped scripts]

  6. ; A list of templates for wrapped scripts
  7. [/settings/external scripts/wrappings]

  8. ; BATCH FILE WRAPPING -
  9. bat = scripts\\%SCRIPT% %ARGS%

  10. ; POWERSHELL WRAPPING -
  11. ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -

  12. ; VISUAL BASIC WRAPPING -
  13. vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%
复制代码
3、重启nsclient++的服务

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
2 [报告]
发表于 2014-07-18 15:45 |显示全部楼层
Socket timeout after 10 seconds
这个跟脚本没关系,应该是网络的问题。
nsclient++的默认端口号是5666,你试试telnet通不
再ping一下看看是否丢包

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
3 [报告]
发表于 2014-07-18 15:52 |显示全部楼层
; A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments>
[/settings/external scripts/scripts]
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)
[/settings/external scripts/wrapped scripts]


; A list of templates for wrapped scripts
[/settings/external scripts/wrappings]

; 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脚本。

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
4 [报告]
发表于 2014-07-18 16:58 |显示全部楼层
回复 6# hblicy


是的,要用Nagios监控,你的脚本里面需要输出返回给Nagios的内容,以及设置相应的退出码,否则Nagios无法判断服务的状态。

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
5 [报告]
发表于 2014-07-21 10:31 |显示全部楼层
回复 8# hblicy


    没用过ipmitool
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP