1 #!{{ python_executable }}
8 db_path = '{{ monitor_db_path }}'
10 status_history_length = '{{ status_history_length }}'
12 db = sqlite3.connect(db_path)
15 <link rel="stylesheet" href="static/pure-min.css">
16 <link rel="stylesheet" href="static/style.css">
18 <h1>Monitor Status History :</h1>"""
21 def get_date_from_timestamp(timestamp):
22 return datetime.datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')
24 def print_individual_status(timestamp):
25 print "<div><h3>Failure on %s</h3><ul>" % get_date_from_timestamp(timestamp)
26 rows = db.execute("select status, element, output from individual_status where timestamp=?", (timestamp,))
28 status, element, output = row
29 print "<li>%s , %s :</br><pre>%s</pre></li>" % (status, cgi.escape(element), cgi.escape(output))
34 if not os.path.exists(db_path):
35 print """No status history found</p></body></html>"""
38 failure_row_list = db.execute("select timestamp from status where status='FAILURE' order by timestamp desc limit ?", status_history_length )
40 for failure_row in failure_row_list:
41 timestamp, = failure_row
42 print_individual_status(timestamp)
44 print "</body></html>"