File: //lib/python2.7/site-packages/lap/sharedweb_reload_apache.py
import os, stat, time
from datetime import datetime, time
def __run__(params):
try:
if os.path.exists('/usr/local/locaweb/tmp/restartlw.txt'):
statreload = os.stat('/usr/local/locaweb/tmp/restartlw.txt')
mtime = datetime.fromtimestamp(statreload.st_mtime)
now = datetime.now()
diff = now - mtime
warn = 1800
crit = 3600
if diff.seconds > crit:
return [2, "CRITICAL - Apache Reload with more 1 hour without execution"]
elif diff.seconds > warn:
return [1, "WARN - Apache Reload with more than 30 minutes withou execution"]
else:
return [0, "OK"]
else:
return [0, "OK"]
except Exception, e:
return [2, "CRITICAL - Error: %s" % repr(e)]