Ad Widget

Collapse

How to get this snmp value?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kenlok
    Junior Member
    • Mar 2013
    • 2

    #1

    How to get this snmp value?

    IP-MIB::ipAdEntAddr.161.33.46.73 = IpAddress: 161.33.46.73
    IP-MIB::ipAdEntAddr.192.168.10.254 = IpAddress: 192.168.10.254
    IP-MIB::ipAdEntAddr.192.168.55.254 = IpAddress: 192.168.55.254

    161.33.46.73 is a dynamic wan IP.
    How can I get this value in zabbix?

    Thanks
  • lukeiam
    Member
    • Sep 2012
    • 38

    #2
    I am looking into that as well. The issue is with the snmpget.

    Is there anyway in Zabbix to use snmpgetnext?

    Example:

    snmpget -On x.x.x.x -c public -v 2c .1.3.6.1.2.1.4.20.1
    .1.3.6.1.2.1.4.20.1 = No Such Object available on this agent at this OID

    AND:

    snmpgetnext -On x.x.x.x -c public -v 2c .1.3.6.1.2.1.4.20.1
    .1.3.6.1.2.1.4.20.1.1.x.x.x.x = IpAddress: x.x.x.x

    Ideas?

    Regards,

    Luke

    Comment

    • lukeiam
      Member
      • Sep 2012
      • 38

      #3
      So this is so far what I tested:

      snmpwalk returns:

      IP-MIB::ipAdEntAddr.x.x.x.x = IpAddress: x.x.x.x

      I was reading:


      So I tried:

      IP-MIB::ipAdEntAddr["index","IP-MIB::ipAdEntAddr","IpAddress"]

      However, I get NOT FOUND error.



      Regards,

      Luke

      Comment

      • kenlok
        Junior Member
        • Mar 2013
        • 2

        #4
        I create a shell script to get the value
        It will return the WAN IP

        ######################################
        #!/bin/bash

        qq=$(/usr/bin/snmpwalk -v 2c -c public $1 ipAdEntAddr | awk -F" " '{print $4}')
        arr=$(echo $qq | tr " " "\n")

        for x in $arr
        do
        FirstIp=$(echo ${x:0:3})
        if [ "$FirstIp" -ne "192" ]
        then
        echo $x
        fi
        done

        ######################################

        Comment

        • lukeiam
          Member
          • Sep 2012
          • 38

          #5
          Thanks for the post! I was thinking to write a script too, but that's only a workaround.

          Does anyone know why this returns not found error:
          IP-MIB::ipAdEntAddr["index","IP-MIB::ipAdEntAddr","IpAddress"]

          As per the guide below, it should be working.


          Regards,

          Luke

          Comment

          • lukeiam
            Member
            • Sep 2012
            • 38

            #6
            Can anyone tell me if it is a bug?

            As per:


            snmpwalk returns:

            snmpwalk -v 2c -c public x.x.x.x ipAdEntAddr
            IP-MIB::ipAdEntAddr.x.x.x.x = IpAddress: x.x.x.x
            IP-MIB::ipAdEntAddr.x.x.x.x = IpAddress: x.x.x.x
            IP-MIB::ipAdEntAddr.x.x.x.x = IpAddress: x.x.x.x
            IP-MIB::ipAdEntAddr.x.x.x.x = IpAddress: x.x.x.x

            The first entry should be found and used.

            Anyone?

            Regards,

            Luke

            Comment

            • lukeiam
              Member
              • Sep 2012
              • 38

              #7
              Now I am sure this is a bug with Zabbix. Unfortunately I do not know how to re-open that bug or get more visibility on it.

              Thanks for the bash script. My workaround is a little different:

              In zabbix_agentd.conf I added:

              UserParameter=public.ip,snmpwalk -v 2c -c public -On 192.168.1.1 ipAdEntAddr | grep -v "IpAddress: 127" | grep -v "IpAddress: 169" | grep -v "IpAddress: 192" | awk '{print $4}'

              I created an item in zabbix and trigger for it which flags if the IP changes.

              Regards,

              Luke

              Comment

              Working...