python监听服务器cpu,内存信息等
import json
import psutil
import time
import os
import re
import paho.mqtt.client as mqtt
from log4p import Logger
# 获取服务器CPU,内存,磁盘相关信息
import constant
import security
import utils
log = Logger('all.log', level='debug')
def getServerMetrics():
# ------------------CPU-------------------------
cpu = {}
# 系统运行时长(秒)
cpu['runningTime'] = int(time.time() - psutil.boot_time())
# 逻辑CPU核数
c
共有 0 条评论