@@ -0,0 +1,743 @@
+#!/usr/bin/env python%0Aimport os%0Aimport socket%0Adef CheckPort(service, ip, port):%0A    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)%0A    try:%0A        s.connect((ip, int(port)))%0A        s.shutdown(2)%0A        print '%25s is up' %25 service%0A        return %7Bservice: 'Up'%7D%0A    except:%0A        print '%25s is down' %25 service%0A        return %7Bservice: 'Down'%7D%0A%0Adef CheckProgress(service, name):%0A    progress = os.popen('ps aux %7C grep %22' + name + '%22 %7C grep -v grep').readlines()%0A    if progress:%0A        print '%25s is up' %25 service%0A        return %7Bservice: 'Up'%7D%0A    else:%0A        print '%25s is down' %25 service%0A        return %7Bservice: 'Down'%7D%0Aif __name__ == '__main__':%0A    CheckPort('salt_master', '127.0.01', 4505)%0A    CheckProgress('celery','celery')

添加check_service 功能