Ad Widget

Collapse

PostgreSQL Custom Queries - pgsql.custom.query what is wrong?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pclark
    Junior Member
    • Nov 2022
    • 4

    #1

    PostgreSQL Custom Queries - pgsql.custom.query what is wrong?

    I am trying to understand how this is supposed to work. I am running zabbix 6.2.6 and have custom queries on the server.

    I have followed these slides as well:


    My expectations (or what I think I understand...)

    - Configure /etc/zabbix/zabbix-agent2.d/plugins.d/postgresql.conf and set Plugins.PostgreSQL.CustomQueriesPath=/var/lib/zabbix

    - Custom queries go in the directory with a .sql extension.

    When I do all of this, I get query not found... It isn't consistent...

  • teu_pega
    Junior Member
    • Oct 2023
    • 3

    #2

    For me it was also quite tricky to get this working, but finally I got this done.
    We´re using Zabbix 6.4, Zabbix Agent2 6.4 and the plugin PostgreSQL Plugin which was also already working. Only the custom query didn´t work for me.

    Here is the relevant config for me:

    /etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf
    Code:
    Plugins.PostgreSQL.CustomQueriesPath=/etc/zabbix/custom_query/
    Item Key in Zabbix Web Ui
    Code:
    pgsql.custom.query["{$PG.URI}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","myquery"]
    I placed my query on the system like this:

    Code:
    /etc/zabbix/custom_query/myquery.sql
    The trick in my case was to not enter the extension of the file in the item key in Zabbix web Ui.

    I found this hint only here https://git.zabbix.com/projects/AP/r...tgresql/browse
    pgsql.custom.query[<commonParams>,queryName[,args...]] — Returns result of a custom query.
    Parameters:
    queryName (required) — name of a custom query (must be equal to a name of a sql file without an extension).

    Comment

    Working...