From 13d5e632f96544767c95603f3a0a0c2c64aa3ee8 Mon Sep 17 00:00:00 2001 From: Faiyaz Ahmed Date: Wed, 10 Jan 2007 20:08:44 +0000 Subject: [PATCH] * Emails users when slice renewal/creation is suspended, and when their slices are suspended. --- emailTxt.py | 19 ++++++++++++++++++- policy.py | 28 ++++++++++++++++++++++------ 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/emailTxt.py b/emailTxt.py index 00c7462..c5dda8e 100644 --- a/emailTxt.py +++ b/emailTxt.py @@ -3,7 +3,7 @@ # # Faiyaz Ahmed # -# $Id: $ +# $Id: emailTxt.py,v 1.4 2006/11/14 19:20:13 faiyaza Exp $ # @@ -77,6 +77,23 @@ We have set the node to reinstall upon reboot. Please reboot the machine. It w Thanks. + -- PlanetLab Central (support@planet-lab.org) +""") + + + removedSliceCreation=("""PlanetLab slice creation/renewal suspension.""","""As part of PlanetLab node monitoring, we noticed the %(loginbase)s site has less than 2 nodes up. We have attempted to contact the PI and Technical contacts multiple times and have not received a response. + +Slice creation and renewal are now suspended for the %(loginbase)s site. Please be aware that failure to respond will result in the automatic suspension of all running slices on PlanetLab. + + + -- PlanetLab Central (support@planet-lab.org) +""") + + suspendSlices=("""PlanetLab slices suspended.""","""As part of PlanetLab node monitoring, we noticed the %(loginbase)s site has less than 2 nodes up. We have attempted to contact the PI and Technical contacts multiple times and have not received a response. + +All %(loginbase)s slices are now suspended. + + -- PlanetLab Central (support@planet-lab.org) """) diff --git a/policy.py b/policy.py index 9bd25d0..1af7ab7 100644 --- a/policy.py +++ b/policy.py @@ -27,8 +27,7 @@ logger = logging.getLogger("monitor") POLSLEEP = 7200 # Where to email the summary -#SUMTO = "pupadm@lists.planet-lab.org" -SUMTO = "faiyaza@cs.princeton.edu" +SUMTO = "pupadm@lists.planet-lab.org" TECHEMAIL="tech-%s@sites.planet-lab.org" PIEMAIL="pi-%s@sites.planet-lab.org" SLICEMAIL="%s@slices.planet-lab.org" @@ -148,20 +147,37 @@ class Policy(Thread): target.append(PIEMAIL % loginbase) #remove slice creation if enough nodes arent up if not self.enoughUp(loginbase): + slices = plc.slices(loginbase) + if len(slices) >= 1: + for slice in slices: + target.append(SLICEMAIL % slice) logger.info("POLICY: Removing slice creation from %s" % loginbase) + tmp = emailTxt.mailtxt.removedSliceCreation + sbj = tmp[0] + msg = tmp[1] % {'loginbase': loginbase} plc.removeSliceCreation(node) + mailer.email(sbj, msg, target) self.squeezed[loginbase] = (time.time(), "creation") + return + # If more than PI thresh and slicethresh if (delta >= PITHRESH) and (delta > SLICETHRESH): + target.append(PIEMAIL % loginbase) # Email slices at site. slices = plc.slices(loginbase) if len(slices) >= 1: for slice in slices: target.append(SLICEMAIL % slice) - if not self.enoughUp(loginbase): - plc.suspendSlices(node) - self.squeezed[loginbase] = (time.time(), - "freeze") + # If not enough up, freeze slices and email everyone. + if not self.enoughUp(loginbase): + logger.info("POLICY: Suspending %s slices." % loginbase) + tmp = emailTxt.mailtxt.suspendSlices + sbj = tmp[0] + msg = tmp[1] % {'loginbase': loginbase} + plc.suspendSlices(node) + self.squeezed[loginbase] = (time.time(), "freeze") + mailer.email(sbj, msg, target) + return # Find the bucket the node is in and send appropriate email # to approriate list of people. -- 2.47.0