Révision 7063330e
Fix python style issues reported by flake8
Additionally some python2-only "print" statements are now compatible
with python3.
| plugins/synology/snmp__synology | ||
|---|---|---|
| 91 | 91 |
if not oid.startswith(disk_table): |
| 92 | 92 |
continue |
| 93 | 93 |
|
| 94 |
disk_id = oid[oid.rindex('.')+1:]
|
|
| 94 |
disk_id = oid[oid.rindex('.') + 1:]
|
|
| 95 | 95 |
|
| 96 | 96 |
values = devices.get(disk_id, [None, None, None]) |
| 97 | 97 |
if oid.startswith(disktable_id): |
| ... | ... | |
| 119 | 119 |
return int(varBindTable[0][1]) |
| 120 | 120 |
|
| 121 | 121 |
def print_config(self): |
| 122 |
print """multigraph synology_hdd_temperatures
|
|
| 122 |
print("""multigraph synology_hdd_temperatures
|
|
| 123 | 123 |
host_name {hostname}
|
| 124 | 124 |
graph_title HDD temperatures on {hostname}
|
| 125 | 125 |
graph_vlabel Temperature in °C |
| 126 | 126 |
graph_args --base 1000 |
| 127 | 127 |
graph_category sensors |
| 128 |
graph_info HDD temperatures on {hostname}""".format(hostname=self.hostname)
|
|
| 128 |
graph_info HDD temperatures on {hostname}""".format(hostname=self.hostname))
|
|
| 129 | 129 |
|
| 130 | 130 |
for id, name, model, temp in self._get_disks(): |
| 131 |
print """disk{disk_id}.info Temperature of {name} ({model})
|
|
| 131 |
print("""disk{disk_id}.info Temperature of {name} ({model})
|
|
| 132 | 132 |
disk{disk_id}.label {name} ({model})
|
| 133 | 133 |
disk{disk_id}.type GAUGE
|
| 134 |
disk{disk_id}.min 0""".format(disk_id=id, name=name, model=model)
|
|
| 134 |
disk{disk_id}.min 0""".format(disk_id=id, name=name, model=model))
|
|
| 135 | 135 |
|
| 136 |
print """multigraph synology_sys_temperature
|
|
| 136 |
print("""multigraph synology_sys_temperature
|
|
| 137 | 137 |
host_name {hostname}
|
| 138 | 138 |
graph_title System temperatures of {hostname}
|
| 139 | 139 |
graph_vlabel Temperature in °C |
| ... | ... | |
| 144 | 144 |
sys_temp.label Temperature |
| 145 | 145 |
sys_temp.type GAUGE |
| 146 | 146 |
sys_temp.min 0 |
| 147 |
""".format(hostname=self.hostname) |
|
| 147 |
""".format(hostname=self.hostname))
|
|
| 148 | 148 |
|
| 149 | 149 |
def execute(self): |
| 150 |
print """multigraph synology_hdd_temperatures"""
|
|
| 150 |
print("""multigraph synology_hdd_temperatures""")
|
|
| 151 | 151 |
for id, name, model, temp in self._get_disks(): |
| 152 |
print """disk{disk_id}.value {temp}""".format(disk_id=id, temp=temp)
|
|
| 152 |
print("""disk{disk_id}.value {temp}""".format(disk_id=id, temp=temp))
|
|
| 153 | 153 |
|
| 154 |
print """multigraph synology_sys_temperature"""
|
|
| 155 |
print "sys_temp.value {temp}".format(temp=self._get_sys_temperature())
|
|
| 154 |
print("""multigraph synology_sys_temperature""")
|
|
| 155 |
print("sys_temp.value {temp}".format(temp=self._get_sys_temperature()))
|
|
| 156 | 156 |
|
| 157 | 157 |
|
| 158 | 158 |
host = None |
| ... | ... | |
| 175 | 175 |
|
| 176 | 176 |
|
| 177 | 177 |
if "snmpconf" in sys.argv[1:]: |
| 178 |
print "require 1.3.6.1.4.1.6574.2.1.1"
|
|
| 178 |
print("require 1.3.6.1.4.1.6574.2.1.1")
|
|
| 179 | 179 |
sys.exit(0) |
| 180 | 180 |
else: |
| 181 | 181 |
if not (host and port and community): |
Formats disponibles : Unified diff