我有一个python脚本,它检查进程导入子进程
s = subprocess.check_output('tasklist', shell=True)
if "cmd.exe" in s:
if "java.exe" not in str(s):
print "selenium server is not up"
if "FreeSSHDService.exe" not in str(s):
print "SSH is not up"
else:
print "Everything is awesome"
我想在check_mk仪表板上添加一个检查,添加此检查的步骤是什么以及我必须在哪里完成此脚本。
import subprocess
s = subprocess.check_output('tasklist', shell=True)
if "cmd.exe" in s:
if "java.exe" not in str(s):
return 2, "selenium server is not up")
if "FreeSSHDService.exe" not in str(s):
return 2, "SSH is not up"
else:
return 0, "Everything is awesome"
首先,我假设您要检查的节点是基于MS Windows的,在这种情况下,我无法帮助您,因为我的专业知识是关于UNIX和Linux的。
这个qazxsw poi将帮助您检查基于Windows的节点,尤其是段落qazxsw poi。
在Linux中,一旦安装了check_mk_agent,根据你想进入check_mk胆量的深度,有三种方法。在Windows中我认为有相同的方法。
10. Extending the Windows agent
配置文件的local
部分以运行[global]
和check_mk.ini
文件扩展名。py
使你的python程序打印输出,并根据pyc
编辑Nagios output check format配置文件的[mrpe]
部分。作为缺点,WARNING和CRITICAL值/范围在check_ini
文件中是固定的 - 它们不能在WATO中更改。最好的祝福。
如果要执行此类脚本,只需将其(具有正确的权限,chmod +755)放在〜/ local / lib / nagios / plugins目录中即可。
然后你必须从“主机和服务参数 - >主动检查 - >经典主动和被动检查”创建规则
完成后,您需要输入命令行“python~ / local / lib / nagios / plugins / nameofyourscript.py”
我不确定输出,仍然在为python脚本工作。