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

Fix python style issues reported by flake8

Additionally some python2-only "print" statements are now compatible
with python3.
This commit is contained in:
Lars Kruse 2019-12-18 00:25:39 +01:00
parent 73f885e382
commit 7063330e03
17 changed files with 102 additions and 103 deletions

View file

@ -91,7 +91,7 @@ class SynologySNMPClient(object):
if not oid.startswith(disk_table):
continue
disk_id = oid[oid.rindex('.')+1:]
disk_id = oid[oid.rindex('.') + 1:]
values = devices.get(disk_id, [None, None, None])
if oid.startswith(disktable_id):
@ -119,21 +119,21 @@ class SynologySNMPClient(object):
return int(varBindTable[0][1])
def print_config(self):
print """multigraph synology_hdd_temperatures
print("""multigraph synology_hdd_temperatures
host_name {hostname}
graph_title HDD temperatures on {hostname}
graph_vlabel Temperature in °C
graph_args --base 1000
graph_category sensors
graph_info HDD temperatures on {hostname}""".format(hostname=self.hostname)
graph_info HDD temperatures on {hostname}""".format(hostname=self.hostname))
for id, name, model, temp in self._get_disks():
print """disk{disk_id}.info Temperature of {name} ({model})
print("""disk{disk_id}.info Temperature of {name} ({model})
disk{disk_id}.label {name} ({model})
disk{disk_id}.type GAUGE
disk{disk_id}.min 0""".format(disk_id=id, name=name, model=model)
disk{disk_id}.min 0""".format(disk_id=id, name=name, model=model))
print """multigraph synology_sys_temperature
print("""multigraph synology_sys_temperature
host_name {hostname}
graph_title System temperatures of {hostname}
graph_vlabel Temperature in °C
@ -144,15 +144,15 @@ sys_temp.info System temperature
sys_temp.label Temperature
sys_temp.type GAUGE
sys_temp.min 0
""".format(hostname=self.hostname)
""".format(hostname=self.hostname))
def execute(self):
print """multigraph synology_hdd_temperatures"""
print("""multigraph synology_hdd_temperatures""")
for id, name, model, temp in self._get_disks():
print """disk{disk_id}.value {temp}""".format(disk_id=id, temp=temp)
print("""disk{disk_id}.value {temp}""".format(disk_id=id, temp=temp))
print """multigraph synology_sys_temperature"""
print "sys_temp.value {temp}".format(temp=self._get_sys_temperature())
print("""multigraph synology_sys_temperature""")
print("sys_temp.value {temp}".format(temp=self._get_sys_temperature()))
host = None
@ -175,7 +175,7 @@ except Exception as ex:
if "snmpconf" in sys.argv[1:]:
print "require 1.3.6.1.4.1.6574.2.1.1"
print("require 1.3.6.1.4.1.6574.2.1.1")
sys.exit(0)
else:
if not (host and port and community):