mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
arris-sb6183: Fix int32 wrapping in WebUI
When error counts wrap they are displayed as int32 and negative. Recast them to uint32 to fix math. Signed-off-by: Nathaniel Clark <Nathaniel.Clark@misrule.us>
This commit is contained in:
parent
1977235fd5
commit
b85c9aec3b
1 changed files with 10 additions and 6 deletions
|
@ -80,8 +80,12 @@ GPLv2
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import ctypes
|
||||||
from urllib import request
|
from urllib import request
|
||||||
|
|
||||||
|
def fixint(i):
|
||||||
|
return ctypes.c_uint32(int(i)).value
|
||||||
|
|
||||||
HOSTNAME = os.getenv("hostname", None)
|
HOSTNAME = os.getenv("hostname", None)
|
||||||
STATUS_URL = "http://192.168.100.1/RgConnect.asp"
|
STATUS_URL = "http://192.168.100.1/RgConnect.asp"
|
||||||
INFO_URL = "http://192.168.100.1/RgSwInfo.asp"
|
INFO_URL = "http://192.168.100.1/RgSwInfo.asp"
|
||||||
|
@ -293,10 +297,10 @@ for row in trs:
|
||||||
data = dict(
|
data = dict(
|
||||||
zip(headings, ["".join(x.itertext()).strip() for x in row.findall("td")])
|
zip(headings, ["".join(x.itertext()).strip() for x in row.findall("td")])
|
||||||
)
|
)
|
||||||
uncorr += int(data["Uncorrectables"])
|
uncorr += fixint(data["Uncorrectables"])
|
||||||
correct += int(data["Corrected"])
|
correct += fixint(data["Corrected"])
|
||||||
|
|
||||||
channel = int(data["Channel"])
|
channel = fixint(data["Channel"])
|
||||||
|
|
||||||
print("\nmultigraph arris_power.down_{0}".format(channel))
|
print("\nmultigraph arris_power.down_{0}".format(channel))
|
||||||
value = data["Power"].split(" ")[0]
|
value = data["Power"].split(" ")[0]
|
||||||
|
@ -309,8 +313,8 @@ for row in trs:
|
||||||
snr[channel - 1] = value
|
snr[channel - 1] = value
|
||||||
|
|
||||||
print("multigraph arris_error.down_{0}".format(channel))
|
print("multigraph arris_error.down_{0}".format(channel))
|
||||||
print("corr.value {0}".format(data["Corrected"]))
|
print("corr.value {0}".format(fixint(data["Corrected"])))
|
||||||
print("uncr.value {0}".format(data["Uncorrectables"]))
|
print("uncr.value {0}".format(fixint(data["Uncorrectables"])))
|
||||||
|
|
||||||
# Fill missing
|
# Fill missing
|
||||||
for i in range(len(trs), DOWNCOUNT):
|
for i in range(len(trs), DOWNCOUNT):
|
||||||
|
@ -349,7 +353,7 @@ for row in trs:
|
||||||
data = dict(
|
data = dict(
|
||||||
zip(headings, ["".join(x.itertext()).strip() for x in row.findall("td")])
|
zip(headings, ["".join(x.itertext()).strip() for x in row.findall("td")])
|
||||||
)
|
)
|
||||||
channel = int(data["Channel"])
|
channel = fixint(data["Channel"])
|
||||||
print("multigraph arris_power.up_{0}".format(channel))
|
print("multigraph arris_power.up_{0}".format(channel))
|
||||||
value = data["Power"].split(" ")[0]
|
value = data["Power"].split(" ")[0]
|
||||||
print("power.value {0}".format(value))
|
print("power.value {0}".format(value))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue