Skip to content
Snippets Groups Projects

status is 'unknown' when late

Merged Nico Vermaas requested to merge master into release
2 files
+ 7
6
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -250,6 +250,9 @@ def convert_monitor_to_html(request, monitor_data):
try:
for record in monitor_data:
# iterate through the dict of key/values
d1 = datetime.utcnow().replace(tzinfo=None)
d2 = record.timestamp.replace(tzinfo=None)
delta = d1 - d2
# http://localhost:8000/atdb/monitor/?name=stager&hostname=localhost
link_to_service_history = construct_link_to_monitor_history(request, record.name, record.name, record.hostname)
@@ -261,16 +264,14 @@ def convert_monitor_to_html(request, monitor_data):
#line += "<td><b>" + str(record.name) + "</b></td>"
line += "<td><b>" + link_to_service_history + "</b></td>"
line += "<td>" + str(record.hostname) + "</td>"
line += '<td class="' + record.status + '" >' + str(record.status) + "</td>"
d1 = datetime.utcnow().replace(tzinfo=None)
d2 = record.timestamp.replace(tzinfo=None)
delta = d1 - d2
# if the heartbeat is 30 minutes late, show '(late)' in red
if delta.seconds > 1800:
line += "<td><i>unknown</i></td>"
line += '<td class="error">' + str(record.timestamp.strftime(TIME_FORMAT)) + " - (late)</td>"
else:
line += '<td>' + str(record.timestamp) + "</td>"
line += '<td class="' + record.status + '" >' + str(record.status) + "</td>"
line += '<td>' + str(record.timestamp.strftime(TIME_FORMAT)) + "</td>"
line += "<td>" + str(record.process_id) + "</td>"
line += "<td>" + str(record.description) + "</td>"
line += "</tr>"
Loading