1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Fix flake warnings

Signed-off-by: Nathaniel Clark <Nathaniel.Clark@misrule.us>
This commit is contained in:
Nathaniel Clark 2020-09-24 13:10:07 -04:00 committed by Lars Kruse
parent 77e5305923
commit 76b4675d1b

View file

@ -102,10 +102,12 @@ uptime.draw AREA
) )
# POWER # POWER
print("multigraph arris_power") print(
print("graph_title Arris Power (dBmV)") """multigraph arris_power
print("graph_vlabel Power (dBmV)") graph_title Arris Power (dBmV)
print("graph_category network") graph_vlabel Power (dBmV)
graph_category network"""
)
for i in range(1, DOWNCOUNT + 1): for i in range(1, DOWNCOUNT + 1):
print("down_{0}.label Down Ch {1}".format(i, i)) print("down_{0}.label Down Ch {1}".format(i, i))
print("down_{0}.type GAUGE".format(i)) print("down_{0}.type GAUGE".format(i))
@ -153,19 +155,22 @@ uptime.draw AREA
print("snr.draw LINE1") print("snr.draw LINE1")
# ERRORS # ERRORS
print("\nmultigraph arris_error") print(
print("graph_title Arris Channel Errors") """
print("graph_category network") multigraph arris_error
print("graph_args --base 1000") graph_title Arris Channel Errors
print("graph_vlabel errors/sec") graph_category network
print("graph_category network") graph_args --base 1000
print("corr.label Corrected") graph_vlabel errors/sec
print("corr.type DERIVE") graph_category network
print("corr.min 0") corr.label Corrected
print("uncr.label Uncorrectable") corr.type DERIVE
print("uncr.type DERIVE") corr.min 0
print("uncr.min 0") uncr.label Uncorrectable
print("uncr.warning 1") uncr.type DERIVE
uncr.min 0
uncr.warning 1"""
)
for i in range(1, DOWNCOUNT + 1): for i in range(1, DOWNCOUNT + 1):
name = "down_{0}".format(i) name = "down_{0}".format(i)
@ -185,10 +190,16 @@ uptime.draw AREA
sys.exit(0) sys.exit(0)
if sys.argv[1] == "autoconfig": if sys.argv[1] == "autoconfig":
try:
def check(url):
from lxml import html from lxml import html
resp = request.urlopen(STATUS_URL) resp = request.urlopen(url)
html.fromstring("<html>")
return resp
try:
resp = check(STATUS_URL)
except ImportError: except ImportError:
print("no (missing lxml module)") print("no (missing lxml module)")
except OSError: except OSError:
@ -197,11 +208,9 @@ uptime.draw AREA
if resp.status == 200: if resp.status == 200:
print("yes") print("yes")
else: else:
print("no (Bad status code: %d)" % page.status_code) print("no (Bad status code: %d)" % resp.status_code)
sys.exit(0) sys.exit(0)
from lxml import html
rxblank = re.compile(r"[\x00\n\r\t ]+", re.MULTILINE) rxblank = re.compile(r"[\x00\n\r\t ]+", re.MULTILINE)
rxcomment = re.compile(r"<!--.*?-->") rxcomment = re.compile(r"<!--.*?-->")
rxscript = re.compile(r"<script.*?</script>", re.MULTILINE) rxscript = re.compile(r"<script.*?</script>", re.MULTILINE)
@ -211,6 +220,8 @@ def process_url(url):
""" """
Extract simpleTables from page at URL Extract simpleTables from page at URL
""" """
from lxml import html
try: try:
resp = request.urlopen(url) resp = request.urlopen(url)
except OSError: except OSError:
@ -266,7 +277,8 @@ if arr:
trs.pop(0) trs.pop(0)
headings = ["".join(x.itertext()).strip() for x in trs.pop(0).findall("td")] headings = ["".join(x.itertext()).strip() for x in trs.pop(0).findall("td")]
# ['Channel', 'Lock Status', 'Modulation', 'Channel ID', 'Frequency', 'Power', 'SNR', 'Corrected', 'Uncorrectables'] # ['Channel', 'Lock Status', 'Modulation', 'Channel ID', 'Frequency', 'Power', 'SNR',
# 'Corrected', 'Uncorrectables']
else: else:
trs = [] trs = []
headings = [] headings = []
@ -329,7 +341,8 @@ if arr:
trs.pop(0) trs.pop(0)
headings = ["".join(x.itertext()).strip() for x in trs.pop(0).findall("td")] headings = ["".join(x.itertext()).strip() for x in trs.pop(0).findall("td")]
# ['Channel', 'Lock Status', 'US Channel Type', 'Channel ID', 'Symbol Rate', 'Frequency', 'Power'] # ['Channel', 'Lock Status', 'US Channel Type', 'Channel ID', 'Symbol Rate',
# 'Frequency', 'Power']
for row in trs: for row in trs:
data = dict( data = dict(