b30cf44b93
Add new platform x86_64-ragile_ra-b6510-48v8c-r0 ASIC Vendor: Broadcom Switch ASIC: Trident 3 Port Config: 48x25G+8x100G Signed-off-by: pettershao-ragilenetworks <pettershao@ragilenetworks.com>
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
#!/usr/bin/python3
|
|
# -*- coding: UTF-8 -*-
|
|
"""
|
|
* onboard temperature sensors
|
|
* FAN trays
|
|
* PSU
|
|
"""
|
|
import time
|
|
import datetime
|
|
from monitor import status
|
|
|
|
def doWork():
|
|
a=[];
|
|
'''
|
|
return: [{'status': '1', 'hw_version': '1.00', 'errcode': 0, 'fan_type': 'M6510-FAN-F', 'errmsg': 'OK', 'Speed': '9778', 'id': 'fan1', 'present': '0', 'sn': '1000000000014'},
|
|
{'id': 'fan2', 'errmsg': 'not present', 'errcode': -1},
|
|
{'id': 'fan3', 'errmsg': 'not present', 'errcode': -1},
|
|
{'id': 'fan4', 'errmsg': 'not present', 'errcode': -1}
|
|
]
|
|
description: 1.get id
|
|
2.errcode equal 0 : dev normal
|
|
not equal 0 : get errmsg
|
|
3.other message add when all check success
|
|
'''
|
|
status.checkFan(a)
|
|
#status.getTemp(a)
|
|
#status.getPsu(a)
|
|
|
|
nowTime=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
|
print(nowTime)
|
|
print(a)
|
|
def run(interval):
|
|
while True:
|
|
try:
|
|
time_remaining = interval - time.time()%interval
|
|
time.sleep(time_remaining)
|
|
doWork()
|
|
except Exception as e:
|
|
print(e)
|
|
|
|
if __name__ == '__main__':
|
|
interval = 1
|
|
run(interval)
|