From c17427631dcfaf08034d03cf32d065807cf247b4 Mon Sep 17 00:00:00 2001 From: Peter Date: Fri, 26 Jan 2018 00:38:11 +0100 Subject: [PATCH] Expand on tagvalue option in postgresql_extensible (#3720) --- plugins/inputs/postgresql_extensible/README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins/inputs/postgresql_extensible/README.md b/plugins/inputs/postgresql_extensible/README.md index 50f745d41..29c5e36d8 100644 --- a/plugins/inputs/postgresql_extensible/README.md +++ b/plugins/inputs/postgresql_extensible/README.md @@ -43,7 +43,11 @@ The example below has two queries are specified, with the following parameters: # withdbname was true. # Be careful that if the withdbname is set to false you don't have to define # the where clause (aka with the dbname) - # the tagvalue field is used to define custom tags (separated by comas) + # + # the tagvalue field is used to define custom tags (separated by comas). + # the query is expected to return columns which match the names of the + # defined tags. The values in these columns must be of a string-type, + # a number-type or a blob-type. # # Structure : # [[inputs.postgresql_extensible.query]] @@ -109,6 +113,15 @@ using postgreql extensions ([pg_stat_statements](http://www.postgresql.org/docs/ version=901 withdbname=false tagvalue="db" +[[inputs.postgresql_extensible.query]] + sqlquery=""" + SELECT type, (enabled || '') AS enabled, COUNT(*) + FROM application_users + GROUP BY type, enabled + """ + version=901 + withdbname=false + tagvalue="type,enabled" ``` # Postgresql Side