def Run_Cpu_Min():
    while 1:
        c = Cor()
        cpu, men, new_send, new_recv = c[0], c[1], c[2], c[3]
        try:
            Cpu_Min.objects.create(cpu=cpu,menory=men,network_send=new_send,network_recv=new_recv)
        except Exception as e:
            close_old_connections()
            Cpu_Min.objects.create(cpu=cpu,menory=men,network_send=new_send,network_recv=new_recv)
            Except_Log(stat=16,url='资源监控消耗',error=str(e))
Exemple #2
0
def Run_Cpu_Min():
    while 1:
        try:
            c = Cor()
            cpu, men, new_send, new_recv = c[0], c[1], c[2], c[3]
            Cpu_Min.objects.create(cpu=cpu,menory=men,network_send=new_send,network_recv=new_recv)
        except Exception as e:
            print('错误代码 [16] {}'.format(str(e)))
            Error_Log.objects.create(url='监控资源消耗', error='错误代码 [16] {}'.format(str(e)))
            return '获取失败'
Exemple #3
0
def Run_Cpu_Min():
    # close_old_connections()
    while 1:
        try:
            c = Cor()
            cpu, men, new_send, new_recv = c[0], c[1], c[2], c[3]
            sem.acquire()
            Cpu_Min.objects.create(cpu=cpu,
                                   menory=men,
                                   network_send=new_send,
                                   network_recv=new_recv)
            # Sem.release()

        except Exception as e:
            Except_Log(stat=16, url='资源监控消耗', error=str(e))
            #print('错误代码 [16] {}'.format(str(e)))
            #Error_Log.objects.create(url='监控资源消耗', error='错误代码 [16] {}'.format(str(e)))
            return '获取失败'