发布时间:2019-07-22 10:14:30编辑:auto阅读(1804)
[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做监控
上一篇: python的Scrapy...
下一篇: Python标准库 - subproce
47485
45787
36785
34318
28956
25590
24437
19607
19103
17628
5459°
6042°
5565°
5633°
6567°
5371°
5371°
5879°
5852°
7164°