|
|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
from sqlalchemy import Column, Integer, Float, ForeignKey, String
|
|
|
|
|
from sqlalchemy import Column, DateTime, Integer, Float, ForeignKey, String
|
|
|
|
|
from sqlalchemy.orm import relationship
|
|
|
|
|
|
|
|
|
|
from .database import Base
|
|
|
|
|
@ -7,31 +7,33 @@ from .database import Base
|
|
|
|
|
class Host(Base):
|
|
|
|
|
__tablename__ = "hosts"
|
|
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
|
|
|
hostname = Column(String(255), unique=True, index=True)
|
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
|
|
|
hostname = Column(String(255), unique=True, index=True)
|
|
|
|
|
|
|
|
|
|
cpus = relationship("CPU", back_populates="host")
|
|
|
|
|
memory = relationship("Memory", back_populates="host")
|
|
|
|
|
cpus = relationship("CPU", back_populates="host")
|
|
|
|
|
memory = relationship("Memory", back_populates="host")
|
|
|
|
|
|
|
|
|
|
class CPU(Base):
|
|
|
|
|
__tablename__ = "cpus"
|
|
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
|
|
|
socket = Column(Integer, index=True)
|
|
|
|
|
name = Column(String(255), index=True)
|
|
|
|
|
usage = Column(Float, index=True)
|
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
|
|
|
time = Column(DateTime, unique=False, index=True)
|
|
|
|
|
socket = Column(Integer, index=True)
|
|
|
|
|
name = Column(String(255), index=True)
|
|
|
|
|
usage = Column(Float, index=True)
|
|
|
|
|
cores = Column(Integer, index=True)
|
|
|
|
|
host_id = Column(Integer, ForeignKey("hosts.id"))
|
|
|
|
|
|
|
|
|
|
host = relationship("Host", back_populates="cpus")
|
|
|
|
|
host = relationship("Host", back_populates="cpus")
|
|
|
|
|
|
|
|
|
|
class Memory(Base):
|
|
|
|
|
__tablename__ = "memory"
|
|
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
|
|
|
type = Column(String(12), index=True)
|
|
|
|
|
total = Column(Integer, index=True)
|
|
|
|
|
used = Column(Integer, index=True)
|
|
|
|
|
usage = Column(Float, index=True)
|
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
|
|
|
type = Column(String(12), index=True)
|
|
|
|
|
total = Column(Integer, index=True)
|
|
|
|
|
used = Column(Integer, index=True)
|
|
|
|
|
usage = Column(Float, index=True)
|
|
|
|
|
host_id = Column(Integer, ForeignKey("hosts.id"))
|
|
|
|
|
|
|
|
|
|
host = relationship("Host", back_populates="memory")
|
|
|
|
|
host = relationship("Host", back_populates="memory")
|
|
|
|
|
|