Ad Widget

Collapse

Item preprocessing and hex to decimal conversion for IP's

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Linwood
    Senior Member
    • Dec 2013
    • 398

    #1

    Item preprocessing and hex to decimal conversion for IP's

    Cisco commonly returns IP addresses as hex strings, so "AC 14 16 01" is being returned fro9m a RTT mib for target address.

    Historically I've then done the discovery and/or polling in an external script, which is a lot of overhead, and I thought that the new preprocessing would deal with this.

    But I can't find a path through using regex and/or other operations to turn this into an IP address.

    Is that beyond the scope of what preprocessing can do?

    PS. Even if not, the preprocessing steps are very nice, and a welcome addition.
  • recursio
    Junior Member
    • Dec 2022
    • 1

    #2
    for anyone looking for a solution here, like me:

    You can set up a "javascript" PreProcessing step at item level

    Code:
    const h = value.split(" ");
    return ""+parseInt(h[0],16)+"."+parseInt(h[1],16)+"."+parseInt(h[2],16)+"."+parseInt(h[3],16);​

    Comment

    • Tex74
      Junior Member
      • Dec 2021
      • 22

      #3
      Made this little modification to make it work on my zabbix 5

      Code:
      Code:
      const h = value.split(" ");
      return parseInt(h[0],16)+"."+parseInt(h[1],16)+"."+parseInt(h[2],16)+"."+parseInt(h[3],16);

      Comment

      Working...