828095cf645abc7761b3fb29d9be62ebe1b88b88
[monitor.git] / monitor / database / zabbixapi / emailZabbix.py
1 class mailtxt:
2         @classmethod
3         def reformat(cls, arguments={'hostname' : "your.host.name", 
4                                                                  'support_email' : 'support@your.host.name'}):
5                 fields = dir(cls)
6                 for f in fields:
7                         #print "looking at %s" % f
8                         if "__" not in f and 'reformat' not in f:
9                                 attr = getattr(cls,f)
10                                 #print attr
11                                 setattr(cls, f, attr % arguments)
12                                 #print getattr(cls,f)
13                 return
14
15         nodedown_one_subject="Server {HOSTNAME} is unreachable: First Notice"
16         nodedown_one = """
17 Hello,
18
19 We hope that you're having a good day.  As part of PlanetLab node monitoring, we noticed the following node is down at your site:
20
21     {HOSTNAME} : Since {EVENT.AGE}
22
23 We're writing because we need your help returning them to their regular operation.
24
25 To help, please confirm that a verison 3.0 or greater BootCD is installed in the machine.  Then, after checking that the node is properly networked, power cycle the machine.  Note that rebooting the machine may not fully resolve the problems we are seeing.  Once the machine has come back up, please visit the monitor status page to verify that your node is accessible.  
26
27 If the machine has booted successfully, you may check directly by logging in with your site_admin account, and running:
28
29     sudo /usr/sbin/vps ax
30
31 If you have a BootCD older than 3.0, you will need to create a new BootImage on CD or USB.  You can find instructions for this at the Technical Contact's Guide:
32
33     https://www.planet-lab.org/doc/guides/bootcdsetup
34
35 There is no need to respond to this message unless there are any console messages relating to the node's failure.  In this case, please report them to PlanetLab support (%(support_email)s) so we can help resolve the issue.   Including this message in your reply will help us coordinate our records with the actions you've taken.
36
37 Finally, you can track the current status of your machines using this Google Gadget:
38
39     http://fusion.google.com/add?source=atgs&moduleurl=http://%(hostname)s/monitor/sitemonitor.xml
40
41 Thank you for your help,
42   -- PlanetLab Central (%(support_email)s)
43 """
44
45         nodedown_two_subject="Server {HOSTNAME} is unreachable: Second Notice"
46         nodedown_two = """
47 Hello, 
48
49 We hope that you're having a good day.  As part of PlanetLab node monitoring, we noticed the following node is down at your site:
50
51     {HOSTNAME} : Since {EVENT.AGE}
52
53 We're writing again because our previous correspondence, sent only to the registered Technical Contact, has gone unacknowledged for at least a week, and we need your help returning these machines to their regular operation.  We understand that machine maintenance can take time.  So, while we wait for the machines to return to their regular operation slice creation has been suspended at your site.  No new slices may be created, but the existing slices and services running within them will be unaffected.
54
55 To help, please confirm that a verison 3.0 or greater BootCD is installed in the machine.  Then, after checking that the node is properly networked, power cycle the machine.  Note that rebooting the machine may not fully resolve the problems we are seeing.  Once the machine has come back up, please visit the monitor status page to verify that your node is accessible.  
56
57 If the machine has booted successfully, you may check directly by logging in with your site_admin account, and running:
58
59     sudo /usr/sbin/vps ax                                                                                  
60 If you have a BootCD older than 3.0, you will need to create a new BootImage on CD or USB.  You can find instructions for this at the Technical Contact's Guide:
61
62     https://www.planet-lab.org/doc/guides/bootcdsetup
63
64 If after following these directions, you are still experiencing problems, then you can acknowledge this notice by visiting, and letting us know what the problem is at mailto:%(support_email)s 
65
66     http://%(hostname)s/zabbix/acknow.php?eventid={EVENT.ID}
67     http://%(hostname)s/zabbix/tr_events.php?triggerid={TRIGGER.ID}&eventid={EVENT.ID}
68
69 After another week, we will disable all slices currently running on PlanetLab.  Because this action will directly affect all users of these slices, these users will also be notified at that time.
70
71 Thank you for your help,
72   -- PlanetLab Central (%(support_email)s)
73
74
75 """
76
77         nodedown_three_subject="Server {HOSTNAME} is unreachable: Third Notice"
78         nodedown_three ="""
79 Hello,
80
81 We hope that you're having a good day.  As part of PlanetLab node monitoring, we noticed the following node is down at your site:
82
83     {HOSTNAME} : Since {EVENT.AGE}
84
85 We understand that machine maintenance can take time.  We're writing again because our previous correspondences, sent first to the registered Technical Contact then the the Site PI, have gone unacknowledged for at least two weeks, and we need your help returning these machines to their regular operation.  This is the third time attempting to contact someone in regard to these machines at your site.  So, while we wait for the machines to return to their regular operation all current slice activity will be suspended.  Current experiments will be stopped and will not be be able to start again until there is evidence that you have begun to help with the maintenance of these machines.  
86
87 To help, please confirm that a verison 3.0 or greater BootCD is installed in the machine.  Then, after checking that the node is properly networked, power cycle the machine.  Note that rebooting the machine may not fully resolve the problems we are seeing.  Once the machine has come back up, please visit the monitor status page to verify that your node is accessible.
88
89 If the machine has booted successfully, you may check directly by logging in with your site_admin account, and running:
90
91         sudo /usr/sbin/vps ax
92
93 If you have a BootCD older than 3.0, you will need to create a new BootImage on CD or USB.  You can find instructions for this at the Technical Contact's Guide:
94
95         https://www.planet-lab.org/doc/guides/bootcdsetup
96
97 If after following these directions, you are still experiencing problems, then you can acknowledge this notice by visiting, and letting us know what the problem is at mailto:%(support_email)s
98
99         http://%(hostname)s/zabbix/acknow.php?eventid={EVENT.ID}
100     http://%(hostname)s/zabbix/tr_events.php?triggerid={TRIGGER.ID}&eventid={EVENT.ID}
101
102 Thank you for your help,
103         -- PlanetLab Central (%(support_email)s)
104         """
105         nodedown_four_subject="Server {HOSTNAME} is unreachable: Waiting Forever"
106         nodedown_four=""" 
107 Hello,
108
109 We hope that you're having a good day.  As part of PlanetLab node monitoring, we noticed the following node is down at your site:
110
111     {HOSTNAME} : Since {EVENT.AGE}
112
113 We have not heard a response from you regarding this machine.  We will continue sending message until we receive an acknowledgment and description of the issue prevening the node from remaining online.
114
115 You can acknowledge this notice by visiting the link below or by letting us know what the problem is by replying to this message.
116
117         http://%(hostname)s/zabbix/acknow.php?eventid={EVENT.ID}
118     http://%(hostname)s/zabbix/tr_events.php?triggerid={TRIGGER.ID}&eventid={EVENT.ID}
119
120 Thank you for your help,
121         -- PlanetLab Central (%(support_email)s)
122 """
123         thankyou_nodeup = """
124 While monitoring your site, we noticed that the following nodes *improved* their states:
125
126     {HOSTNAME} : Available
127
128 Often, system administration is a thankless job, but not today. :-)
129
130 Thank you!
131   -- PlanetLab Central (%(support_email)s)
132 """