lesovsky / zabbix-extensions

Zabbix additional monitoring modules
BSD 3-Clause "New" or "Revised" License
316 stars 230 forks source link

Not issue but a help : Extract data from array json #79

Closed marfouk closed 4 years ago

marfouk commented 4 years ago

Hi M,

Can you help me pleaz. I have : 1- creating a user parameter : UserParameter=pgsql.transactions1.active[*],psql -qAtX $1 -c "SELECT json_agg(row_to_json(j)) FROM ( select coalesce(extract(epoch from max(age(now(), query_start))), 0),query from pg_stat_activity where state <> 'idle in transaction' and state <> 'idle' and query not ilike '%coalesc%' group by query) AS j"

2 - The result is a json in array format like this : [{"coalesce":-0.003137,"query":"select 1"},{"coalesce":-0.003137,"query":"select 1"}] 3- master item with a key : pgsql.transactions1.active[{$PG_CONNINFO}] and it gattering data (work fine. 4 - creating a dependent item to extracting data from the master item.

i want to know how a dependent item can extracting coalesc's and query's from the master item using preprocessing tab --> jsonpath

Thank you in advenced