Ad Widget

Collapse

Item Prototype Name with OID-ending (Regex)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dr. Doofenshmirtz
    Junior Member
    • Jul 2023
    • 2

    #1

    Item Prototype Name with OID-ending (Regex)


    Hello,

    I'm currently facing a problem regarding the name of an item prototype.
    I use Regex to make the name more meaningful.

    I want to monitor the chassis temperature of a switch-stack with the following OID: 1.3.6.1.4.1.11.2.14.11.1.2.8.1.1.3 (hpSystemAirCurrentTemp)
    If i execute an SNMP Walk on a device with the mentioned OID I get the following output:
    • HP-ICF-CHASSIS::hpSystemAirCurrentTemp.0 = STRING: "36C"
    • HP-ICF-CHASSIS::hpSystemAirCurrentTemp.1 = STRING: "37C"
    • HP-ICF-CHASSIS::hpSystemAirCurrentTemp.2 = STRING: "36C"

    The three values stand for each slot/unit.

    Now I want to use the .0, .1, .2 as indicators of the slot/unit in the item name
    The problem is, that ".0" is actually unit 1 and ".1" is unit 2 and so on.

    Is there a possible way to display it correctly?
    I would need to add 1 to every number but with Regex calculations are not possible (as far as I know).

    It should look something like this:
    • Unit 1 = 36C
    • Unit 2 = 37C
    • Unit 3 = 36C

    Thanks in advance for any assistance!​

  • ISiroshtan
    Senior Member
    • Nov 2019
    • 324

    #2
    Sadly, can not really think of easy way to achive what you ask on item level. But... it seems that good guys from HP thought about your case and have the solution in place. Same mib file you referencing contains the following OID:

    Code:
    hpSystemAirName OBJECT-TYPE
    SYNTAX OCTET STRING(SIZE(1..20))
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION "This object describes name of the system
    which is chassis attached temperature sensor
    number. For example if the index
    (hpSystemAirSensor) is '0' then the system
    name is sys-1. Index starts from '0' but
    sensor number is '1'."​
    This allows you to setup SNMP discovery, set the discovery macro (for example) {#NAME} as value of HP-ICF-CHASSIS::hpSystemAirName (dont actually remember if it accepts text name, or if you would need to translate it into proper numeric OID when configuring discovery) and then use the {#NAME} macro in item&trigger prototypes name.

    Comment

    Working...