我想制作简单的python脚本,我可以在cron作业上运行.我只想查看这些服务当前是否正在运行或停止
Httpd
mysql
Run Code Online (Sandbox Code Playgroud)
我应该如何用python检查它们.
我需要解析输出 netstat -tlnp
我正在使用nagios o centos服务器,我只想监视本地主机.
我已经定义了这样的服务
define service{
host_name localhost
service_description Site1Service
check_command check_http-site1
use generic-service
notification_interval 1440
}
Run Code Online (Sandbox Code Playgroud)
和
在commands.cfg中命令如下
define command{
command_name check_http-site1
command_line /usr/lib/nagios/plugins/check_http -H site1.dreaddomain.com
}
Run Code Online (Sandbox Code Playgroud)
我在那里遇到了严重的错误.所以我想从命令行检查该服务是否正在运行