# -*- coding: utf-8 -*-
from sqlalchemy import String, Column, Integer,DateTime,Text,Date,Time,ForeignKey,Float
from database import Base
from sqlalchemy.orm import relationship
from datetime import datetime



class monitorEntity(Base):
    __tablename__ = "tp_resource_monitor"

    id = Column(Integer, primary_key=True, autoincrement=True,comment="id")
    system_ip = Column(String(50),comment="服务器ip")
    system_uptime = Column (Integer,comment="系统运行时间")
    cpu_cores = Column(Integer,comment="物理CPU核心数")
    cpu_count = Column(Integer,comment="总CPU核心数")
    cpu_freq = Column(Float,comment="CPU频率")
    cpu_usage  = Column(Float,comment="CPU使用率")
    memory_total = Column(Float,comment="总内存")
    memory_usage = Column(Float,comment="内存使用率")
    disk1_name = Column(String(50),comment="磁盘1名称")
    disk1_total = Column(Float, comment="磁盘1大小")
    disk1_usage = Column(Float,comment="硬盘1使用率")
    disk1_read_speed = Column(Integer,comment="磁盘1读取速率")
    disk1_write_speed = Column(Integer,comment="磁盘1写入速率")
    disk2_name = Column(String(50),comment="磁盘2名称")
    disk2_total = Column(Float, comment="磁盘2大小")
    disk2_usage = Column(Float,comment="硬盘2使用率")
    disk2_read_speed = Column(Integer,comment="磁盘2读取速率")
    disk2_write_speed = Column(Integer,comment="磁盘2写入速率")
    create_time = Column(DateTime, default=datetime.now,comment="创建时间")

    class Config:
        orm_mode = True

