Merge branch 'erp5testnode-pyOpenSSL-0.14'
[slapos.git] / stack / monitor / webfiles / status.cgi.in
1 #!{{ python_executable }}
2
3 import cgitb
4 import json
5
6 cgitb.enable(display=0, logdir="/tmp/cgi.log")
7
8 json_file = "{{ json_file }}"
9 result = json.load(open(json_file))
10
11 print "<html><head>"
12 print "<link rel=\"stylesheet\" href=\"pure-min.css\">"
13 print "<link rel=\"stylesheet\" href=\"/style.css\">"
14 print "</head><body>"
15 print "<h1>Monitoring :</h1>"
16 print "<p><em>Last time of monitoring process : %s</em></p>" % (result['datetime'])
17 del result['datetime']
18 print "<br/>"
19
20 print "<h2>These scripts and promises have failed :</h2>"
21 for r in result:
22   if result[r] != '':
23     print "<h3>%s</h3><p style=\"padding-left:30px;\">%s</p>" % (r, result[r])
24 print "<br/>"
25
26 print "<h2>These scripts and promises were successful :</h2>"
27 print "<ul>"
28 for r in result:
29   if result[r] == '':
30     print "<li>%s</li>" % (r)
31 print "</ul>"
32 print "</body></html>"