mirror of
https://github.com/eduardogsilva/routerfleet.git
synced 2025-08-31 15:31:29 +02:00
Router monitoring first commit
This commit is contained in:
parent
9129a007ee
commit
2a95f0c77f
9 changed files with 60 additions and 0 deletions
0
monitoring/__init__.py
Normal file
0
monitoring/__init__.py
Normal file
3
monitoring/admin.py
Normal file
3
monitoring/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
6
monitoring/apps.py
Normal file
6
monitoring/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class MonitoringConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'monitoring'
|
30
monitoring/migrations/0001_initial.py
Normal file
30
monitoring/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Generated by Django 5.0.3 on 2024-03-16 18:23
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('router_manager', '0003_routerstatus'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='RouterDownTime',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('start_time', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('end_time', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('total_down_time', models.IntegerField(default=0)),
|
||||||
|
('updated', models.DateTimeField(auto_now=True)),
|
||||||
|
('created', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
|
||||||
|
('router', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='router_manager.router')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
0
monitoring/migrations/__init__.py
Normal file
0
monitoring/migrations/__init__.py
Normal file
14
monitoring/models.py
Normal file
14
monitoring/models.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from django.db import models
|
||||||
|
from router_manager.models import Router
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
|
class RouterDownTime(models.Model):
|
||||||
|
router = models.ForeignKey(Router, on_delete=models.CASCADE)
|
||||||
|
start_time = models.DateTimeField(blank=True, null=True)
|
||||||
|
end_time = models.DateTimeField(blank=True, null=True)
|
||||||
|
total_down_time = models.IntegerField(default=0) # minutes
|
||||||
|
|
||||||
|
updated = models.DateTimeField(auto_now=True)
|
||||||
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
|
uuid = models.UUIDField(unique=True, editable=False, default=uuid.uuid4)
|
3
monitoring/tests.py
Normal file
3
monitoring/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
3
monitoring/views.py
Normal file
3
monitoring/views.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
|
@ -41,6 +41,7 @@ INSTALLED_APPS = [
|
||||||
'crispy_bootstrap4',
|
'crispy_bootstrap4',
|
||||||
'user_manager',
|
'user_manager',
|
||||||
'router_manager',
|
'router_manager',
|
||||||
|
'monitoring'
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue