Use macro to monitor multiple DBs with this same template

When creating a template I want to use this same template in QA environment and Production environment without any changes when moving to production.

I achieve this using user macros.

Template

Add macro {$ODBCMYSQLCLUSTER} => db ( this value is not important )

Discovery Rule
Create discovery rule, which refer to macro.
Type: Database monitor
key: db.odbc.discovery[long_running_jobs,{$ODBCMYSQLCLUSTER}]
SQL Query – SELECT SCHEDULE_ID,COUNT(*) CNT FROM MASPROD.P_JOBS WHERE JOB_STATE=10 AND START_DATE < DATE_ADD(NOW(),INTERVAL -120 MINUTE) GROUP BY SCHEDULE_ID

Host

Create macro and specified odb connection name to DB.
{$ODBCMYSQLCLUSTER} => ODBC_CONNECTIONI_NAME_TO_DB

Leave a Reply

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