Zabbix Documentation 4.0

2.23.04.0 (current)In development:4.2 (devel)Unsupported:1.82.02.43.23.4

User Tools

Site Tools


manual:discovery:low_level_discovery:snmp_oids

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
manual:discovery:low_level_discovery:snmp_oids [2018/05/18 06:57]
manual:discovery:low_level_discovery:snmp_oids [2018/08/20 08:28] (current)
martins-v updating screenshot
Line 1: Line 1:
 +==== 3 Discovery of SNMP OIDs ====
 +
 +=== Overview ===
 +
 +In this section we will perform an SNMP [[:​manual/​discovery/​low_level_discovery|discovery]] on a switch.
 +
 +=== Item key ===
 +
 +Unlike with file system and network interface discovery, the item does not necessarily has to have an "​snmp.discovery"​ key - item type of SNMP agent is sufficient.
 +
 +Discovery of SNMP OIDs is supported since Zabbix server/​proxy 2.0.
 +
 +To configure the discovery rule, do the following:
 +
 +  * Go to: //​Configuration//​ -> //​Templates// ​
 +  * Click on //​Discovery//​ in the row of an appropriate template
 +
 +{{manual:​discovery:​low_level_discovery:​templates_snmp.png|}}
 +
 +  * Click on //Create discovery rule// in the upper right corner of the screen
 +  * Fill in the discovery rule form with the required details as in the screenshot below
 +
 +{{manual:​discovery:​low_level_discovery:​lld_rule_snmp.png|}}
 +
 +All mandatory input fields are marked with a red asterisk. ​
 +
 +The OIDs to discover are defined in SNMP OID field in the following format: ''​discovery[{#​MACRO1},​ oid1, {#MACRO2}, oid2, …,​]''​
 +
 +where //​{#​MACRO1}//,​ //​{#​MACRO2}//​ …  are valid lld macro names and //oid1//, //oid2//... are OIDs capable of generating meaningful values for these macros. A built-in macro //​{#​SNMPINDEX}//​ containing index of the discovered OID is applied to discovered entities. The discovered entities are grouped by //​{#​SNMPINDEX}//​ macro value.
 +
 +To understand what we mean, let us perform few snmpwalks on our switch: ​
 +  $ snmpwalk -v 2c -c public 192.168.1.1 IF-MIB::​ifDescr
 +  IF-MIB::​ifDescr.1 = STRING: WAN
 +  IF-MIB::​ifDescr.2 = STRING: LAN1
 +  IF-MIB::​ifDescr.3 = STRING: LAN2
 +  ​
 +  $ snmpwalk -v 2c -c public 192.168.1.1 IF-MIB::​ifPhysAddress
 +  IF-MIB::​ifPhysAddress.1 = STRING: 8:​0:​27:​90:​7a:​75
 +  IF-MIB::​ifPhysAddress.2 = STRING: 8:​0:​27:​90:​7a:​76
 +  IF-MIB::​ifPhysAddress.3 = STRING: 8:​0:​27:​2b:​af:​9e
 +
 +And set SNMP OID to: ''​discovery[{#​IFDESCR},​ ifDescr, {#​IFPHYSADDRESS},​ ifPhysAddress]''​
 +
 +Now this rule will discover entities with {#IFDESCR} macros set to **WAN**, **LAN1** and **LAN2**, {#​IFPHYSADDRESS} macros set to **8:​0:​27:​90:​7a:​75**,​ **8:​0:​27:​90:​7a:​76**,​ and **8:​0:​27:​2b:​af:​9e**,​ {#​SNMPINDEX} macros set to the discovered OIDs indexes **1**, **2** and **3**:
 +  {
 +      "​data":​ [
 +          {
 +              "​{#​SNMPINDEX}":​ "​1",​
 +              "​{#​IFDESCR}":​ "​WAN",​
 +              "​{#​IFPHYSADDRESS}":​ "​8:​0:​27:​90:​7a:​75"​
 +          },
 +          {
 +              "​{#​SNMPINDEX}":​ "​2",​
 +              "​{#​IFDESCR}":​ "​LAN1",​
 +              "​{#​IFPHYSADDRESS}":​ "​8:​0:​27:​90:​7a:​76"​
 +          },
 +          {
 +              "​{#​SNMPINDEX}":​ "​3",​
 +              "​{#​IFDESCR}":​ "​LAN2",​
 +              "​{#​IFPHYSADDRESS}":​ "​8:​0:​27:​2b:​af:​9e"​
 +          }
 +      ]
 +  }
 +
 +If an entity does not have the specified OID, then the corresponding macro will be omitted for this entity. For example if we have the following data:
 +  ifDescr.1 "​Interface #1"
 +  ifDescr.2 "​Interface #2"
 +  ifDescr.4 "​Interface #4"
 +  ​
 +  ifAlias.1 "​eth0"​
 +  ifAlias.2 "​eth1"​
 +  ifAlias.3 "​eth2"​
 +  ifAlias.5 "​eth4"​
 + 
 +Then in this case SNMP discovery ''​discovery[{#​IFDESCR},​ ifDescr, {#IFALIAS}, ifAlias]''​ will return the following structure: ​
 +  {
 +      "​data":​ [
 +          {
 +              "​{#​SNMPINDEX}":​ 1,
 +              "​{#​IFDESCR}":​ "​Interface #1",
 +              "​{#​IFALIAS}":​ "​eth0"​
 +          },
 +          {
 +              "​{#​SNMPINDEX}":​ 2,
 +              "​{#​IFDESCR}":​ "​Interface #2",
 +              "​{#​IFALIAS}":​ "​eth1"​
 +          },
 +          {
 +              "​{#​SNMPINDEX}":​ 3,
 +              "​{#​IFALIAS}":​ "​eth2"​
 +          },
 +          {
 +              "​{#​SNMPINDEX}":​ 4,
 +              "​{#​IFDESCR}":​ "​Interface #4"
 +          },
 +          {
 +              "​{#​SNMPINDEX}":​ 5,
 +              "​{#​IFALIAS}":​ "​eth4"​
 +          }
 +      ]
 +  }  ​
 +
 +=== Item prototypes ===
 +
 +The following screenshot illustrates how we can use these macros in item prototypes:
 +
 +{{manual:​discovery:​low_level_discovery:​item_prototype_snmp1.png|}}
 +
 +Again, creating as many item prototypes as needed:
 +
 +{{manual:​discovery:​low_level_discovery:​item_prototypes_snmp.png|}}
 +
 +=== Trigger prototypes ===
 +
 +The following screenshot illustrates how we can use these macros in trigger prototypes:
 +
 +{{manual:​discovery:​low_level_discovery:​trigger_prototype_snmp.png|}}
 +
 +{{manual:​discovery:​low_level_discovery:​trigger_prototypes_snmp.png|}}
 +
 +=== Graph prototypes ===
 +
 +The following screenshot illustrates how we can use these macros in graph prototypes:
 +
 +{{manual:​discovery:​low_level_discovery:​graph_prototype_snmp.png|}}
 +
 +{{manual:​discovery:​low_level_discovery:​graph_prototypes_snmp.png|}}
 +
 +A summary of our discovery rule:
 +
 +{{manual:​discovery:​low_level_discovery:​lld_rules_snmp.png|}}
 +
 +=== Discovered entities ===
 +
 +When server runs, it will create real items, triggers and graphs based on the values the SNMP discovery rule returns. In the host configuration they are prefixed with an orange link to a discovery rule they come from.
 +
 +{{manual:​discovery:​low_level_discovery:​discovered_items_snmp.png|}}
 +
 +{{manual:​discovery:​low_level_discovery:​discovered_triggers_snmp.png|}}
 +
 +{{manual:​discovery:​low_level_discovery:​discovered_graphs_snmp.png|}}