Expand on tagvalue option in postgresql_extensible (#3720)

This commit is contained in:
Peter 2018-01-26 00:38:11 +01:00 committed by Daniel Nelson
parent 7a197a3b2e
commit eca80961b8
1 changed files with 14 additions and 1 deletions

View File

@ -43,7 +43,11 @@ The example below has two queries are specified, with the following parameters:
# withdbname was true. # withdbname was true.
# Be careful that if the withdbname is set to false you don't have to define # Be careful that if the withdbname is set to false you don't have to define
# the where clause (aka with the dbname) # 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 : # Structure :
# [[inputs.postgresql_extensible.query]] # [[inputs.postgresql_extensible.query]]
@ -109,6 +113,15 @@ using postgreql extensions ([pg_stat_statements](http://www.postgresql.org/docs/
version=901 version=901
withdbname=false withdbname=false
tagvalue="db" 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 # Postgresql Side