Ad Widget

Collapse

Create SNMP items for every interface upto a number.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Adam Laycock
    Junior Member
    • Jan 2023
    • 1

    #1

    Create SNMP items for every interface upto a number.

    I'm trying to make a general template for all our switches.

    I've found that I can query 1.3.6.1.2.1.2.1.0 and get the number of interfaces on the switch. What I'm struggling to find is that if that returns say 48 how do I create items for 1 to 48.

    Using Port 1 I'd like to take the name from 1.3.6.1.2.1.2.2.1.2.1 and use it in descriptions, 1.3.6.1.2.1.2.2.1.5.1 for its link speed, 1.3.6.1.2.1.2.2.1.8.1 for its link state and so on.

    I'd love to get it working with a dynamic number of interfaces so it can track VLAN interfaces etc...
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    Read the documentation - there are a lot of interesting things there. I think this is exactly what you need.

    Comment

    • fvilarnovo
      Junior Member
      • Jan 2023
      • 17

      #3
      You could also copy the current logic from other templates. For example, any template that includes an snmp discovery rule like "Network interfaces discovery", will have the dynamic index as explained by hamardaban. Basically, you assign a macro to the snmp tree that you would like to "scan". Then you can use that reference on an item prototype. For example:

      name: Interface {#IFNAME}({#IFALIAS}): Operational status

      key: net.if.status[{#SNMPINDEX}]

      snmpOID: 1.3.6.1.2.1.2.2.1.8.{#SNMPINDEX} <--- as you can see, the index will be iterated for each interface. This could apply to any index.

      Hope it helps.

      Comment

      Working...