3 from monitor import database
6 from monitor.model import *
9 four_days_ago = today - 60*60*24*4
10 eight_days_ago = today - 60*60*24*8
12 def reset_time(hostname, new_time):
13 # update act_all entry
14 act_all = database.dbLoad("act_all")
15 act_all[hostname][0]['time'] = new_time
16 database.dbDump("act_all", act_all)
17 # update message timer.
18 m = PersistMessage(hostname, "d", "e", True, db='monitor_persistmessages')
19 m.actiontracker.time = new_time
22 def get_record(hostname):
23 act_all = database.dbLoad("act_all")
24 rec = act_all[hostname][0]
28 def bring_node_down(hostname):
29 fb = database.dbLoad("findbad")
30 fb['nodes'][hostname]['values'].update({'category' : 'ERROR',
32 'state' : 'DOWN', 'ssh' : 'NOSSH'})
33 database.dbDump("findbad", fb)
34 # update message timer.
35 m = PersistMessage(hostname, "d", "e", True, db='monitor_persistmessages')
36 m.actiontracker.time = time.time() - 60*60*24*4
39 def bring_node_up(hostname):
40 fb = database.dbLoad("findbad")
41 fb['nodes'][hostname]['values'].update({'category' : 'ALPHA',
42 'kernel' : 'a b 2.6.22.19-vs2.3.0.34.24.planetlab',
43 'state' : 'BOOT', 'ssh' : 'SSH'})
44 database.dbDump("findbad", fb)
45 # update message timer.
46 m = PersistMessage(hostname, "d", "e", True, db='monitor_persistmessages')
47 m.actiontracker.time = time.time() - 60*60*24*4
50 #bring_node_down('fakenode.cs.princeton.edu')
52 node_end_record('fakenode.cs.princeton.edu')
53 node_end_record('eggplant.cs.princeton.edu')
54 bring_node_down('eggplant.cs.princeton.edu')
55 bring_node_down('fakenode.cs.princeton.edu')
56 os.system("./nodebad.py --increment --site monitorsite")
57 os.system("./sitebad.py --increment --site monitorsite")
61 os.system("./grouprins.py --force --reboot --mail=1 \
62 --nodeselect 'hostname=(eggplant|fakenode).cs.princeton.edu&&state=DOWN' \
63 --stopselect 'state=BOOT&&kernel=2.6.22.19-vs2.3.0.34.24.planetlab'")
64 reset_time('eggplant.cs.princeton.edu', four_days_ago)
65 reset_time('fakenode.cs.princeton.edu', four_days_ago)
67 os.system("./grouprins.py --force --reboot --mail=1 \
68 --nodeselect 'hostname=(eggplant|fakenode).cs.princeton.edu&&state=DOWN' \
69 --stopselect 'state=BOOT&&kernel=2.6.22.19-vs2.3.0.34.24.planetlab'")
70 reset_time('eggplant.cs.princeton.edu', eight_days_ago)
71 reset_time('fakenode.cs.princeton.edu', eight_days_ago)
74 os.system("./grouprins.py --force --reboot --mail=1 \
75 --nodeselect 'hostname=(eggplant|fakenode).cs.princeton.edu&&state=DOWN' \
76 --stopselect 'state=BOOT&&kernel=2.6.22.19-vs2.3.0.34.24.planetlab'")
77 reset_time('eggplant.cs.princeton.edu', four_days_ago)
78 reset_time('fakenode.cs.princeton.edu', four_days_ago)
80 os.system("./grouprins.py --force --reboot --mail=1 \
81 --nodeselect 'hostname=(eggplant|fakenode).cs.princeton.edu&&state=DOWN' \
82 --stopselect 'state=BOOT&&kernel=2.6.22.19-vs2.3.0.34.24.planetlab'")
83 reset_time('eggplant.cs.princeton.edu', eight_days_ago)
84 reset_time('fakenode.cs.princeton.edu', eight_days_ago)
87 os.system("./grouprins.py --force --reboot --mail=1 \
88 --nodeselect 'hostname=(eggplant|fakenode).cs.princeton.edu&&state=DOWN' \
89 --stopselect 'state=BOOT&&kernel=2.6.22.19-vs2.3.0.34.24.planetlab'")
92 bring_node_up("eggplant.cs.princeton.edu")
93 bring_node_up("fakenode.cs.princeton.edu")
94 os.system("./nodebad.py --increment --site monitorsite")
95 os.system("./sitebad.py --increment --site monitorsite")
97 os.system("./grouprins.py --force --reboot --mail=1 --nodeselect 'hostname=eggplant.cs.princeton.edu&&state=BOOT' --stopselect 'state=BOOT&&kernel=2.6.22.19-vs2.3.0.34.24.planetlab'")