import time
import logging
import Queue
+# Global config options
+import config
# daemonize and *pid
from util.process import *
# Email
import mailer
import emailTxt
-# Defaults
-debug = False
# Log to what
LOG="./monitor.log"
# Email defaults
MTA="localhost"
FROM="support@planet-lab.org"
+TECHEMAIL="tech-%s@sites.planet-lab.org"
+PIEMAIL="pi-%s@sites.planet-lab.org"
# API
XMLRPC_SERVER = 'https://www.planet-lab.org/PLCAPI/'
for thread in runningthreads.keys():
# If thread found dead, remove from queue
if not runningthreads[thread].isAlive():
- logger.error("Thread Died: %s" %(thread))
+ logger.error("***********Thread died: %s**********" %(thread))
del runningthreads[thread]
"""
def main():
# Defaults
- global debug, status, logger
+ global status, logger
try:
longopts = ["debug", "status", "help"]
for (opt, optval) in opts:
if opt == "-d" or opt == "--debug":
- debug = True
+ config.debug = True
+ print "Running in DEBUG mode: NO EMAILS SENT AND NO SLICES SQUEEZED."
elif opt == "--status":
#print summary(names)
sys.exit(0)
# Wait for threads to init. Probably should join, but work on that later.
time.sleep(10)
+
# Start Sending Emails
startThread(pol, "policy")
time.sleep(15)
+
+ # Store state of emails
pol.emailedStore("WRITE")
+
+ # Email what we did.
+ pol.status()
+
logger.info('Monitor Exitted')
#if not debug:
# removepid("monitor")