-
Problem report
-
Resolution: Fixed
-
Trivial
-
5.0.20
-
None
-
CentOS 7
-
Sprint 85 (Feb 2022), Sprint 86 (Mar 2022)
-
1
Steps to reproduce:
- Install and run Zabbix Agent 2
- Configure PostgreSQL custom queries directory, place query.sql file with read permissions for zabbix user, attached, restart the agent
- Check SQL query with
zabbix_get -s <ip> -p <port> -k pgsql.custom.query["tcp://127.0.0.1:5432","zbx_monitor","zabbix123","zabbix","query"]
Result:
[{"json_object_agg":"eyAiemFiYml4X3Byb3h5IiA6IHsiZGF0bmFtZSI6InphYmJpeF9wcm94eSIsInF1ZXJ5X3RpbWVfbWF4IjowLCJ0eF90aW1lX21heCI6MCwibXJvX3RpbWVfbWF4IjowLCJxdWVyeV90aW1lX3N1bSI6MCwidHhfdGltZV9zdW0iOjAsIm1yb190aW1lX3N1bSI6MCwicXVlcnlfc2xvd19jb3VudCI6MCwidHhfc2xvd19jb3VudCI6MCwibXJvX3Nsb3dfY291bnQiOjB9LCAicG9zdGdyZXMiIDogeyJkYXRuYW1lIjoicG9zdGdyZXMiLCJxdWVyeV90aW1lX21heCI6MCwidHhfdGltZV9tYXgiOjAsIm1yb190aW1lX21heCI6MCwicXVlcnlfdGltZV9zdW0iOjAsInR4X3RpbWVfc3VtIjowLCJtcm9fdGltZV9zdW0iOjAsInF1ZXJ5X3Nsb3dfY291bnQiOjAsInR4X3Nsb3dfY291bnQiOjAsIm1yb19zbG93X2NvdW50IjowfSwgInphYmJpeCIgOiB7ImRhdG5hbWUiOiJ6YWJiaXgiLCJxdWVyeV90aW1lX21heCI6MCwidHhfdGltZV9tYXgiOjAsIm1yb190aW1lX21heCI6MCwicXVlcnlfdGltZV9zdW0iOjAsInR4X3RpbWVfc3VtIjowLCJtcm9fdGltZV9zdW0iOjAsInF1ZXJ5X3Nsb3dfY291bnQiOjAsInR4X3Nsb3dfY291bnQiOjAsIm1yb19zbG93X2NvdW50IjowfSB9"}]
Expected:
Correct SQL query result
Checking with psql has the correct result
sudo -u zabbix psql -U zbx_monitor -d zabbix < /var/lib/zabbix/postgres/query.sql json_object_agg ----------------------------------------------------------------------------------------------------------------------------------------------------------------- { "zabbix_proxy" : {"datname":"zabbix_proxy","query_time_max":0,"tx_time_max":0,"mro_time_max":0,"query_time_sum":0,"tx_time_sum":0,"mro_time_sum":0,"query_slow_count":0,"tx_slow_count":0,"mro_slow_count":0}, "postgres" : {"datname":"postgres","query_time_max":0,"tx_time_max":0,"mro_time_max":0,"query_time_sum":0,"tx_time_sum":0,"mro_time_sum":0,"query_slow_count":0,"tx_slow_count":0,"mro_slow_count":0}, "zabbix" : {"datname":"zabbix","query_time_max":0,"tx_time_max":0,"mro_time_max":0,"query_time_sum":0,"tx_time_sum":0,"mro_time_sum":0,"query_slow_count":0,"tx_slow_count":0,"mro_slow_count":0} }