5 DATE=`date +%Y-%m-%d-%T`
7 if [ -f $HOME/monitor/SKIP ] ; then
8 # echo "SKIPPING Monitor"
10 # TODO: should be possible to kill the old version if
11 # desired and prevent lingering instances of automate.
13 echo "KILLING Monitor"
14 PID=`cat $HOME/monitor/SKIP`
15 rm -f $HOME/monitor/SKIP
19 echo "SKIPPING Monitor"
23 echo $$ > $HOME/monitor/SKIP
25 #########################
27 rm -f pdb/production.findbad2.pkl
28 ./findbad.py --increment --cachenodes --debug=0 --dbname="findbad2" $DATE || :
30 ps ax | grep BatchMode | grep -v grep | awk '{print $1}' | xargs kill || :
32 ########################
33 # COPY to golf for diagnose.py and action.py
34 cp pdb/production.findbad2.pkl pdb/production.findbad.pkl
35 #scp pdb/production.findbad2.pkl soltesz@golf.cs.princeton.edu:monitor3/pdb/production.findbad.pkl
37 ########################
38 # COPY Act_all records
39 #scp soltesz@golf.cs.princeton.edu:monitor3/pdb/production.act_all.pkl pdb/
41 ########################
43 ./printbadcsv.py | grep -v loading | tr -d ' ' > badcsv.txt
44 cp badcsv.txt /plc/data/var/www/html/monitor/
45 ./showlatlon.py | head -9 | awk 'BEGIN {print "<table>"} { print "<tr><td>", $0, "</td></tr>"} END{print "</table>"}' | sed -e 's\|\</td><td>\g' > /plc/data/var/www/html/monitor/regions.html
47 #########################
49 rm -f pdb/production.findbadpcus2.pkl
50 ./findbadpcu.py --increment --refresh --debug=0 --dbname=findbadpcus2 $DATE || :
52 ./sitebad.py --increment || :
53 ./nodebad.py --increment || :
54 ./pcubad.py --increment || :
56 # clean up stray 'locfg' processes that hang around inappropriately...
57 ps ax | grep locfg | grep -v grep | awk '{print $1}' | xargs kill || :
59 # convert pkl to php serialize format.
60 cp pdb/production.findbadpcus2.pkl pdb/production.findbadpcus.pkl
62 ./pkl2php.py -i findbadpcus2 -o findbadpcus
63 ./pkl2php.py -i act_all -o act_all
64 ./pkl2php.py -i plcdb_hn2lb -o plcdb_hn2lb
65 ./pkl2php.py -i findbad -o findbadnodes
66 ./pkl2php.py -i ad_dbTickets -o ad_dbTickets
67 ./pkl2php.py -i idTickets -o idTickets
69 #for f in findbad act_all findbadpcus l_plcnodes; do
70 #for f in findbad act_all findbadpcus l_plcnodes site_persistflags ; do
71 for f in findbad act_all findbadpcus l_plcnodes site_persistflags node_persistflags pcu_persistflags ; do
72 cp pdb/production.$f.pkl archive-pdb/`date +%F-%H:%M`.production.$f.pkl
75 ./grouprins.py --mail=1 \
76 --nodeselect 'state=DEBUG&&boot_state=dbg||state=DEBUG&&boot_state=boot' \
77 --stopselect 'state=BOOT&&kernel=2.6.22.19-vs2.3.0.34.9.planetlab' \
79 ./findbad.py --increment --cachenodes --debug=0 --dbname="findbad" --nodeselect 'state=DEBUG&&boot_state=dbg||state=DEBUG&&boot_state=boot' || :
81 # cache the RT db locally.
84 rm -f $HOME/monitor/SKIP