Ad Widget

Collapse

SNMP Hex String to IP Address

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zubrag
    Junior Member
    • Jul 2015
    • 20

    #1

    SNMP Hex String to IP Address

    Hi All.
    I create discovery rule for search cisco ip tunnels.
    CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecTunRemoteAddr - it`s ok.
    I create Item ptototype with name Tunnel [{#SNMPVALUE}].
    But cipSecTunRemoteAddr return Hex-STRING like "0A 0A 0A 0A".
    How can I convert hex string to ip address in zabbix?
  • zubrag
    Junior Member
    • Jul 2015
    • 20

    #2
    Solved: SNMP Hex String to IP Address

    I had wrote an external python script for discovery and it return some macroses for my needs.

    Comment

    • maplesyrupghost
      Member
      • Jul 2012
      • 37

      #3
      Originally posted by zubrag
      I had wrote an external python script for discovery and it return some macroses for my needs.
      please share the script i would greatly appreciate it as I imagine others. does anyone know how to do this without an external script?

      Comment

      • zubrag
        Junior Member
        • Jul 2015
        • 20

        #4
        File name is zIpSecDiscovery.py
        More than a half size is arguments' parsing.
        You need run this script without any arguments for get help message.
        For translate from IP address to hostname I wrote all our peers in /etc/hosts file.
        I think it will also work with DNS.

        If You have any questions I'll be glad answer them.
        Attached Files

        Comment


        • rbrathen
          rbrathen commented
          Editing a comment
          Hi zubrag,

          I know this is an old post, but I have a question about your script. I'm not able to retrieve the {#ZINDEX} value, which I believe would be the equivalent of the {#SNMPINDEX}

          For example I retrieve the following values, with the {#ZINDEX} returning a blank value:

          {"data": [{"{#ZVALUE}": "xxx.xxx.xxx.xxx", "{#ZHOSTNAME}": "xxx-xxx-xxx-xxx.northland.net", "{#ZINDEX}": "", "{#ZOID}": "enterprises.9.9.171.1.3.2.1.5.6120", "{#ZTYPE}": "OCTETSTR"}

          Any ideas?
      • maplesyrupghost
        Member
        • Jul 2012
        • 37

        #5
        thank you sir

        Comment

        • maplesyrupghost
          Member
          • Jul 2012
          • 37

          #6
          I did actually find a solution yesterday (in PHP) though and while not nearly as elegant (or perhaps proper) as yours I figured I would share it.

          I just set it as an external check and fed it the IP address I wanted and it converted it and zabbix stored it as the converted IP. Short but sweet. Maybe others will find it useful.
          Attached Files
          Last edited by maplesyrupghost; 22-03-2016, 18:47.

          Comment

          Working...