20
20
# ------------------------------------------------------------------
21
21
22
22
try :
23
- import os
24
23
import sys
25
24
import getopt
26
- import subprocess
27
- import imp
28
25
import logging
29
26
import logging .config
30
27
import logging .handlers
31
- import types
32
28
import time
33
- import traceback
34
29
import commands
35
30
from as4630_54te .fanutil import FanUtil
36
31
from as4630_54te .thermalutil import ThermalUtil
41
36
VERSION = '1.0'
42
37
FUNCTION_NAME = '/usr/local/bin/accton_as4630_54te_monitor'
43
38
44
- global log_file
45
- global log_level
46
-
47
-
48
39
# Temperature Policy
49
40
# If any fan fail , please set fan speed register to 16
50
41
# The max value of fan speed register is 14
@@ -113,7 +104,7 @@ def __init__(self, log_file, log_level):
113
104
console .setFormatter (formatter )
114
105
logging .getLogger ('' ).addHandler (console )
115
106
116
- sys_handler = handler = logging .handlers .SysLogHandler (
107
+ sys_handler = logging .handlers .SysLogHandler (
117
108
address = '/dev/log' )
118
109
sys_handler .setLevel (logging .WARNING )
119
110
logging .getLogger ('' ).addHandler (sys_handler )
@@ -148,7 +139,6 @@ def manage_fans(self):
148
139
LEVEL_TEMP_CRITICAL : [100 , 16 , 240000 , 300000 ],
149
140
}
150
141
temp = [0 , 0 , 0 ]
151
- temp_fail = 0
152
142
thermal = ThermalUtil ()
153
143
fan = FanUtil ()
154
144
ori_duty_cycle = fan .get_fan_duty_cycle ()
@@ -158,7 +148,6 @@ def manage_fans(self):
158
148
for i in range (0 , 3 ):
159
149
temp [i ] = thermal ._get_thermal_val (i + 1 )
160
150
if temp [i ] == 0 or temp [i ] is None :
161
- temp_fail = 1
162
151
logging .warning ("Get temp-%d fail" , i )
163
152
return False
164
153
else :
@@ -207,7 +196,6 @@ def manage_fans(self):
207
196
'Alarm-Critical for temperature critical is detected, reset DUT' )
208
197
cmd_str = "i2cset -y -f 3 0x60 0x4 0xE4"
209
198
time .sleep (2 )
210
- status , output = commands .getstatusoutput (cmd_str )
211
199
212
200
#logging.debug('ori_state=%d, current_state=%d, temp_val=%d\n\n',ori_state, fan_policy_state, temp_val)
213
201
0 commit comments