Forum Discussion
7 years ago
So I know this is an old thread, and the above community locator isn't really needed now that the EIGRP peers datasource is in the LM repo.... but I thought I'd post here in case someone else hit a similar issue and wanted a fix.
The built-in groovy discovery script was using HEX addresses for the peer addresses in our instances, and it was a pain to decipher them every time one went down. So I added a hex-to-decimal conversion to the discovery script so that he instance names look like "172.20.0.50" instead of "AC:14:00:32"
Here is the updated block of the discovery script
// get all IP addresses of connected peers. peerAddr_walk.eachLine { line -> regex_pattern = "(${peerAddr_OID})" + /.(.*)\s=\s(.*)/; regex_match = ~regex_pattern line_match = regex_match.matcher(line) handle = line_match[0][2] val = line_match[0][3] //val here may be SNMP data in format of "Hex-STRING: AC 14 00 32" and arrive as AC:14:00:32 instead of an ip address in the instance name if (val.contains(":")) { tempaddr = val.split(":") def newaddr = [] tempaddr.each { hexint -> newaddr.add(Integer.parseInt(hexint, 16)) } val = newaddr.join(".") }
Hope it helps someone else
Related Content
- 8 months ago
- 2 years ago
- 5 months ago