Skip to content
Snippets Groups Projects
Commit 3df9e2c8 authored by Nico Vermaas's avatar Nico Vermaas
Browse files
add service monitor to monitoring page
parent 7e5f9761
No related branches found
No related tags found
2 merge requests!181https://support.astron.nl/jira/browse/SDC-499,!179https://support.astron.nl/jira/browse/SDC-499
atdb/docs/ATDB-LDV Data Model.png

87.4 KiB | W: | H:

atdb/docs/ATDB-LDV Data Model.png

89.3 KiB | W: | H:

atdb/docs/ATDB-LDV Data Model.png
atdb/docs/ATDB-LDV Data Model.png
atdb/docs/ATDB-LDV Data Model.png
atdb/docs/ATDB-LDV Data Model.png
  • 2-up
  • Swipe
  • Onion skin
from django.contrib import admin from django.contrib import admin
from .models import Status, Task, Workflow, LogEntry, Configuration, Job, PostProcessingRule from .models import Status, Task, Workflow, LogEntry, Configuration, Job, PostProcessingRule, Monitor
admin.site.register(Status) admin.site.register(Status)
admin.site.register(Task) admin.site.register(Task)
...@@ -8,3 +8,4 @@ admin.site.register(LogEntry) ...@@ -8,3 +8,4 @@ admin.site.register(LogEntry)
admin.site.register(Configuration) admin.site.register(Configuration)
admin.site.register(Job) admin.site.register(Job)
admin.site.register(PostProcessingRule) admin.site.register(PostProcessingRule)
admin.site.register(Monitor)
\ No newline at end of file
...@@ -126,13 +126,22 @@ class PostProcessingRule(models.Model): ...@@ -126,13 +126,22 @@ class PostProcessingRule(models.Model):
workflow_to_process = models.ForeignKey(Workflow, related_name='to_process', on_delete=models.SET_NULL, null=True, blank=True) workflow_to_process = models.ForeignKey(Workflow, related_name='to_process', on_delete=models.SET_NULL, null=True, blank=True)
workflow_to_apply = models.ForeignKey(Workflow, related_name='to_apply',on_delete=models.SET_NULL, null=True, blank=True) workflow_to_apply = models.ForeignKey(Workflow, related_name='to_apply',on_delete=models.SET_NULL, null=True, blank=True)
# the representation of the value in the REST API
def __str__(self):
return str(self.aggregation_key)+' - '+str(self.trigger_status)
class Monitor(models.Model): class Monitor(models.Model):
name = models.CharField(max_length=50, default="unknown") name = models.CharField(max_length=50, default="unknown")
type = models.CharField(max_length=20, default="ldv-service", null=True, blank=True) type = models.CharField(max_length=20, default="ldv-service", null=True, blank=True)
timestamp = models.DateTimeField(default=datetime.utcnow, blank=True) timestamp = models.DateTimeField(default=datetime.utcnow, blank=True)
hostname = models.CharField(max_length=50, default="unknown") hostname = models.CharField(max_length=50, default="unknown")
process_id = models.IntegerField(null=True) process_id = models.IntegerField(null=True, blank=True)
description = models.CharField(max_length=255, blank=True, null=True) description = models.CharField(max_length=255, blank=True, null=True)
status = models.CharField(max_length=50, default="defining", null=True) status = models.CharField(max_length=50, default="ok", null=True)
metadata = models.JSONField(null=True, blank=True) metadata = models.JSONField(null=True, blank=True)
# the representation of the value in the REST API
def __str__(self):
return str(self.name)+' - '+str(self.timestamp) + ' - ' + self.status
...@@ -201,6 +201,30 @@ def convert_config_to_html(querylist): ...@@ -201,6 +201,30 @@ def convert_config_to_html(querylist):
return results return results
def convert_monitor_to_html(monitor_data):
results = ""
try:
for record in monitor_data:
# iterate through the dict of key/values
key = record.name
value = record.status
filter = record.description
line = '<tr class="' + record.status + '" >'
line += "<td><b>" + str(record.name) + "</b></td>"
line += "<td>" + str(record.hostname) + "</td>"
line += "<td>" + str(record.status) + "</td>"
line += "<td>" + str(record.timestamp) + "</td>"
line += "<td>" + str(record.process_id) + "</td>"
line += "<td>" + str(record.description) + "</td>"
line += "</tr>"
results = results + line
except:
results = "<tr><td>no data</td></tr>"
return results
# aggregate information from the tasks table per workflow per status # aggregate information from the tasks table per workflow per status
def aggregate_resources_tasks(selection): def aggregate_resources_tasks(selection):
workflow_results = [] workflow_results = []
......
...@@ -33,9 +33,6 @@ TD { ...@@ -33,9 +33,6 @@ TD {
background-color: lightgreen; background-color: lightgreen;
} }
.modal-content {
overflow: scroll !important;
}
.error,.failed,.staging_failed,.processed_failed,.scrubbed_failed,.stored_failed,.archived_failed { .error,.failed,.staging_failed,.processed_failed,.scrubbed_failed,.stored_failed,.archived_failed {
color: red; color: red;
...@@ -52,8 +49,6 @@ TD { ...@@ -52,8 +49,6 @@ TD {
font-style: italic; font-style: italic;
} }
.processing,.processing_copying { .processing,.processing_copying {
font-weight: bold; font-weight: bold;
background-color: lightyellow; background-color: lightyellow;
...@@ -120,3 +115,7 @@ p.title { ...@@ -120,3 +115,7 @@ p.title {
.modal-dialog .modal-lg { .modal-dialog .modal-lg {
max-width: 75% !important; max-width: 75% !important;
} }
.modal-content {
overflow: scroll !important;
}
\ No newline at end of file
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
{% include 'taskdatabase/pagination.html' %} {% include 'taskdatabase/pagination.html' %}
</div> </div>
</div> </div>
<p class="footer"> Version 1.0.0 (27 jan 2021 - 15:00) <p class="footer"> Version 1.0.0 (28 jan 2021 - 14:00)
</div> </div>
......
...@@ -5,20 +5,30 @@ ...@@ -5,20 +5,30 @@
<div class="hiking-container container-fluid"> <div class="hiking-container container-fluid">
<div class="col-sm-6 col-md-8 col-lg-12"> <div class="col-sm-6 col-md-8 col-lg-12">
<div class="thumbnail">
&nbsp; &nbsp;
<h5>These monitoring services live at SURF-SARA and will open a new browser window.</h5> <div class="thumbnail">
<h5>Health and Status of the LDV services.</h5>
<table class="table table-striped">
<th>LDV-Service</th><th>Host</th><th>Status</th><th>Timestamp</th><th>Working on</th><th>Description</th>
<tbody>
{{ monitor_results | safe }}
</tbody>
</table>
</div>
<hr>
<div class="thumbnail">
<h5>External monitoring services live at SURF-SARA.</h5>
<a href="https://jobsview.grid.surfsara.nl/grafana/d/i289WluZz/spider?orgId=1&from=now-6h&to=now-5m" <a href="https://jobsview.grid.surfsara.nl/grafana/d/i289WluZz/spider?orgId=1&from=now-6h&to=now-5m"
class="btn btn-info btn-lg" role="button" target="_blank"><img src="{% static 'taskdatabase/grafana_logo.jpg' %}" height="40" alt=""> Spider (Grafana)</a>&nbsp; class="btn btn-info btn-lg" role="button" target="_blank"><img src="{% static 'taskdatabase/grafana_logo.jpg' %}" height="40" alt=""> Spider (Grafana)</a>&nbsp;
<a href="https://ganglia.grid.surfsara.nl/dcache.php?vo=Lofar&r=day" <a href="https://ganglia.grid.surfsara.nl/dcache.php?vo=Lofar&r=day"
class="btn btn-info btn-lg" role="button" target="_blank"><img src="{% static 'taskdatabase/surfsara.jpg' %}" height="40" alt=""> dCache (Ganglia)</a>&nbsp; class="btn btn-info btn-lg" role="button" target="_blank"><img src="{% static 'taskdatabase/surfsara.jpg' %}" height="40" alt=""> dCache (Ganglia)</a>&nbsp;
</div> </div>
&nbsp; &nbsp;
</div> </div>
</div> </div>
{% include 'taskdatabase/localstorage_scripts.html' %}
{% endblock %} {% endblock %}
...@@ -26,7 +26,8 @@ urlpatterns = [ ...@@ -26,7 +26,8 @@ urlpatterns = [
path('query/', views.QueryView.as_view(), name='query'), path('query/', views.QueryView.as_view(), name='query'),
# path('dashboard/', views.DashboardView.as_view(), name='dashboard'), # path('dashboard/', views.DashboardView.as_view(), name='dashboard'),
path('monitoring/', views.MonitoringView.as_view(), name='monitoring'), # path('monitoring/', views.MonitoringView.as_view(), name='monitoring'),
path('monitoring/', views.ShowMonitoring, name='monitoring'),
path('diagram/', views.DiagramView.as_view(), name='diagram'), path('diagram/', views.DiagramView.as_view(), name='diagram'),
path('config/', views.ShowConfig, name='config'), path('config/', views.ShowConfig, name='config'),
......
...@@ -328,9 +328,14 @@ def WorkflowDetails(request, id): ...@@ -328,9 +328,14 @@ def WorkflowDetails(request, id):
class MonitoringView(ListView): class MonitoringView(ListView):
model = Task model = Monitor
template_name = "taskdatabase/monitoring.html" template_name = "taskdatabase/monitoring.html"
def ShowMonitoring(request):
monitor_data = Monitor.objects.all()
monitor_results = algorithms.convert_monitor_to_html(monitor_data)
return render(request, "taskdatabase/monitoring.html", {'monitor_results': monitor_results})
class DiagramView(ListView): class DiagramView(ListView):
model = Task model = Task
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment