Skip to content
Snippets Groups Projects
Commit 24b5ea88 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

bonus:

added a '(late)' timestamp in the monitor when a timestamp arrives > 60 seconds late.
parent ef0d1542
No related branches found
No related tags found
2 merge requests!205added 'late' check on service monitor,!202bonus:
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
Description: Business logic for ATDB. These functions are called from the views (views.py). Description: Business logic for ATDB. These functions are called from the views (views.py).
""" """
from datetime import datetime, timedelta
from django.db.models import Q, Sum from django.db.models import Q, Sum
import logging import logging
from .common import timeit from .common import timeit
...@@ -261,7 +262,14 @@ def convert_monitor_to_html(request, monitor_data): ...@@ -261,7 +262,14 @@ def convert_monitor_to_html(request, monitor_data):
line += "<td><b>" + link_to_service_history + "</b></td>" line += "<td><b>" + link_to_service_history + "</b></td>"
line += "<td>" + str(record.hostname) + "</td>" line += "<td>" + str(record.hostname) + "</td>"
line += '<td class="' + record.status + '" >' + str(record.status) + "</td>" line += '<td class="' + record.status + '" >' + str(record.status) + "</td>"
line += "<td>" + str(record.timestamp) + "</td>"
d1 = datetime.utcnow().replace(tzinfo=None)
d2 = record.timestamp.replace(tzinfo=None)
delta = d1 - d2
if delta.seconds > 60:
line += '<td class="error">' + str(record.timestamp.strftime(TIME_FORMAT)) + " - (late)</td>"
else:
line += '<td>' + str(record.timestamp) + "</td>"
line += "<td>" + str(record.process_id) + "</td>" line += "<td>" + str(record.process_id) + "</td>"
line += "<td>" + str(record.description) + "</td>" line += "<td>" + str(record.description) + "</td>"
line += "</tr>" line += "</tr>"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment