3
3
# autonomous subsystem provides monitoring and management
4
4
# facility independent of the host CPU. IPMI standard
5
5
# protocol is used with ipmitool to fetch sensor details.
6
- # Current script support X00 board only. X01 support will
6
+ # Current script support X00 board only. X01 support will
7
7
# be added soon. This provies support for the
8
8
# following objects:
9
9
# * Onboard temperature sensors
26
26
PSU_PRESENCE = "PSU{0}_state"
27
27
# Use this for older firmware
28
28
# PSU_PRESENCE="PSU{0}_prsnt"
29
-
30
29
ipmi_sdr_list = ""
31
30
32
31
# Dump sensor registers
@@ -53,7 +52,7 @@ def get_pmc_register(reg_name):
53
52
output = item .strip ()
54
53
55
54
if not output :
56
- print ('\n Failed to fetch: ' + reg_name + ' sensor ' )
55
+ print ('\n Failed to fetch: ' + reg_name + ' sensor ' )
57
56
sys .exit (0 )
58
57
59
58
output = output .split ('|' )[1 ]
@@ -83,8 +82,10 @@ def print_temperature_sensors():
83
82
(get_pmc_register ('CPU_Near_temp' ))
84
83
print ' CPU Near Temp: ' ,\
85
84
(get_pmc_register ('CPU_temp' ))
86
- print ' DRAM Temp: ' ,\
87
- (get_pmc_register ('DRAM1_temp' ))
85
+ print ' PSU FAN AirFlow Temperature 1: ' ,\
86
+ (get_pmc_register ('PSU1_AF_temp' ))
87
+ print ' PSU FAN AirFlow Temperature 2: ' ,\
88
+ (get_pmc_register ('PSU2_AF_temp' ))
88
89
89
90
ipmi_sensor_dump ()
90
91
@@ -95,15 +96,23 @@ def print_temperature_sensors():
95
96
96
97
def print_fan_tray (tray ):
97
98
98
- Fan_Status = [' Normal' , ' Abnormal' ]
99
+ Fan_Status = [' Normal' , ' Abnormal' , ' no reading' ]
99
100
Airflow_Direction = ['B2F' , 'F2B' ]
100
101
101
102
print ' Fan Tray ' + str (tray ) + ':'
102
103
103
104
if (tray == 1 ):
104
105
105
- fan1_status = int (get_pmc_register ('Fan1_Front_state' ), 16 )
106
- fan2_status = int (get_pmc_register ('Fan1_Rear_state' ), 16 )
106
+ if (int (get_pmc_register ('FAN1_prsnt' ), 16 )):
107
+ fan1_status = int (get_pmc_register ('Fan1_Front_state' ), 16 )
108
+ fan2_status = int (get_pmc_register ('Fan1_Rear_state' ), 16 )
109
+ # BMC taking some time to update
110
+ if (fan1_status > 2 or fan2_status > 2 ):
111
+ fan1_status = 2
112
+ fan2_status = 2
113
+ else :
114
+ fan1_status = 2
115
+ fan2_status = 2
107
116
108
117
print ' Fan1 Speed: ' ,\
109
118
get_pmc_register ('FAN1_Front_rpm' )
@@ -116,8 +125,16 @@ def print_fan_tray(tray):
116
125
117
126
elif (tray == 2 ):
118
127
119
- fan1_status = int (get_pmc_register ('Fan2_Front_state' ), 16 )
120
- fan2_status = int (get_pmc_register ('Fan2_Rear_state' ), 16 )
128
+ if (int (get_pmc_register ('FAN2_prsnt' ), 16 )):
129
+ fan1_status = int (get_pmc_register ('Fan2_Front_state' ), 16 )
130
+ fan2_status = int (get_pmc_register ('Fan2_Rear_state' ), 16 )
131
+ # BMC taking some time to update
132
+ if (fan1_status > 2 or fan2_status > 2 ):
133
+ fan1_status = 2
134
+ fan2_status = 2
135
+ else :
136
+ fan1_status = 2
137
+ fan2_status = 2
121
138
122
139
print ' Fan1 Speed: ' ,\
123
140
get_pmc_register ('FAN2_Front_rpm' )
@@ -130,8 +147,16 @@ def print_fan_tray(tray):
130
147
131
148
elif (tray == 3 ):
132
149
133
- fan1_status = int (get_pmc_register ('Fan3_Front_state' ), 16 )
134
- fan2_status = int (get_pmc_register ('Fan3_Rear_state' ), 16 )
150
+ if (int (get_pmc_register ('FAN3_prsnt' ), 16 )):
151
+ fan1_status = int (get_pmc_register ('Fan3_Front_state' ), 16 )
152
+ fan2_status = int (get_pmc_register ('Fan3_Rear_state' ), 16 )
153
+ # BMC taking some time to update
154
+ if (fan1_status > 2 or fan2_status > 2 ):
155
+ fan1_status = 2
156
+ fan2_status = 2
157
+ else :
158
+ fan1_status = 2
159
+ fan2_status = 2
135
160
136
161
print ' Fan1 Speed: ' ,\
137
162
get_pmc_register ('FAN3_Front_rpm' )
@@ -144,8 +169,16 @@ def print_fan_tray(tray):
144
169
145
170
elif (tray == 4 ):
146
171
147
- fan1_status = int (get_pmc_register ('Fan4_Front_state' ), 16 )
148
- fan2_status = int (get_pmc_register ('Fan4_Rear_state' ), 16 )
172
+ if (int (get_pmc_register ('FAN4_prsnt' ), 16 )):
173
+ fan1_status = int (get_pmc_register ('Fan4_Front_state' ), 16 )
174
+ fan2_status = int (get_pmc_register ('Fan4_Rear_state' ), 16 )
175
+ # BMC taking some time to update
176
+ if (fan1_status > 2 or fan2_status > 2 ):
177
+ fan1_status = 2
178
+ fan2_status = 2
179
+ else :
180
+ fan1_status = 2
181
+ fan2_status = 2
149
182
150
183
print ' Fan1 Speed: ' ,\
151
184
get_pmc_register ('FAN4_Front_rpm' )
@@ -169,80 +202,54 @@ def print_fan_tray(tray):
169
202
170
203
# Print the information for PSU1, PSU2
171
204
def print_psu (psu ):
172
- Psu_Type = ['Normal' , 'Mismatch' ]
173
- Psu_Input_Type = ['AC' , 'DC' ]
174
- PSU_STATUS_TYPE_BIT = 4
175
- PSU_STATUS_INPUT_TYPE_BIT = 1
176
- PSU_FAN_PRESENT_BIT = 2
177
- PSU_FAN_STATUS_BIT = 1
178
- PSU_FAN_AIR_FLOW_BIT = 0
179
- Psu_Fan_Presence = ['Present' , 'Absent' ]
180
- Psu_Fan_Status = ['Normal' , 'Abnormal' ]
181
- Psu_Fan_Airflow = ['B2F' , 'F2B' ]
182
-
183
- # print ' Input: ', Psu_Input_Type[psu_input_type]
184
- # print ' Type: ', Psu_Type[psu_type]
185
205
186
206
# PSU FAN details
187
207
if (psu == 1 ):
188
208
189
- # psu1_fan_status = int(get_pmc_register('PSU1_status'),16)
190
-
191
209
print ' PSU1:'
192
- print ' FAN Normal Temperature: ' ,\
210
+ print ' FAN Normal Temperature: ' ,\
193
211
get_pmc_register ('PSU1_Normal_temp' )
194
- print ' FAN System Temperature: ' ,\
195
- get_pmc_register ('PSU1_Sys_temp' )
196
- print ' FAN Chassis Temperature: ' ,\
212
+ print ' Chassis Temperature: ' ,\
197
213
get_pmc_register ('PSU1_Chass_temp' )
198
- print ' FAN AirFlow Temperature: ' ,\
199
- get_pmc_register ('PSU1AF_temp ' )
214
+ print ' System Temperature: ' ,\
215
+ get_pmc_register ('PSU1_Sys_temp ' )
200
216
print ' FAN RPM: ' ,\
201
217
get_pmc_register ('PSU1_rpm' )
202
- # print ' FAN Status: ', Psu_Fan_Status[psu1_fan_status]
203
-
204
- # PSU input & output monitors
205
- print ' Input Voltage: ' ,\
218
+ print ' Input Voltage: ' ,\
206
219
get_pmc_register ('PSU1_In_volt' )
207
- print ' Output Voltage: ' ,\
220
+ print ' Output Voltage: ' ,\
208
221
get_pmc_register ('PSU1_Out_volt' )
209
- print ' Input Power: ' ,\
222
+ print ' Input Power: ' ,\
210
223
get_pmc_register ('PSU1_In_watt' )
211
- print ' Output Power: ' ,\
224
+ print ' Output Power: ' ,\
212
225
get_pmc_register ('PSU1_Out_watt' )
213
- print ' Input Current: ' ,\
226
+ print ' Input Current: ' ,\
214
227
get_pmc_register ('PSU1_In_amp' )
215
- print ' Output Current: ' ,\
228
+ print ' Output Current: ' ,\
216
229
get_pmc_register ('PSU1_Out_amp' )
217
230
218
231
else :
219
232
220
- # psu2_fan_status = int(get_pmc_register('PSU1_status'),16)
221
233
print ' PSU2:'
222
- print ' FAN Normal Temperature: ' ,\
234
+ print ' FAN Normal Temperature: ' ,\
223
235
get_pmc_register ('PSU2_Normal_temp' )
224
- print ' FAN System Temperature: ' ,\
225
- get_pmc_register ('PSU2_Sys_temp' )
226
- print ' FAN Chassis Temperature: ' ,\
236
+ print ' Chassis Temperature: ' ,\
227
237
get_pmc_register ('PSU2_Chass_temp' )
228
- print ' FAN AirFlow Temperature: ' ,\
229
- get_pmc_register ('PSU2AF_temp ' )
238
+ print ' System Temperature: ' ,\
239
+ get_pmc_register ('PSU2_Sys_temp ' )
230
240
print ' FAN RPM: ' ,\
231
241
get_pmc_register ('PSU2_rpm' )
232
- # print ' FAN Status: ', Psu_Fan_Status[psu2_fan_status]
233
-
234
- # PSU input & output monitors
235
- print ' Input Voltage: ' ,\
242
+ print ' Input Voltage: ' ,\
236
243
get_pmc_register ('PSU2_In_volt' )
237
- print ' Output Voltage: ' ,\
244
+ print ' Output Voltage: ' ,\
238
245
get_pmc_register ('PSU2_Out_volt' )
239
- print ' Input Power: ' ,\
246
+ print ' Input Power: ' ,\
240
247
get_pmc_register ('PSU2_In_watt' )
241
- print ' Output Power: ' ,\
248
+ print ' Output Power: ' ,\
242
249
get_pmc_register ('PSU2_Out_watt' )
243
- print ' Input Current: ' ,\
250
+ print ' Input Current: ' ,\
244
251
get_pmc_register ('PSU2_In_amp' )
245
- print ' Output Current: ' ,\
252
+ print ' Output Current: ' ,\
246
253
get_pmc_register ('PSU2_Out_amp' )
247
254
248
255
@@ -254,6 +261,5 @@ def print_psu(psu):
254
261
else :
255
262
print '\n PSU ' , psu , 'Not present'
256
263
257
- print '\n Total Power: ' ,\
264
+ print '\n Total Power: ' ,\
258
265
get_pmc_register ('PSU_Total_watt' )
259
-
0 commit comments