def monitorCpu(cpuIdleLimit,saveDbMsgDict): """ 1.根据CPU Idle的告警阀值,发送告警信息 """ warnToPersonList=[] cpuIdle=SystemInfo.getCpuIdle() if cpuIdle==None: log.info('psutil的插件没有安装,或者不支持psutil的低版本的linux。') return warnToPersonList saveDbMsgDict['cpuIdle']=cpuIdle if cpuIdleLimit.isdigit() and cpuIdle<float(cpuIdleLimit): log.info("CPU Idle告警: cpuIdle_limit:%s,real_cpuIdle:%s",cpuIdleLimit,str(cpuIdle)) warnStr=MONITOR_NAME+' CPU Idle告警:cpuIdle_limit:'+cpuIdleLimit+' real_cpuIdle:'+str(cpuIdle) warnToPersonList.append(warnStr) return warnToPersonList