outage-mail: small improvements, mostly update for tonight's outage
[invirt/scripts/outage.git] / outage-mail
index 4968135..ed75737 100644 (file)
@@ -1,20 +1,26 @@
+#!/usr/bin/python
 import smtplib
 from invirt.database import *
 from email.mime.text import MIMEText
 
-message = """One of the four XVM servers, aperture-science, spontaneously rebooted
-today at around 2:55 today. As of now, we're not sure what the cause of
-this was.
+sender = 'Greg Price <price@mit.edu>'
+sendername = sender.split()[0]
+host = 'arklay-mansion'
 
-Your VM %s was running on aperture-science. We have restarted it.
+message = """\
+One of the four XVM host servers, %s, failed tonight at
+about 23:17 and was rebooted.  We're working to understand the cause.
+
+Your VM %%s was running on %s.  We have restarted it.
 
 We realize that this is an inconvenience for you, and we apologize for
 the unexpected downtime.
 
-- Evan
-for the XVM team"""
+- %s
+for the XVM team
+""" % (host, host, sendername)
 
-vms = "nforrest0 remus ghost-of-golezan tabbott 6470 dh moo mclamb dt-web htns uav-team x lsmb twopi what esg panache gardiner mailman-acl jack-o-tron knowledge ephialtes ocaml happy-go-lucky maridia cochese ocelot ecprice bibix groovy r privoxy thebes intrepid-paravirt-test qren2 quentin woodrow prolix oculus shinnyih gkovacs".split()
+vms = "amd64-test brain-trust cluster-test david-vista debathena-livecd-build ecprice gradbook greg-ns1 greg-ns2 groovy htns iodine jsoltren latex liftm medkaz mhd mksvn niska polarix price-lenny price-test8 qren2 shawn-of-awesome staxowax tdc tdc-secure thesecrete tor transistor watmap".split()
 
 def send_mail(vm):
     contact = Machine.query.filter_by(name=vm).first().contact
@@ -24,9 +30,9 @@ def send_mail(vm):
     msg['To'] = contact
     msg['CC'] = 'XVM <xvm@mit.edu>'
     msg['Reply-To'] = 'XVM <xvm@mit.edu>'
-    msg['From'] = 'Evan Broder <broder@mit.edu>'
+    msg['From'] = sender
     msg['Subject'] = '[xvm] Unexpected reboot of your VM %s' % vm
-    s.sendmail('Evan Broder <broder@mit.edu>',
+    s.sendmail(sender,
         [contact, 'xvm@mit.edu'],
         msg.as_string())