-
Incident report
-
Resolution: Fixed
-
Minor
-
2.0.9
-
None
-
Debian 7.1 Wheezy
We have a number of database monitor items that are created through Discovery Rules. The Discovery rule has a macro value "
{#DBNAME}", which we can use in discovered item's parameters. If we try to use a generic macro value, the item becomes unsupported.Example item prototype parameters:
case 1: (macro value specified on hostname)
DSN={$DSN}
sql=select numbackends from pg_stat_database where datname = '{#DBNAME}
'
-> fails
case 2: (generic macro value)
DSN=
{HOSTNAME}sql=select numbackends from pg_stat_database where datname = '{#DBNAME}'
-> fails
case 3: (only use discovery macro value)
DSN={#DBNAME}
sql=select numbackends from pg_stat_database where datname = '{#DBNAME}'
-> works
log output:
9170:20131010:150649.247 In substitute_key_macros() data:'db.odbc.select.database_size[{#DBNAME}]'
9170:20131010:150649.247 In substitute_discovery_macros() data:'{#DBNAME}'
9170:20131010:150649.247 End of substitute_discovery_macros() data:'zabbix'
9170:20131010:150649.247 End of substitute_key_macros():SUCCEED data:'db.odbc.select.database_size[zabbix]'
9170:20131010:150649.247 In substitute_discovery_macros() data:'Database size for {#DBNAME}'
9170:20131010:150649.247 End of substitute_discovery_macros() data:'Database size for zabbix'
9170:20131010:150649.247 In substitute_discovery_macros() data:'DSN={HOSTNAME}
^M
sql=select pg_database_size('
')'
9170:20131010:150649.247 End of substitute_discovery_macros() data:'DSN=
sql=select pg_database_size('zabbix')'
9170:20131010:150649.247 In substitute_key_macros() data:''
9170:20131010:150649.247 End of substitute_key_macros():FAIL data:''
9170:20131010:150649.250 query [txnlev:1] [begin;]
9170:20131010:150649.251 query [txnlev:1] [update items set params='DSN={HOSTNAME}
sql=select pg_database_size(''zabbix'')' where itemid=24003;
]
Similar issue in ZBX-4638 was solved (difference with this ticket is the use of discovery).
- duplicates
-
ZBXNEXT-817 Multiline SQL queries in DB Monitor
- Closed