mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
993 B
29 lines
993 B
4 years ago
|
from __future__ import unicode_literals
|
||
|
|
||
|
import uuid
|
||
|
|
||
|
from django.db import models
|
||
|
from django.utils.translation import ugettext_lazy as _
|
||
|
|
||
|
from .terminal import Terminal
|
||
|
|
||
|
|
||
|
class Status(models.Model):
|
||
|
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
||
|
session_online = models.IntegerField(verbose_name=_("Session Online"), default=0)
|
||
|
cpu_used = models.FloatField(verbose_name=_("CPU Usage"))
|
||
|
memory_used = models.FloatField(verbose_name=_("Memory Used"))
|
||
|
connections = models.IntegerField(verbose_name=_("Connections"))
|
||
|
threads = models.IntegerField(verbose_name=_("Threads"))
|
||
|
boot_time = models.FloatField(verbose_name=_("Boot Time"))
|
||
|
terminal = models.ForeignKey(Terminal, null=True, on_delete=models.CASCADE)
|
||
|
date_created = models.DateTimeField(auto_now_add=True)
|
||
|
|
||
|
class Meta:
|
||
|
db_table = 'terminal_status'
|
||
|
get_latest_by = 'date_created'
|
||
|
|
||
|
def __str__(self):
|
||
|
return self.date_created.strftime("%Y-%m-%d %H:%M:%S")
|
||
|
|