1
2
3
4
5
6
7
8
9
10
11
12
|
[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做监控
本文转自 小小三郎1 51CTO博客,原文链接:http://blog.51cto.com/wsxxsl/1951513,如需转载请自行联系原作者