Summary

This document provides instructions and examples for low-level discovery (LLD) in Zabbix, focusing on using SNMP OIDs. It includes practical setup steps and explains how to configure discovery rules for various network components. The materials are designed for Zabbix professionals.

Full Transcript

LLD VIA SQL QUERIES Key: db.odbc.get[<unique short description>,<dsn>,<connection string>] Y P Returns multiple rows/columns in JSON format May be used as a master item that collects all the data in one system call JSONPath preprocessing must be used in dependent items to extract individual values...

LLD VIA SQL QUERIES Key: db.odbc.get[<unique short description>,<dsn>,<connection string>] Y P Returns multiple rows/columns in JSON format May be used as a master item that collects all the data in one system call JSONPath preprocessing must be used in dependent items to extract individual values O C More efficient way to get discovery data and all the values in one call T N LLD rule is executed together with data collection; keeps items up to date Recommended way for Zabbix 6.0 U T E D S 6.0 Certified Professional ● Day 2 JSON © 2023 by Zabbix. All rights reserved Theory 104 LLD VIA SQL QUERIES Master item Dependent Discovery Rule Y P E D U T S 6.0 Certified Professional ● Day 2 T N Item prototype O C © 2023 by Zabbix. All rights reserved Theory 105 PRACTICAL SETUP Y P Create on the "Training ODBC monitoring" template: 1) Master item: Name: Type: Key: SQL query: T N SELECT table_name,data_length,index_length FROM information_schema.partitions WHERE table_schema = 'zabbix' E D 2) Dependent discovery rule: Name: Key: O C Raw database table data Database monitor db.odbc.get[table.raw.discovery,,<set proper uri>]" U T Database Table discovery db.table.discovery 3) Three item prototypes: S Table data length Table index length Total table size 6.0 Certified Professional Day ● Day 2 2 dependent item dependent item calculated item © 2023 by Zabbix. All rights reserved 60 minutes Practical task No: 16 106 Y P E D LLD of SNMP OIDs U T S 6.0 Certified Professional ● Day 2 T N O C © 2023 by Zabbix. All rights reserved 20 minutes 107 LLD OF SNMP OIDS Discovery of SNMP OIDs is supported since Zabbix server 2.0 i O C E D U T S T N Y P https://...documentation/6.0/manual/discovery/low_level_discovery/snmp_oids 6.0 Certified Professional ● Day 2 © 2023 by Zabbix. All rights reserved Theory 108 LLD OF SNMP OIDS The syntax for SNMP discovery rules: discovery[{#MACRO}, SNMP OID] Y P A built-in macro {#SNMPINDEX} O C Contains index of the discovered OID, which is applied to discovered entities Discovered entities are grouped by {#SNMPINDEX} macro value Example: T N E D discovery[{#IFDESCR}, IF-MIB::ifDescr, {#IFALIAS}, IF-MIB::ifAlias] U T { S } [ ] {"{#SNMPINDEX}":1,"{#IFDESCR}":"Interface #1","{#IFALIAS}":"eth1"}, {"{#SNMPINDEX}":2,"{#IFDESCR}":"Interface #2","{#IFALIAS}":"eth2"}, {"{#SNMPINDEX}":3,"{#IFDESCR}":"Interface #3","{#IFALIAS}":"eth3"}, {"{#SNMPINDEX}":4,"{#IFDESCR}":"Interface #4","{#IFALIAS}":"eth4"}, {"{#SNMPINDEX}":5,"{#IFDESCR}":"Interface #5","{#IFALIAS}":"eth5"}, 6.0 Certified Professional ● Day 2 © 2023 by Zabbix. All rights reserved Theory 109 LLD FOR SNMP OIDS - HOW IT WORKS Supplies Description Supplies Capacity .1.3.6.1.2.1.43.11.1.1.6.1 = black .1.3.6.1.2.1.43.11.1.1.6.2 = cyan .1.3.6.1.2.1.43.11.1.1.6.3 = red .1.3.6.1.2.1.43.11.1.1.6.4 = magenta Supplies Level .1.3.6.1.2.1.43.8.2.1.8.1 = 100 .1.3.6.1.2.1.43.8.2.1.8.2 = 100 .1.3.6.1.2.1.43.8.2.1.8.3 = 100 .1.3.6.1.2.1.43.8.2.1.8.4 = 100 T N DISCOVERY RULE E D Y P .1.3.6.1.2.1.43.8.2.1.9.1 = 24 .1.3.6.1.2.1.43.8.2.1.9.2 = 99 .1.3.6.1.2.1.43.8.2.1.9.3 = 52 .1.3.6.1.2.1.43.8.2.1.9.4 = 75 O C ITEM PROTOTYPES Supplies description discovery[{#DESCRIPTION},.1.3.6.1.2.1.43.11.1.1.6] U T Supplies capacity S Supplies level .1.3.6.1.2.1.43.8.2.1.8.x Supplies capacity {#DESCRIPTION} .1.3.6.1.2.1.43.11.1.1.8.{#SNMPINDEX} .1.3.6.1.2.1.43.8.2.1.9.x Supplies level {#DESCRIPTION} .1.3.6.1.2.1.43.11.1.1.9.{#SNMPINDEX} Elements in all trees must use matching indexes 6.0 Certified Professional ● Day 2 © 2023 by Zabbix. All rights reserved Theory 110 LLD OF SNMP OIDS - ITEM PROTOTYPE Y P E D U T S 6.0 Certified Professional ● Day 2 T N O C © 2023 by Zabbix. All rights reserved Theory 111 LLD FOR SNMP OIDS - TRIGGER PROTOTYPE Y P E D U T S 6.0 Certified Professional ● Day 2 T N O C © 2023 by Zabbix. All rights reserved Theory 112 Y P T N O C E D SNMP Dynamic indexes U T S 6.0 Certified Professional ● Day 2 © 2023 by Zabbix. All rights reserved 10 minutes 113 SNMP DYNAMIC INDEX SNMP index may change over time in some specific scenarios: Y P The process name will stay the same, but PID will change with each restart After system reboot or firmware upgrade some of the indexes may change O C It is possible to define OID with a changeable index number by specifying: T N OID for data retrieval (OID or MIB format) Method of processing (currently only "index" is supported) E D Base OID of the tree where the index can be looked up (OID or MIB format) Case-sensitive search string U T S <OID of data>["index","<base OID of index>","<string to search for>"] 6.0 Certified Professional ● Day 2 © 2023 by Zabbix. All rights reserved Theory 114 DYNAMIC INDEX EXAMPLE SNMP dynamic index example with MIB format: Y P HOST-RESOURCES-MIB::hrSWRunStatus ["index","HOST-RESOURCES-MIB::hrSWRunPath", "/usr/sbin/httpd"] location of data collection HOST-RESOURCES-MIB::hrSWRunPath.5376 HOST-RESOURCES-MIB::hrSWRunPath.5377 HOST-RESOURCES-MIB::hrSWRunPath.5388 HOST-RESOURCES-MIB::hrSWRunPath.5389 T N E D U T O C replaced with 5388 or 6525 after httpd service restart = = = = STRING: STRING: STRING: STRING: "/sbin/getty" "/sbin/getty" "/usr/sbin/httpd" "/sbin/sshd" = = = = STRING: STRING: STRING: STRING: "/sbin/getty" "/sbin/getty" "/usr/sbin/httpd" "/sbin/sshd" systemctl restart httpd S HOST-RESOURCES-MIB::hrSWRunPath.5376 HOST-RESOURCES-MIB::hrSWRunPath.5377 HOST-RESOURCES-MIB::hrSWRunPath.6525 HOST-RESOURCES-MIB::hrSWRunPath.5389 6.0 Certified Professional ● Day 2 © 2023 by Zabbix. All rights reserved Theory 115 DYNAMIC INDEX EXAMPLE SNMP dynamic index example with OID format: Y P .1.3.6.1.2.1.25.4.2.1.7 ["index",".1.3.6.1.2.1.25.4.2.1.4", "/usr/sbin/httpd"] location of data collection .1.3.6.1.2.1.25.4.2.1.4.5376 .1.3.6.1.2.1.25.4.2.1.4.5377 .1.3.6.1.2.1.25.4.2.1.4.5388 .1.3.6.1.2.1.25.4.2.1.4.5389 T N = = = = STRING: STRING: STRING: STRING: "/sbin/getty" "/sbin/getty" "/usr/sbin/httpd" "/sbin/sshd" = = = = STRING: STRING: STRING: STRING: "/sbin/getty" "/sbin/getty" "/usr/sbin/httpd" "/sbin/sshd" E D U T O C replaced with 5388 or 6525 after httpd service restart systemctl restart httpd S .1.3.6.1.2.1.25.4.2.1.4.5376 .1.3.6.1.2.1.25.4.2.1.4.5377 .1.3.6.1.2.1.25.4.2.1.4.6525 .1.3.6.1.2.1.25.4.2.1.4.5389 6.0 Certified Professional ● Day 2 © 2023 by Zabbix. All rights reserved Theory 116 PRACTICAL SETUP Y P 1) Install net-snmp-utils package on your student's machine 2) Run snmpwalk command towards the training.lan host: community: SNMP oid: training 1.3.6.1.2.1.2.2.1 T N O C 3) Add an SNMP interface to the "Training resources" host: Interfaces: SNMP v2 DNS: training.lan Port: 161 community: {$SNMP_COMMUNITY} E D 4) Redefine {$SNMP_COMMUNITY} macro to the "training" on the "Training resources" host 5) Create a discovery rule and following prototypes: Interface {#IFNAME}: Interface type Interface {#IFNAME}: Operational status Interface {#IFNAME}: Bytes received Interface {#IFNAME}: Bytes sent U T S 6) Make sure that items are receiving data 7) Add interface MAC address to the description field for item prototype: Interface {#IFNAME}: Interface type 6.0 Certified Professional Day ● Day 2 2 © 2023 by Zabbix. All rights reserved 20 minutes Practical task No: 17 117 Y P E D U T S 6.0 Certified Professional ● Day 2 T N O C Time for a break :) © 2023 by Zabbix. All rights reserved

Use Quizgecko on...
Browser
Browser