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


item prototype
Name: Daily sales term 2: {#TERMNO}
Type: Database monitoring[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


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

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


Leave a Reply

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