mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Plugin snmp__synology: fix code style issues reported by flake8
This commit is contained in:
parent
8b69c8a1fe
commit
dacb55010a
2 changed files with 76 additions and 74 deletions
|
@ -63,6 +63,7 @@ disktable_model = '1.3.6.1.4.1.6574.2.1.1.3'
|
|||
disktable_temp = '1.3.6.1.4.1.6574.2.1.1.6'
|
||||
sys_temperature = '1.3.6.1.4.1.6574.1.2.0'
|
||||
|
||||
|
||||
class SynologySNMPClient(object):
|
||||
def __init__(self, host, port, community):
|
||||
self.hostname = host
|
||||
|
@ -79,7 +80,8 @@ class SynologySNMPClient(object):
|
|||
disk_table)
|
||||
|
||||
if errorIndication:
|
||||
logging.error("SNMP bulkCmd for devices failed: %s, %s, %s" % (errorIndication, errorStatus, errorIndex))
|
||||
logging.error("SNMP bulkCmd for devices failed: %s, %s, %s",
|
||||
errorIndication, errorStatus, errorIndex)
|
||||
return
|
||||
|
||||
devices = {}
|
||||
|
@ -110,7 +112,8 @@ class SynologySNMPClient(object):
|
|||
sys_temperature)
|
||||
|
||||
if errorIndication:
|
||||
logging.error("SNMP getCmd for %s failed: %s, %s, %s" % (sys_temperature, errorIndication, errorStatus, errorIndex))
|
||||
logging.error("SNMP getCmd for %s failed: %s, %s, %s",
|
||||
sys_temperature, errorIndication, errorStatus, errorIndex)
|
||||
return None
|
||||
|
||||
return int(varBindTable[0][1])
|
||||
|
@ -130,7 +133,6 @@ disk{disk_id}.label {name} ({model})
|
|||
disk{disk_id}.type GAUGE
|
||||
disk{disk_id}.min 0""".format(disk_id=id, name=name, model=model)
|
||||
|
||||
|
||||
print """multigraph synology_sys_temperature
|
||||
host_name {hostname}
|
||||
graph_title System temperatures of {hostname}
|
||||
|
@ -162,9 +164,9 @@ if debug:
|
|||
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-7s %(message)s')
|
||||
|
||||
try:
|
||||
match = re.search("^(?:|.*\/)snmp_([^_]+)_synology$", sys.argv[0])
|
||||
match = re.search(r"^(?:|.*\/)snmp_([^_]+)_synology$", sys.argv[0])
|
||||
host = match.group(1)
|
||||
match = re.search("^([^:]+):(\d+)$", host)
|
||||
match = re.search(r"^([^:]+):(\d+)$", host)
|
||||
if match is not None:
|
||||
host = match.group(1)
|
||||
port = match.group(2)
|
||||
|
@ -177,7 +179,8 @@ if "snmpconf" in sys.argv[1:]:
|
|||
sys.exit(0)
|
||||
else:
|
||||
if not (host and port and community):
|
||||
print "# Bad configuration. Cannot run with Host=%s, port=%s and community=%s" % (host, port, community)
|
||||
print("# Bad configuration. Cannot run with Host=%s, port=%s and community=%s"
|
||||
% (host, port, community))
|
||||
sys.exit(1)
|
||||
|
||||
c = SynologySNMPClient(host, port, community)
|
||||
|
|
|
@ -431,7 +431,6 @@ plugins/streaming/packetship_
|
|||
plugins/swift/swift-async_
|
||||
plugins/swift/swift-quarantined_
|
||||
plugins/swift/swift-replication-time_
|
||||
plugins/synology/snmp__synology
|
||||
plugins/system/auth
|
||||
plugins/system/blockhosts
|
||||
plugins/systemd/systemd_units
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue