Ad Widget

Collapse

Substring of SNMP Index during Discovery Rule

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sb195c@att.com
    Member
    • Oct 2017
    • 41

    #1

    Substring of SNMP Index during Discovery Rule

    Is there a way to get a substring of the SNMP index returned by a discovery Rule?

    I'm getting some temp sensor data from the ENTITY-SENSORS-MIB for my devices, and the 3rd digit of the SNMP Index tells me what line card the sensor is on.

    I wanted to then create an item prototype with Name to include that value.

    Ex. walking the MIB i get something like this, which tells me this is for Linecard 1
    Name/OID: entPhysicalDescr.101006009; Value (OctetString): Front sensor

    I wanted to then create an Item name like "#1 - Front sensor" from the index returned to {#SNMPVALUE}.
  • kaspars.mednis
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2017
    • 349

    #2
    Hello !

    Which version of zabbix are you using ?
    Starting from 3.4 there is very powerfull feature called preprocessing



    You can try to write a regexp for this

    Regards,
    Kaspars

    Comment

    • Pitons
      Member
      • Oct 2017
      • 49

      #3
      There should be an index for the cards, create discovery rule based on that index, then create item prototype and in use your defined macro, something like this: OID: 1.1.2.[#MACRO].1.2

      Paste the output of snmpwalk and attach the mib, will try to help.

      Comment

      • sb195c@att.com
        Member
        • Oct 2017
        • 41

        #4
        Zabbix 3.4 on Ubuntu 16.04

        snmpwalk -v 2c -c $comm -On $ip .1.3.6.1.2.1.47.1.1.1.1.2 | grep -E "Front external sensor|Rear external sensor|Inlet sensor|Front sensor|Rear sensor"

        .1.3.6.1.2.1.47.1.1.1.1.2.101006008 = STRING: "Rear sensor"
        .1.3.6.1.2.1.47.1.1.1.1.2.101006009 = STRING: "Front sensor"
        .1.3.6.1.2.1.47.1.1.1.1.2.103006001 = STRING: "Inlet sensor"
        .1.3.6.1.2.1.47.1.1.1.1.2.104006001 = STRING: "Inlet sensor"
        .1.3.6.1.2.1.47.1.1.1.1.2.105006005 = STRING: "Inlet sensor"
        .1.3.6.1.2.1.47.1.1.1.1.2.106006001 = STRING: "Inlet sensor"

        So my discovery rule has the regexp above on the ENTITY-SENSOR-MIB, which I'm setting {#SENSORNAME}. This is for an Arista switch, where they put the slot #of the card for the sensor as the 3rd digit in the index...so this example has sensors on slots 1, 3, 4, 5, 6.
        What I wanted to do is somehow do a substr against the #SNMPINDEX into say a macro like {#SLOTNUM} so in my item prototype I can use it as the part of the key, and the name like "Temp sensor {#SENSORNAME} - Slot {#SLOTNUM}".

        Comment

        • sb195c@att.com
          Member
          • Oct 2017
          • 41

          #5
          I couldn't find a solution to this using Zabbix LLD , so instead went the route of creating a LLD script that handles this and passes back to the discovery rule.

          Comment

          • Colttt
            Senior Member
            Zabbix Certified Specialist
            • Mar 2009
            • 878

            #6
            Hello sb195c,

            it would be very nice if you can provide more informations and help (zabbix) to create a template pack: https://github.com/v-zhuravlev/zbx_t...ONTRIBUTING.md
            Debian-User

            Sorry for my bad english

            Comment

            Working...