Ad Widget

Collapse

Low Level Discovery - Interface IP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • un tecnico mas
    Junior Member
    • Apr 2022
    • 10

    #1

    Low Level Discovery - Interface IP

    Hi, I'm new to Zabbix

    I need to discover the interfaces that contain ip (among other things) and discard the others.

    To get the ip of the interfaces I use the OID .1.3.6.1.2.1.4.20.1.2 ,but I change the {#SNMPINDEX}.

    OIDs I want to get:

    discovery[
    {#IFOPERSTATUS},1.3.6.1.2.1.2.2.1.8,
    {#IFADMINSTATUS},1.3.6.1.2.1.2.2.1.7,
    {#IFALIAS},1.3.6.1.2.1.31.1.1.1.18,
    {#IFNAME},1.3.6.1.2.1.31.1.1.1.1,
    {#IFDESCR},1.3.6.1.2.1.2.2.1.2,
    {#IFTYPE},1.3.6.1.2.1.2.2.1.3,
    {#IFIP},1.3.6.1.2.1.4.20.1.2,
    {#IFTRUNK},1.3.6.1.4.1.9.9.46.1.6.1.1.14
    ]

    data I get (made-up IPs):

    [
    {
    "{#SNMPINDEX}":"1",
    "{#IFOPERSTATUS}":"1",
    "{#IFADM INSTATUS}":"1",
    "{#IFALIAS}":"",
    "{#IFNAME}":"Gi0/0",
    "{#IFDESCR}":"GigabitEthernet0/0",
    "{#IFTYPE}":"6"
    },
    {
    "{#SNMPINDEX}":"2",
    "{#IFOPERS TATUS}":"1",
    "{#IFADMINSTATUS}":"1",
    "{#IFALIAS}":"a sdas MONITOR_SI asadas",
    "{#IFNAME}":"Gi0/1",
    "{#IFDESCR}":"GigabitEthernet0/1",
    "{#IFTYPE}":"6"
    },
    {
    "{#SNMPINDEX}":"3",
    "{#IFOPERS TATUS}":"1",
    "{#IFADMINSTATUS}":"1",
    "{#IFALIAS}":"" ,
    "{#IFNAME}":"Gi0/2",
    "{#IFDESCR}":"GigabitEthernet0/2",
    "{#IFTYPE}":"6"
    },
    {
    "{#SNMPINDEX}":"4",
    "{#IFOPERS TATUS}":"1",
    "{#IFADMINSTATUS}":"1",
    "{#IFALIAS}":"" ,
    "{#IFNAME}":"Gi0/3",
    "{#IFDESCR}":"GigabitEthernet0/3",
    "{#IFTYPE}":"6"
    },
    {
    "{#SNMPINDEX}":"5",
    "{#IFOPERS TATUS}":"1",
    "{#IFADMINSTATUS}":"1",
    "{#IFALIAS}":"" ,
    "{#IFNAME}":"Nu0",
    "{#IFDESCR}":"Null0",
    "{#IFTYPE} ":"1"
    },
    {
    "{#SNMPINDEX}":"6",
    "{#IFOPERSTATUS}":"1",
    " {#IFADMINSTATUS}":"1",
    "{#IFALIAS}":"Monit_no",
    "{#I FNAME}":"Lo0",
    "{#IFDESCR}":"Loopback0",
    "{#IFTYPE}" :"24"
    },
    {
    "{#SNMPINDEX}":"2.2.2.2", <------------- IP
    "{#IFIP}":"6" <------------- SNMPINDEX
    },
    {
    "{#SNMPINDEX}":"11.11.11.11", <------------- IP
    "{#IFIP}":"3" <------------- SNMPINDEX
    },
    {
    "{#SNM PINDEX}":"192.168.200.213", <------------- IP
    "{#IFIP}":"2" <------------- SNMPINDEX
    },
    {
    "{#SNMP INDEX}":"219.121.126.81", <------------- IP
    "{#IFIP}":"1" <------------- SNMPINDEX
    }
    ]

    can you help me, please.
    best regards
  • max.
    Member
    Zabbix Certified Specialist
    • Apr 2022
    • 40

    #2
    Hello,

    Take a look at the documentation for this: https://www.zabbix.com/documentation...evel_discovery
    You could create an LLD Filter and evaluate the IFIP macro with a regular expression.


    Regards

    Comment

    • un tecnico mas
      Junior Member
      • Apr 2022
      • 10

      #3
      I don't understand how I could create a filter in this case, my idea was to create a new {#IFIP} variable in the right {#SNMPINDEX}.

      Move from this:

      {
      "{#SNMPINDEX}":"6",
      "{#IFOPERSTATUS}":"1",
      " {#IFADMINSTATUS}":"1",
      "{#IFALIAS}":"Monit_no",
      "{#I FNAME}":"Lo0",
      "{#IFDESCR}":"Loopback0",
      "{#IFTYPE}" :"24"
      },
      {
      "{#SNMPINDEX}":"2.2.2.2", <------------- IP
      "{#IFIP}":"6" <------------- SNMPINDEX
      },


      To this:

      {
      "{#SNMPINDEX}":"6",
      "{#IFOPERSTATUS}":"1",
      " {#IFADMINSTATUS}":"1",
      "{#IFALIAS}":"Monit_no",
      "{#I FNAME}":"Lo0",
      "{#IFDESCR}":"Loopback0",
      "{#IFTYPE}" :"24",
      "{#IFIP}":"2.2.2.2" <----------------- IP
      }

      Comment

      • max.
        Member
        Zabbix Certified Specialist
        • Apr 2022
        • 40

        #4
        Hello,

        Can you share snmpwalk example output of your device for the specified OIDs ?

        Thank you

        Comment

        • un tecnico mas
          Junior Member
          • Apr 2022
          • 10

          #5
          SNMPWALK OIDs

          {#IFOPERSTATUS} --> 1.3.6.1.2.1.2.2.1.8
          Code:
          [root@zbxsrv01 ~]# snmpwalk -v2c -c sesamo 192.168.100.100 1.3.6.1.2.1.2.2.1.8
          IF-MIB::ifOperStatus.1 = INTEGER: up(1)
          IF-MIB::ifOperStatus.2 = INTEGER: up(1)
          IF-MIB::ifOperStatus.3 = INTEGER: up(1)
          IF-MIB::ifOperStatus.4 = INTEGER: up(1)
          IF-MIB::ifOperStatus.5 = INTEGER: up(1)
          IF-MIB::ifOperStatus.6 = INTEGER: up(1)
          {#IFADMINSTATUS} --> 1.3.6.1.2.1.2.2.1.7
          Code:
          snmpwalk -v2c -c sesamo 192.168.100.100 1.3.6.1.2.1.2.2.1.7
          IF-MIB::ifAdminStatus.1 = INTEGER: up(1)
          IF-MIB::ifAdminStatus.2 = INTEGER: up(1)
          IF-MIB::ifAdminStatus.3 = INTEGER: up(1)
          IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
          IF-MIB::ifAdminStatus.5 = INTEGER: up(1)
          IF-MIB::ifAdminStatus.6 = INTEGER: up(1)
          {#IFALIAS} --> 1.3.6.1.2.1.31.1.1.1.18
          Code:
          [root@zbxsrv01 ~]# snmpwalk -v2c -c sesamo 192.168.100.100 1.3.6.1.2.1.31.1.1.1.18
          IF-MIB::ifAlias.1 = STRING:
          IF-MIB::ifAlias.2 = STRING: asdas MONITOR_SI asadas
          IF-MIB::ifAlias.3 = STRING:
          IF-MIB::ifAlias.4 = STRING:
          IF-MIB::ifAlias.5 = STRING:
          IF-MIB::ifAlias.6 = STRING: Monit_no
          {#IFNAME} --> 1.3.6.1.2.1.31.1.1.1.1
          Code:
          [root@zbxsrv01 ~]# snmpwalk -v2c -c sesamo 192.168.100.100 1.3.6.1.2.1.31.1.1.1.1
          IF-MIB::ifName.1 = STRING: Gi0/0
          IF-MIB::ifName.2 = STRING: Gi0/1
          IF-MIB::ifName.3 = STRING: Gi0/2
          IF-MIB::ifName.4 = STRING: Gi0/3
          IF-MIB::ifName.5 = STRING: Nu0
          IF-MIB::ifName.6 = STRING: Lo0
          {#IFDESCR} --> 1.3.6.1.2.1.2.2.1.2
          Code:
          [root@zbxsrv01 ~]# snmpwalk -v2c -c sesamo 192.168.100.100 1.3.6.1.2.1.2.2.1.2
          IF-MIB::ifDescr.1 = STRING: GigabitEthernet0/0
          IF-MIB::ifDescr.2 = STRING: GigabitEthernet0/1
          IF-MIB::ifDescr.3 = STRING: GigabitEthernet0/2
          IF-MIB::ifDescr.4 = STRING: GigabitEthernet0/3
          IF-MIB::ifDescr.5 = STRING: Null0
          IF-MIB::ifDescr.6 = STRING: Loopback0
          {#IFTYPE} --> 1.3.6.1.2.1.2.2.1.3
          Code:
          [root@zbxsrv01 ~]# snmpwalk -v2c -c sesamo 192.168.100.100 1.3.6.1.2.1.2.2.1.3
          IF-MIB::ifType.1 = INTEGER: ethernetCsmacd(6)
          IF-MIB::ifType.2 = INTEGER: ethernetCsmacd(6)
          IF-MIB::ifType.3 = INTEGER: ethernetCsmacd(6)
          IF-MIB::ifType.4 = INTEGER: ethernetCsmacd(6)
          IF-MIB::ifType.5 = INTEGER: other(1)
          IF-MIB::ifType.6 = INTEGER: softwareLoopback(24)
          {#IFIP} --> 1.3.6.1.2.1.4.20.1.1
          Code:
          [root@zbxsrv01 ~]# snmpwalk -v2c -c sesamo 192.168.100.100 1.3.6.1.2.1.4.20.1.1
          IP-MIB::ipAdEntAddr.2.2.2.2 = IpAddress: 2.2.2.2
          IP-MIB::ipAdEntAddr.11.11.11.11 = IpAddress: 11.11.11.11
          IP-MIB::ipAdEntAddr.192.168.100.100 = IpAddress: 192.168.100.100
          IP-MIB::ipAdEntAddr.217.111.176.81 = IpAddress: 217.111.176.81

          The problem is in the IP-MIB::ipAdEntAddr OID index.
          As they are not the same index, zabbix does not group them.

          Comment

          • max.
            Member
            Zabbix Certified Specialist
            • Apr 2022
            • 40

            #6
            Hello,

            Try to create a discovery with the OID: discovery[{#INT}, ipAdEntIfIndex]

            Then you create prototype items using the discovered interface index.
            For example item prototype for operational status:
            IF-MIB::ifOperStatus.{#INT}

            Let me know if this works for you
            Regards

            Comment

            • cyber
              Senior Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • Dec 2006
              • 4806

              #7
              You need only those IF-s where #IFIP exists? Then just add filter to discovery
              "{#IFIP} exists"
              Others will be ignored...

              Comment


              • max.
                max. commented
                Editing a comment
                Hello cyber, the problem is that the ip address is a different object for the device and the only association is in the ip address object, not the interface.
                So when he adds the IP OID to the discovery it comes separated from the rest of the properties.

                Thats why filter did not work.
                Istead if he does the discovery of the ip address object, then there is a property ipAdEntIfIndex that matches it with the corresponding interface index
            • cyber
              Senior Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • Dec 2006
              • 4806

              #8
              right... I did not concentrate enough on the issue..
              SNMP is evil, as usual..

              Comment

              • un tecnico mas
                Junior Member
                • Apr 2022
                • 10

                #9
                Originally posted by max.
                Hello,

                Try to create a discovery with the OID: discovery[{#INT}, ipAdEntIfIndex]

                Then you create prototype items using the discovered interface index.
                For example item prototype for operational status:
                IF-MIB::ifOperStatus.{#INT}

                Let me know if this works for you
                Regards
                I have tried to recreate your solution, but I have not been able to get it to work.
                I created a new discovery and tried to create a new item as described in your solution. When testing, zabbix returns "ERROR when parsing the OID".
                What key do I have to use when creating the item?

                I remember that in addition to the IP I have to retrieve the rest of the information from the host.

                Comment

                • max.
                  Member
                  Zabbix Certified Specialist
                  • Apr 2022
                  • 40

                  #10
                  Ok, lets make sure the discovery works first.

                  Try this configuration:
                  Key: ifIndex
                  SNMP OID: discovery[{#INT},IP-MIB::ipAdEntIfIndex]

                  Test and it should return the same result of running the snmpwalk:
                  snmpwalk -v 2c -c COMMUNITY IPADDRESS IP-MIB::ipAdEntIfIndex

                  Comment

                  • un tecnico mas
                    Junior Member
                    • Apr 2022
                    • 10

                    #11
                    ok, I will recreate all the steps to see where my mistake is.

                    1. Create a new discovery rule

                    Click image for larger version

Name:	Discovery_rules.png
Views:	2324
Size:	38.8 KB
ID:	443960

                    2. Server test
                    Click image for larger version

Name:	server_test.png
Views:	2291
Size:	12.4 KB
ID:	443961

                    3. Zabbix test
                    Click image for larger version

Name:	zabbix_test.png
Views:	2327
Size:	40.6 KB
ID:	443962

                    Result:
                    Code:
                    [
                     {
                      "{#SNMPINDEX}":"2.2.2.2",
                      "{#INT}":"6"
                     },
                     {
                      "{#SNMPINDEX}":"11.11.11.11",
                      "{#INT}":"3"
                     },
                     {
                      "{#SNMPINDEX}":"192.168.100.100",
                      "{#INT}":"2"
                     },
                     {
                      "{#SNMPINDEX}":"217.111.176.81",
                      "{#INT}":"1"
                     }
                    ]

                    Comment

                    • max.
                      Member
                      Zabbix Certified Specialist
                      • Apr 2022
                      • 40

                      #12
                      So far so good.

                      Now generate Item prototype and execute the discovery

                      Name: Operational status {#SNMPINDEX}
                      Type: SNMP Agent
                      Key: ifOperStatus[{#INT}]
                      OID: IF-MIB::ifOperStatus.{#INT}

                      Comment

                      • un tecnico mas
                        Junior Member
                        • Apr 2022
                        • 10

                        #13
                        I created a new item prototype as you said, but it didn't work.
                        • Item prototype
                        Click image for larger version

Name:	Captura1.png
Views:	2306
Size:	49.8 KB
ID:	444132
                        • Test
                        Click image for larger version

Name:	Captura2.png
Views:	2318
Size:	30.1 KB
ID:	444133

                        ​​​​​​​I am very confused about this issue

                        Comment

                        • max.
                          Member
                          Zabbix Certified Specialist
                          • Apr 2022
                          • 40

                          #14
                          Hello, sorry i did not answer.

                          Do not try to test the item prototype, perform the test operation in the discovery object.
                          It should work now

                          Regards

                          Comment

                          • un tecnico mas
                            Junior Member
                            • Apr 2022
                            • 10

                            #15
                            Hi, I have managed to create the items for the ips, but that is not what I need.

                            Click image for larger version

Name:	2022-06-03 15_50_11-Window.png
Views:	2256
Size:	26.0 KB
ID:	445591

                            So I can't retrieve more information about the interfaces, as it doesn't group them well.
                            How can I collect the name, description of these interfaces? I need to filter the discovered interfaces, I have to discover the ones that have IP, trunk or have MONIT_SI in the description.

                            Comment

                            Working...