def GetSystemState(self):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8',0))
self.address = s.getsockname()[0]
self.cpu_count = psutil.cpu_count()
self.cpu_percent = psutil.cpu_percent(interval=1,percpu=True)
self.mem = psutil.virtual_memory()
self.disk_usage = psutil.disk_usage('/')
self.disk_io = psutil.disk_io_counters()
self.net_io = psutil.net_io_counters()
self.hostname = socket.gethostname()
评论列表
文章目录