netrusov / ZabbixDBA

Zabbix Database Monitoring Service (Oracle, Pg, MySQL, MS SQL, DB2, etc.)
MIT License
97 stars 55 forks source link

How to set different check interval for different check items on one database? #89

Closed januschow826 closed 5 years ago

januschow826 commented 5 years ago

Hi Alex: I have deployed this tool in our production environment and currently it works fine. But sometimes i'm always trying to reduce negative effects on database due to ZabbixDBA monitoring. As i know, all check items for a database have the same check interval。But we may need to check last successful database backup or tablespace usage every 30 minutes, and check long running SQL or current lock status every 30 seconds. But i just can't fix it out.I tried two different methods as follow, but neither works.

  1. Keep 2 section for one database entry in config.pl like this: DB2 => { dsn => 'DBI:DB2:fmdb', sleep => 30 query_list => [qw|query.props.db2.30s.pl1|], DB2 => { dsn => 'DBI:DB2:fmdb', sleep => 1800 query_list => [qw|query.props.db2.30m.pl1|], then the first one wil be omitted, and the other one take effect.
  2. Place the sleep attribute in query.props.pl like this: last_successful_db_backup=> { query => q{ select cast(timestampdiff(4, current timestamp - timestamp_format(max(end_time), 'yyyymmddhh24miss')) as float)/1440 days_since from sysibmadm.db_history where operation = 'B' and sqlcode is null }, sleep => 300, }, but the program seems not to recognize this attribute and just ignore it.

Could you please help on it? Thanks a lot!

netrusov commented 5 years ago

unfortunately, it's not possible yet. maybe some day I'll completely rewrite it using programming language with green threads.