Collection of CheckMK checks (see https://checkmk.com/). All checks and plugins are provided as is. Absolutely no warranty. Send any comments to thl-cmk[at]outlook[dot]com

Skip to content
Snippets Groups Projects
Commit 3f0a6779 authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

update project

parent 183730eb
No related branches found
No related tags found
No related merge requests found
......@@ -59,7 +59,12 @@ def parse_inv_cdp_cache(string_table: List[StringTable]):
return names.get(st, st)
def render_ip_address(bytestring):
return '.'.join(['%s' % ord(m) for m in bytestring])
if len(bytestring) == 14: # "0A 0D FC 15 " -> some Nexus
bytestring = bytestring.strip('"').strip(' ').split(' ')
if len(bytestring) == 4:
return '.'.join(['%s' % int(m, 16) for m in bytestring])
else:
return '.'.join(['%s' % ord(m) for m in bytestring])
def render_mac_address(bytestring):
return ':'.join(['%02s' % hex(ord(m))[2:] for m in bytestring]).replace(' ', '0').upper()
......@@ -152,7 +157,7 @@ def parse_inv_cdp_cache(string_table: List[StringTable]):
cdplastchange = time.strftime('%c', time.localtime(time.time() - (int(cdplastchange) / 100)))
if len(cdpdeviceid) == 6:
# if cdpdeviceid contains 'illegal' signs try to treat as mac address
# if cdpdeviceid contains 'illegal' chars try to treat as mac address
# remove all chars from string, except allowedchars
allowedchars = re.compile('[^a-zA-Z0-9_=\-\+\.\\\]')
cleandeviceid = allowedchars.sub('', cdpdeviceid).strip()
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment