标签:python监控进程
[root@bogon ~]# cat monitor.py
#!/usr/bin/env python
import os
process = "/tmp/sshd.lock"
os.system("ps -ef|grep sshd|grep -v grep>%s" % process)
if not(os.path.getsize(process)):
print("no running")
else:
print("running")
[root@bogon ~]# python monitor.py
running
[root@bogon ~]#反思:返回值可以设置成1 或者0 然后结合zabbix做监控
本文出自 “砖家博客” 博客,请务必保留此出处http://wsxxsl.blog.51cto.com/9085838/1951513
标签:python监控进程
原文地址:http://wsxxsl.blog.51cto.com/9085838/1951513