diff --git a/atdb/taskdatabase/services/algorithms.py b/atdb/taskdatabase/services/algorithms.py index 73c71a8d701133ac6fcd146920498df867811bdf..60c8445f96d0c6f8e51eb0310385f45781c9dfc0 100644 --- a/atdb/taskdatabase/services/algorithms.py +++ b/atdb/taskdatabase/services/algorithms.py @@ -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>" diff --git a/atdb/taskdatabase/templates/taskdatabase/index.html b/atdb/taskdatabase/templates/taskdatabase/index.html index 2fa718cc3b3e9118e47107b0897da417387af04d..b46b483c6bda941312526d309520e74cb97d58f9 100644 --- a/atdb/taskdatabase/templates/taskdatabase/index.html +++ b/atdb/taskdatabase/templates/taskdatabase/index.html @@ -34,7 +34,7 @@ {% include 'taskdatabase/pagination.html' %} </div> </div> - <p class="footer"> Version 1.0.0 (4 mar 2021 - 11:00) + <p class="footer"> Version 1.0.0 (4 mar 2021 - 15:00) </div>