Dynamic indexes are supported since Zabbix version 1.5.
A special syntax for item OID can be used in order to deal with dynamic data (random IDs of network interfaces, etc). The syntax:
<base OID of data>["index","<base OID of index>","<string to search for>"]
For example, to get the ifInOctets value for the GigabitEthernet0/1 interface on a Cisco device, use the following OID:
Parameter | Description |
---|---|
base OID of data | Base OID to use for data retrieval. |
index | Method of processing. Currently one method is supported index – search for index and append it to the base OID |
base OID of index | The OID will be used to make a lookup for the string. |
string to search for | The string is used for exact match with a value when doing lookup. Case sensitive. |
Another example, getting memory usage of apache process:
HOST-RESOURCES-MIB::hrSWRunPerfMem["index","HOST-RESOURCES-MIB::hrSWRunPath", "/usr/sbin/apache2"]
...
HOST-RESOURCES-MIB::hrSWRunPath.5376 = STRING: "/sbin/getty"
HOST-RESOURCES-MIB::hrSWRunPath.5377 = STRING: "/sbin/getty"
HOST-RESOURCES-MIB::hrSWRunPath.5388 = STRING: "/usr/sbin/apache2"
HOST-RESOURCES-MIB::hrSWRunPath.5389 = STRING: "/sbin/sshd"
...
Now we have index, 5388. The index will be appended to the Data OID in order to receive value we are interested in:
Dynamic indexes are cached since Zabbix version 1.6.3.
Using dynamic indexes leads to more SNMP queries in Zabbix versions up to 1.7. Dynamic index lookup and data retrieval is performed in single connection since Zabbix version 1.7.