ZABBIX discovery rule for mysql

Two level discovery

Create discovery rules

Type: database monitoring
key: db.odbc.discovery[daily_sales,db_qa_masqa_3306]
SQL: select term_no as TERMNO ,sum(amount) as AMOUNT from p_trx where trx_date > curdate() group by term_no

discovery_rules

item prototype
Name: Daily sales term 2: {#TERMNO}
Type: Database monitoring
key:db.odbc.select[sales{#TERMNO},db_qa_masqa_3306]
SQL:select sum(amount) as AMOUNT from p_trx where trx_date > curdate() and term_no = {#TERMNO}

this will use TERMNO from discovery rules and will execute another query against DB to retrieve additional information – in this case, AMOUNT

item_prototype

Single level discovery
Use above discovery rule which retrive two values from DB

Create Item prototypes
Name:
Type: Calcualted
Key: amount[{#AMOUNT}]
Formula: {#AMOUNT}

item_prototype_2

Leave a Reply

Your email address will not be published. Required fields are marked *