Ad Widget

Collapse

Discover Item based on SNMP OID

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ErwannDR
    Junior Member
    • Dec 2021
    • 4

    #1

    Discover Item based on SNMP OID

    Hi all,
    I am a newbie in Zabbix. For a project I need to discover automatically some hosts, using SNMP, and attach some items/triggers on it.
    I created a rule R1, which create hosts based on host prototype H, linked to a template T. The result of snmpwalk is:
    [root@localhost mibbrowser]# snmpwalk -v 2c -c private localhost .1.3.6.1.4.1.34007.1.1.1.1.2.1.1.1
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.1.6.82.69.67. 48.48.49 = STRING: "REC001"
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.1.6.82.69.67. 48.48.50 = STRING: "REC002"
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.1.6.82.69.67. 48.48.51 = STRING: "REC003"
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.1.6.82.69.67. 48.48.52 = STRING: "REC004"
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.1.6.82.69.67. 48.48.53 = STRING: "REC005"
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.1.6.82.69.67. 48.48.54 = STRING: "REC006"
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.1.7.67.80.66. 95.48.48.49 = STRING: "CPB_001"
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.1.7.67.80.66. 95.48.50.48 = STRING: "CPB_020"
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.1.7.67.80.66. 95.48.51.48 = STRING: "CPB_030"

    Each host are well created, name is complete with {#SNMPVALUE}.
    Now, I need to add an item to monitor a value, which is obtains in:
    [root@localhost mibbrowser]# snmpwalk -v 2c -c private localhost .1.3.6.1.4.1.34007.1.1.1.1.2.1.1.3
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.3.6.82.69.67. 48.48.49 = INTEGER: 2
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.3.6.82.69.67. 48.48.50 = INTEGER: 3
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.3.6.82.69.67. 48.48.51 = INTEGER: 3
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.3.6.82.69.67. 48.48.52 = INTEGER: 3
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.3.6.82.69.67. 48.48.53 = INTEGER: 3
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.3.6.82.69.67. 48.48.54 = INTEGER: 3
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.3.7.67.80.66. 95.48.48.49 = INTEGER: 3
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.3.7.67.80.66. 95.48.50.48 = INTEGER: 3
    SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.3.7.67.80.66. 95.48.51.48 = INTEGER: 3

    And here things become complicated... I tried two things, with different issues:
    1. in template T, I added an item, which SNMP OID= SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.3.{#SNMPINDEX }. Host has this item created, but can not parse oid, because {#SNMPINDEX} is not interpreted as a macro. I did found a way to store {#SNMPINDEX} in a macro to reuse it in the template.Click image for larger version

Name:	2021-12-17_11h31_42.png
Views:	900
Size:	36.6 KB
ID:	436706
    2. in template T, I added a new discovery rule R2, which create item with the same oid that in case 1.. In this case, things are more correct, but an issue is present: by doing this, discovered host as 9 items: the 9 results of snmpwalk. What I wanted was just add the item located in SNMPv2-SMI::enterprises.34007.1.1.1.1.2.1.1.1.6.82.69.67. 48.48.49Click image for larger version

Name:	2021-12-17_11h26_04.png
Views:	852
Size:	162.2 KB
ID:	436707
    Any help would be appreciated to go forward. An idea too :-)
    Regards,
    ErwannDR
    Attached Files
  • ozzy
    Junior Member
    • Dec 2021
    • 2

    #2

    I don't know if I understand what the problem is.
    But when I create a template, I first create discovery rules where in SNMP OID I add like discovery[{#SOMENAME}, SNMPv2-SMI :: enterprises.34007.1.1.1.2.1.1.3.6] Next I create prototype items where a add in SNMP OID: SNMPv2-SMI :: enterprises.34007.1.1.1.1.2.1.1.3.6. {#SOMENAME}
    And theoretically, it should work.

    Comment

    Working...