-
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[monitoring] Updated files and corrected failing qa checks #274
Fixes #274
- Loading branch information
1 parent
a219447
commit 13f3044
Showing
2 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django.urls import path | ||
from . import views | ||
|
||
urlpatterns = [ | ||
path('uptime/', views.display_uptime, name='display_uptime'), | ||
path('packet_loss/', views.display_packet_loss, name='display_packet_loss'), | ||
path('rtt/', views.display_rtt, name='display_rtt'), | ||
path('wifi_clients/', views.display_wifi_clients, name='display_wifi_clients'), | ||
path('traffic/', views.display_traffic, name='display_traffic'), | ||
path('memory/', views.display_memory, name='display_memory'), | ||
path('cpu/', views.display_cpu, name='display_cpu'), | ||
path('disk/', views.display_disk, name='display_disk'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
from django.shortcuts import render | ||
from client import DatabaseClient | ||
from queries import chart_query | ||
|
||
db_client = DatabaseClient() | ||
|
||
def display_uptime(request): | ||
query = chart_query['uptime']['influxdb2'].format( | ||
bucket=db_client.bucket, | ||
content_type='your_content_type', | ||
object_id='your_object_id' | ||
) | ||
result = db_client.query(query) | ||
data = [] | ||
for table in result: | ||
for record in table.records: | ||
data.append(record.values) | ||
return render(request, 'display_data.html', {'data': data}) | ||
|
||
def display_packet_loss(request): | ||
query = chart_query['packet_loss']['influxdb2'].format( | ||
bucket=db_client.bucket, | ||
content_type='your_content_type', | ||
object_id='your_object_id' | ||
) | ||
result = db_client.query(query) | ||
data = [] | ||
for table in result: | ||
for record in table.records: | ||
data.append(record.values) | ||
return render(request, 'display_data.html', {'data': data}) | ||
|
||
def display_rtt(request): | ||
query = chart_query['rtt']['influxdb2'].format( | ||
bucket=db_client.bucket, | ||
content_type='your_content_type', | ||
object_id='your_object_id' | ||
) | ||
result = db_client.query(query) | ||
data = [] | ||
for table in result: | ||
for record in table.records: | ||
data.append(record.values) | ||
return render(request, 'display_data.html', {'data': data}) | ||
|
||
def display_wifi_clients(request): | ||
query = chart_query['wifi_clients']['influxdb2'].format( | ||
bucket=db_client.bucket, | ||
content_type='your_content_type', | ||
object_id='your_object_id', | ||
ifname='your_ifname' | ||
) | ||
result = db_client.query(query) | ||
data = [] | ||
for table in result: | ||
for record in table.records: | ||
data.append(record.values) | ||
return render(request, 'display_data.html', {'data': data}) | ||
|
||
def display_traffic(request): | ||
query = chart_query['traffic']['influxdb2'].format( | ||
bucket=db_client.bucket, | ||
content_type='your_content_type', | ||
object_id='your_object_id', | ||
ifname='your_ifname' | ||
) | ||
result = db_client.query(query) | ||
data = [] | ||
for table in result: | ||
for record in table.records: | ||
data.append(record.values) | ||
return render(request, 'display_data.html', {'data': data}) | ||
|
||
def display_memory(request): | ||
query = chart_query['memory']['influxdb2'].format( | ||
bucket=db_client.bucket, | ||
content_type='your_content_type', | ||
object_id='your_object_id' | ||
) | ||
result = db_client.query(query) | ||
data = [] | ||
for table in result: | ||
for record in table.records: | ||
data.append(record.values) | ||
return render(request, 'display_data.html', {'data': data}) | ||
|
||
def display_cpu(request): | ||
query = chart_query['cpu']['influxdb2'].format( | ||
bucket=db_client.bucket, | ||
content_type='your_content_type', | ||
object_id='your_object_id' | ||
) | ||
result = db_client.query(query) | ||
data = [] | ||
for table in result: | ||
for record in table.records: | ||
data.append(record.values) | ||
return render(request, 'display_data.html', {'data': data}) | ||
|
||
def display_disk(request): | ||
query = chart_query['disk']['influxdb2'].format( | ||
bucket=db_client.bucket, | ||
content_type='your_content_type', | ||
object_id='your_object_id' | ||
) | ||
result = db_client.query(query) | ||
data = [] | ||
for table in result: | ||
for record in table.records: | ||
data.append(record.values) | ||
return render(request, 'display_data.html', {'data': data}) |