Module: check_mk
Branch: master
Commit: 2536f8d10aeb8f57fb46296e5bf3a399be78cae7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2536f8d10aeb8f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jun 5 17:11:53 2012 +0200
FIX: hpux_if: convert_to_hex was missing on non-SNMP-hosts
---
ChangeLog | 2 ++
checks/if.include | 5 ++---
modules/snmp.py | 12 ------------
3 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f696844..d8d90e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,8 @@
* postgres_sessions: New check for PostgreSQL number of sessions
* postgres_stat_database: New check for PostgreSQL database statistics
* postgres_stat_database.size: New check for PostgreSQL database size
+ * FIX: hpux_if: convert_to_hex was missing on non-SNMP-hosts -replace
+ with inline implementation
1.2.0b6:
Multisite:
diff --git a/checks/if.include b/checks/if.include
index f1ebe87..e088cd9 100644
--- a/checks/if.include
+++ b/checks/if.include
@@ -134,7 +134,6 @@ def inventory_if_common(info):
return inventory
-
def check_if_common(item, params, info):
# Params now must be a dict. Some keys might
# be set to None
@@ -206,8 +205,8 @@ def check_if_common(item, params, info):
ref_speed = None
if ifPhysAddress:
- ifPhysAddress = ':'.join(convert_to_hex(ifPhysAddress).strip().split('
'))
- infotext += 'MAC: %s, ' % ifPhysAddress
+ mac = ":".join(["%02s" % hex(ord(m))[2:] for m in
ifPhysAddress]).replace(' ', '0')
+ infotext += 'MAC: %s, ' % mac
# Check speed settings of interface, but only if speed information
# is available. This is not always the case.
diff --git a/modules/snmp.py b/modules/snmp.py
index 58c41ce..6ee6951 100644
--- a/modules/snmp.py
+++ b/modules/snmp.py
@@ -66,18 +66,6 @@ def convert_from_hex(value):
r += chr(int(hx, 16))
return r
-# Converts back the values converted by the snmp code of Check_MK.
-# e.g. In case of MAC addresses it is not ok to convert the value.
-# Though we need the original value back.
-def convert_to_hex(value):
- r = ''
- for c in value:
- h = hex(ord(c)).replace('0x', '')
- if len(h) == 1:
- h = '0' + h
- r += h + ' '
- return r + ' '
-
def oid_to_bin(oid):
return u"".join([ unichr(int(p)) for p in
oid.strip(".").split(".") ])