Module: check_mk
Branch: master
Commit: 3387ec231635ec5266974f068c042d2dbe373563
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3387ec231635ec…
Author: Óscar Nájera <on(a)mathias-kettner.de>
Date: Thu Sep 27 18:48:36 2018 +0200
Refactor type
Change-Id: Ida4c77fddd1681ddd009da718b469c42278ba20c
---
checks/drbd | 4 ++--
checks/hp_procurve_sensors | 12 ++++++------
checks/hp_proliant_mem | 6 +++---
checks/lgp_pdu_aux | 10 +++++-----
checks/ra32e_sensors | 14 +++++++-------
cmk/gui/bi.py | 2 +-
cmk/gui/multitar.py | 2 +-
7 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/checks/drbd b/checks/drbd
index ef14463..92fcf74 100644
--- a/checks/drbd
+++ b/checks/drbd
@@ -347,8 +347,8 @@ def drbd_get_rates(list):
now = time.time()
output = ''
perfdata = []
- for type, name, item, value, uom in list:
- rate = get_rate("%s.%s.%s" % (type, name, item), now, value)
+ for type_, name, item, value, uom in list:
+ rate = get_rate("%s.%s.%s" % (type_, name, item), now, value)
perfdata.append((name, rate))
output += ' %s/sec: %s%s' % (name, rate, uom)
return (output, perfdata)
diff --git a/checks/hp_procurve_sensors b/checks/hp_procurve_sensors
index 5b61f6e..c08b849 100644
--- a/checks/hp_procurve_sensors
+++ b/checks/hp_procurve_sensors
@@ -69,16 +69,16 @@ hp_procurve_status_map = { '1': 'unknown',
'2': 'bad', '3': 'warning', '4': 'goo
hp_procurve_status2nagios_map = { 'unknown': 3, 'bad': 2,
'warning': 1, 'good': 0, 'notPresent': 1 }
def get_hp_procurve_sensor_type(type_input):
- type = ''
+ type_ = ''
if type_input.endswith('11.2.3.7.8.3.1'):
- type = 'PSU'
+ type_ = 'PSU'
elif type_input.endswith('11.2.3.7.8.3.2'):
- type = 'FAN'
+ type_ = 'FAN'
elif type_input.endswith('11.2.3.7.8.3.3'):
- type = 'Temp'
+ type_ = 'Temp'
elif type_input.endswith('11.2.3.7.8.3.4'):
- type = 'FutureSlot'
- return type
+ type_ = 'FutureSlot'
+ return type_
def inventory_hp_procurve_sensors(info):
inventory = []
diff --git a/checks/hp_proliant_mem b/checks/hp_proliant_mem
index 091b3b9..e9fa74c 100644
--- a/checks/hp_proliant_mem
+++ b/checks/hp_proliant_mem
@@ -111,9 +111,9 @@ def check_hp_proliant_mem(item, params, info):
module_size_mb = int(module_size) / 1024
- type = 'n/a'
+ type_ = 'n/a'
if int(module_type) in hp_proliant_mem_type_map:
- type = hp_proliant_mem_type_map[int(module_type)]
+ type_ = hp_proliant_mem_type_map[int(module_type)]
snmp_status = 'n/a'
if int(module_status) in hp_proliant_mem_status_map:
@@ -149,7 +149,7 @@ def check_hp_proliant_mem(item, params, info):
return (status, 'Board: %s, Num: %s, Type: %s, Size: %s MB%s' %
(board_index, module_index,
- type, module_size_mb, detail_output))
+ type_, module_size_mb, detail_output))
return (3, "item not found in snmp data")
diff --git a/checks/lgp_pdu_aux b/checks/lgp_pdu_aux
index 2731b82..a2bea42 100644
--- a/checks/lgp_pdu_aux
+++ b/checks/lgp_pdu_aux
@@ -92,12 +92,12 @@ _lgp_pdu_aux_fields = {
def lgp_pdu_aux_fmt(info):
new_info = {}
for oid, value in info:
- type, id = oid.split('.', 1)
- if not id in new_info:
- new_info[id] = {'TypeIndex': id.split('.')[-1]}
+ type_, id_ = oid.split('.', 1)
+ if not id_ in new_info:
+ new_info[id_] = {'TypeIndex': id_.split('.')[-1]}
# Skip not handled rows
- if type in _lgp_pdu_aux_fields:
- ty, factor, key = _lgp_pdu_aux_fields[type]
+ if type_ in _lgp_pdu_aux_fields:
+ ty, factor, key = _lgp_pdu_aux_fields[type_]
if key == 'Type':
value = lgp_pdu_aux_types.get(value, 'UNHANDLED')
diff --git a/checks/ra32e_sensors b/checks/ra32e_sensors
index 4c740e6..eec8b1f 100644
--- a/checks/ra32e_sensors
+++ b/checks/ra32e_sensors
@@ -50,23 +50,23 @@ def parse_ra32e_sensors(info):
internal, sensors = info
- for type, item, value in zip(['temperature', 'humidity',
'temperature'],
+ for type_, item, value in zip(['temperature', 'humidity',
'temperature'],
['Internal', 'Internal',
'Heat Index'],
internal[0]):
if value:
- parsed[type][item] = float(value) / 100.0
+ parsed[type_][item] = float(value) / 100.0
for sensor in sensors:
oid_end, sensor_data = sensor[0], sensor[1:]
name = 'Sensor %d' % int(oid_end.split('.')[0])
- type = type_of(sensor_data)
+ type_ = type_of(sensor_data)
# uses the format of elphase.include for power and voltage
- if type == 'temp':
+ if type_ == 'temp':
temperature, _, _, _, _ = sensor_data
parsed['temperature'][name] = float(temperature) / 100.0
- elif type == 'temp/active':
+ elif type_ == 'temp/active':
temperature, _, power_state, _, _ = sensor_data
parsed['temperature'][name] = float(temperature) / 100.0
@@ -75,11 +75,11 @@ def parse_ra32e_sensors(info):
'0': (2, 'no power detected')
}
parsed['power'][name] = {'device_state':
power_status_map.get(power_state)}
- elif type == 'temp/analog':
+ elif type_ == 'temp/analog':
temperature, _, voltage, _, _ = sensor_data
parsed['temperature'][name] = float(temperature) / 100.0
parsed['voltage'][name] = {'voltage': (int(voltage), None)}
- elif type == 'temp/humidity':
+ elif type_ == 'temp/humidity':
temperature, _, humidity, _, heatindex = sensor_data
parsed['temperature'][name] = float(temperature) / 100.0
parsed['humidity'][name] = float(humidity) / 100.0
diff --git a/cmk/gui/bi.py b/cmk/gui/bi.py
index 0b4c388..93026e4 100644
--- a/cmk/gui/bi.py
+++ b/cmk/gui/bi.py
@@ -510,7 +510,7 @@ class BILock(object):
return self
- def __exit__(self, type, value, traceback):
+ def __exit__(self, exception_type, exception_value, traceback):
if self._fd:
log('BI: BILock %-2s %30s <<<%s>>>' % ( self._fd,
"RELEASE", os.path.basename(self._filepath)))
fcntl.flock(self._fd, fcntl.LOCK_UN)
diff --git a/cmk/gui/multitar.py b/cmk/gui/multitar.py
index a5cfb6b..4497b3c 100644
--- a/cmk/gui/multitar.py
+++ b/cmk/gui/multitar.py
@@ -327,7 +327,7 @@ class SnapshotCreator(SnapshotCreationBase):
return self
- def __exit__(self, type, value, traceback):
+ def __exit__(self, exception_type, exception_value, traceback):
for worker in self._worker_subprocesses:
worker.join()
self.output_statistics()