Ad Widget

Collapse

How to Strip an OID Suffix from a Discoved Item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • josoko
    Junior Member
    • Feb 2021
    • 25

    #1

    How to Strip an OID Suffix from a Discoved Item

    Hello

    I want to share my problem with discovery rules :-)

    Discovery Rule:
    - discovery[{#NQAVRFINSTANCE},1.3.6.1.4.1.25506.8.3.1.2.1.12]

    Summary:
    I can create discovered items if i am getting back one value per Index (red one is the index of the OID), OID is 1.3.6.1.4.1.25506.8.3.1.2.1.12:
    .1.3.6.1.4.1.25506.8.3.1.2.1.12.5.97.100.109.105.1 10.12.105.99.109.112.102.111.115.99.108.100.49.49 = STRING: "VRF-CLD"
    .1.3.6.1.4.1.25506.8.3.1.2.1.12.5.97.100.109.105.1 10.13.105.99.109.112.102.111.115.118.112.110.49.49 .49= STRING: "VRF-VPN1"
    .1.3.6.1.4.1.25506.8.3.1.2.1.12.5.97.100.109.105.1 10.13.105.99.109.112.105.110.116.101.114.110.101.1 16.49 = STRING: "VRF-SHARED"
    .1.3.6.1.4.1.25506.8.3.1.2.1.12.5.97.100.109.105.1 10.15.105.99.109.112.102.111.115.115.104.97.114.10 1.100.49.49 = STRING: "VRF-SHARED"
    .1.3.6.1.4.1.25506.8.3.1.2.1.12.5.97.100.109.105.1 10.17.105.99.109.112.102.111.115.105.110.116.101.1 14.110.101.116.49.49 = STRING: "VRF-INTERNET"
    .1.3.6.1.4.1.25506.8.3.1.2.1.12.5.97.100.109.105.1 10.19.105.99.109.112.99.112.101.95.49.57.50.46.49. 54.56.46.49.46.50 = STRING: "VRF-VPN1a"

    Problem, i am getting back a duplicated entry for another OID (additional suffix in OID => Blue) OID is 1.3.6.1.4.1.25506.8.3.1.11.1.3:
    .1.3.6.1.4.1.25506.8.3.1.11.1.3.5.97.100.109.105.1 10.12.105.99.109.112.102.111.115.99.108.100.49.49. 865 = Hex-STRING: 31 36 39 2E 32 35 34 2E 30 2E 36 00
    .1.3.6.1.4.1.25506.8.3.1.11.1.3.5.97.100.109.105.1 10.12.105.99.109.112.102.111.115.99.108.100.49.49. 866 = Hex-STRING: 31 36 39 2E 32 35 34 2E 30 2E 36 00
    .1.3.6.1.4.1.25506.8.3.1.11.1.3.5.97.100.109.105.1 10.13.105.99.109.112.102.111.115.118.112.110.49.49 .49.865 = Hex-STRING: 31 36 39 2E 32 35 34 2E 30 2E 32 00
    .1.3.6.1.4.1.25506.8.3.1.11.1.3.5.97.100.109.105.1 10.13.105.99.109.112.102.111.115.118.112.110.49.49 .49.866 = Hex-STRING: 31 36 39 2E 32 35 34 2E 30 2E 32 00
    .1.3.6.1.4.1.25506.8.3.1.11.1.3.5.97.100.109.105.1 10.13.105.99.109.112.105.110.116.101.114.110.101.1 16.49.865 = Hex-STRING: 38 2E 38 2E 38 2E 38 00
    .1.3.6.1.4.1.25506.8.3.1.11.1.3.5.97.100.109.105.1 10.13.105.99.109.112.105.110.116.101.114.110.101.1 16.49.866 = Hex-STRING: 38 2E 38 2E 38 2E 38 00
    .1.3.6.1.4.1.25506.8.3.1.11.1.3.5.97.100.109.105.1 10.15.105.99.109.112.102.111.115.115.104.97.114.10 1.100.49.49.865 = Hex-STRING: 31 36 39 2E 32 35 34 2E 30 2E 31 34 00
    .1.3.6.1.4.1.25506.8.3.1.11.1.3.5.97.100.109.105.1 10.15.105.99.109.112.102.111.115.115.104.97.114.10 1.100.49.49.866 = Hex-STRING: 31 36 39 2E 32 35 34 2E 30 2E 31 34 00
    .1.3.6.1.4.1.25506.8.3.1.11.1.3.5.97.100.109.105.1 10.17.105.99.109.112.102.111.115.105.110.116.101.1 14.110.101.116.49.49.865 = Hex-STRING: 31 36 39 2E 32 35 34 2E 30 2E 31 30 00
    .1.3.6.1.4.1.25506.8.3.1.11.1.3.5.97.100.109.105.1 10.17.105.99.109.112.102.111.115.105.110.116.101.1 14.110.101.116.49.49.866 = Hex-STRING: 31 36 39 2E 32 35 34 2E 30 2E 31 30 00
    .1.3.6.1.4.1.25506.8.3.1.11.1.3.5.97.100.109.105.1 10.19.105.99.109.112.99.112.101.95.49.57.50.46.49. 54.56.46.49.46.50.314 = Hex-STRING: 31 39 32 2E 31 36 38 2E 31 2E 32 00
    .1.3.6.1.4.1.25506.8.3.1.11.1.3.5.97.100.109.105.1 10.19.105.99.109.112.99.112.101.95.49.57.50.46.49. 54.56.46.49.46.50.315 = Hex-STRING: 31 39 32 2E 31 36 38 2E 31 2E 32 00

    That prevents me to create this discovery rule, because there have beeing returned two values with an additional suffix, e.g. .865, 866 :
    - discovery[{#NQAVRFINSTANCE},1.3.6.1.4.1.25506.8.3.1.2.1.12, {#NQAIPADDRESS}, 10.116.96.93 1.3.6.1.4.1.25506.8.3.1.11.1.3]

    Is there a way of how I can redirect just the first match into the {#NQAIPADDRESS} Macro in the discovery, or to strip/ignore the additional Suffix (865/866) from the Index (.1.3.6.1.4.1.25506.8.3.1.11.1.3.5.97.100.109.105. 1 10.12.105.99.109.112.102.111.115.99.108.100.49.49.) and add the return HEX Value of the first match into the Macro {#NQAIPADDRESS}?

    thx in advanced.
  • eithor
    Member
    • May 2020
    • 50

    #2
    Perhaps you could look into Javascript pre-processing on the discovery?

    Comment

    • josoko
      Junior Member
      • Feb 2021
      • 25

      #3
      Hello eithor,

      Thanks for the hint, but a preprocessing is not possible, because the values will be declaratet as "duplicated", and therefore no value will be available for a preprocessing.

      Comment

      • eithor
        Member
        • May 2020
        • 50

        #4
        What about removing the duplicate in the Javascript code?

        Comment

        • josoko
          Junior Member
          • Feb 2021
          • 25

          #5
          In the preprocessing it's not possible. Is there an other option possible where I could try to strip strings from the snmp return, befor they arrive in the Zabbix Item?

          Comment

          • eithor
            Member
            • May 2020
            • 50

            #6
            According to this related ticket (for replacing hex codes in snmp discovery) it should work to use the correct Javascript pre-process, see the examples in the comments there: https://support.zabbix.com/browse/ZBXNEXT-505

            Comment

            Working...