File: //proc/self/root/lib/python2.7/site-packages/lap/pid_running.py
#!/usr/bin/python
import os
import psutil
def __run__(params):
try:
run_file = params.get("run_file")
PID = open(os.path.expanduser(run_file),'r')
pidfile = PID.readline().split()[0]
if os.path.exists("/proc/%s" % pidfile):
return [0, "OK - Process of %s with pid %s is running" % (run_file, pidfile)]
else:
return [2, "CRITICAL - Process of %s with pid %s is not running" % (run_file, pidfile)]
except Exception as e:
return [2, "CRITICAL - %s" % e]