monitor_base.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # -*- coding: utf-8 -*-
  2. from sqlalchemy import String, Column, Integer,DateTime,Text,Date,Time,ForeignKey,Float
  3. from database import Base
  4. from sqlalchemy.orm import relationship
  5. from datetime import datetime
  6. class monitorEntity(Base):
  7. __tablename__ = "tp_resource_monitor"
  8. id = Column(Integer, primary_key=True, autoincrement=True,comment="id")
  9. system_ip = Column(String(50),comment="服务器ip")
  10. system_uptime = Column (Integer,comment="系统运行时间")
  11. cpu_cores = Column(Integer,comment="物理CPU核心数")
  12. cpu_count = Column(Integer,comment="总CPU核心数")
  13. cpu_freq = Column(Float,comment="CPU频率")
  14. cpu_usage = Column(Float,comment="CPU使用率")
  15. memory_total = Column(Float,comment="总内存")
  16. memory_usage = Column(Float,comment="内存使用率")
  17. disk1_name = Column(String(50),comment="磁盘1名称")
  18. disk1_total = Column(Float, comment="磁盘1大小")
  19. disk1_usage = Column(Float,comment="硬盘1使用率")
  20. disk1_read_speed = Column(Integer,comment="磁盘1读取速率")
  21. disk1_write_speed = Column(Integer,comment="磁盘1写入速率")
  22. disk2_name = Column(String(50),comment="磁盘2名称")
  23. disk2_total = Column(Float, comment="磁盘2大小")
  24. disk2_usage = Column(Float,comment="硬盘2使用率")
  25. disk2_read_speed = Column(Integer,comment="磁盘2读取速率")
  26. disk2_write_speed = Column(Integer,comment="磁盘2写入速率")
  27. create_time = Column(DateTime, default=datetime.now,comment="创建时间")
  28. class Config:
  29. orm_mode = True