Ad Widget

Collapse

pgsql.custom.query return format

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bmamo
    Junior Member
    • Aug 2024
    • 3

    #1

    pgsql.custom.query return format

    Hi, I've searched all over the documentation but couldn't find anything regarding the format pgsql.custom.query returns its output.

    I'm doing a select count(*) on a table with the hopes of returning a numeric value, but the return is always being wrapped in a json format or similar.

    The value I am getting is : [{"count":2}]
    The value I need for graphing in this case would be just the output of the count, without the column header or formatting i.e.: 2

    Is this something that can be configured? I've tried doing \t in the sql file but it doesn't seem to be supported, returning an invalid character error.
  • Answer selected by bmamo at 06-08-2024, 17:03.
    Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    pgsql.custom.query[uri,<username>,<password>,queryName,<args...>]
    Return value: JSON object.

    Its normal! Just use JSONPath preprocessing for grab value.

    Comment

    • bmamo
      Junior Member
      • Aug 2024
      • 3

      #2
      Just bumping this cause I'm still stuck on this. Anyone can help? Maybe a pointer to a documentation I could read?

      Comment

      • Hamardaban
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • May 2019
        • 2713

        #3
        pgsql.custom.query[uri,<username>,<password>,queryName,<args...>]
        Return value: JSON object.

        Its normal! Just use JSONPath preprocessing for grab value.

        Comment

        • bmamo
          Junior Member
          • Aug 2024
          • 3

          #4
          Exactly what I needed, an inspiration to get a result Thank you very much, now with $[0].count in preprocessor tab i can get the value. Perfect and thanks again!

          Comment

          Working...