监控nis服务的python监控:
vi a1.py
#!/usr/bin/python
import os
ret = os.popen('netstat -ntpl | grep ypbind').readlines()
if len(ret) == 0:
print "ypbind service is down"
os.system('service ypbind restart')
:wq
监控nis服务的python监控:
#!/usr/bin/python
import os
ret = os.popen('netstat -ntpl | grep ypbind').readlines()
if len(ret) == 0:
print "ypbind service is down"
os.system('service ypbind restart')
:wq