Skip to content

Commit e9254ee

Browse files
authored
feat: adding system fan monitoring (#98)
1 parent 7a59fad commit e9254ee

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

qnapstats/qnap_stats.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ def get_system_stats(self):
257257
},
258258
"nics": {},
259259
"dns": [],
260+
"sysfans": {},
260261
}
261262

262263
nic_count = int(root["nic_cnt"])
@@ -275,6 +276,16 @@ def get_system_stats(self):
275276
"tx_packets": int(root["tx_packet" + i]),
276277
"err_packets": int(root["err_packet" + i])
277278
}
279+
280+
sysfan_count = int(root["sysfan_count"])
281+
for sysfan_index in range(sysfan_count):
282+
i = str(sysfan_index + 1)
283+
sysfan = "sysfan" + str(sysfan_index)
284+
details["sysfans"][sysfan] = {
285+
"speed": int(root["sysfan" + i]),
286+
"status": "alert" if int(root["sysfan" + i + "_stat"]) == -1 else "ok"
287+
}
288+
278289

279290
dnsInfo = root.get("dnsInfo")
280291
if dnsInfo:

0 commit comments

Comments
 (0)