[[email protected] ~]# 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") [[email protected] ~]# python monitor.py running [[email protected] ~]#
反思:返回值可以设置成1 或者0 然后结合zabbix做监控
时间: 2024-12-21 14:09:11