67 lines
2.6 KiB
Text
67 lines
2.6 KiB
Text
|
# Read metrics from one or many postgresql servers
|
||
|
[[inputs.postgresql_extensible]]
|
||
|
# specify address via a url matching:
|
||
|
# postgres://[pqgotest[:password]]@host:port[/dbname]?sslmode=...&statement_timeout=...
|
||
|
# or a simple string:
|
||
|
# host=localhost port=5432 user=pqgotest password=... sslmode=... dbname=app_production
|
||
|
#
|
||
|
# All connection parameters are optional.
|
||
|
# Without the dbname parameter, the driver will default to a database
|
||
|
# with the same name as the user. This dbname is just for instantiating a
|
||
|
# connection with the server and doesn't restrict the databases we are trying
|
||
|
# to grab metrics for.
|
||
|
#
|
||
|
address = "host=localhost user=postgres sslmode=disable"
|
||
|
|
||
|
## Whether to use prepared statements when connecting to the database.
|
||
|
## This should be set to false when connecting through a PgBouncer instance
|
||
|
## with pool_mode set to transaction.
|
||
|
prepared_statements = true
|
||
|
|
||
|
# Define the toml config where the sql queries are stored
|
||
|
# The script option can be used to specify the .sql file path.
|
||
|
# If script and sqlquery options specified at same time, sqlquery will be used
|
||
|
#
|
||
|
# the measurement field defines measurement name for metrics produced
|
||
|
# by the query. Default is "postgresql".
|
||
|
#
|
||
|
# 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.
|
||
|
#
|
||
|
# The timestamp field is used to override the data points timestamp value. By
|
||
|
# default, all rows inserted with current time. By setting a timestamp column,
|
||
|
# the row will be inserted with that column's value.
|
||
|
#
|
||
|
# The min_version field specifies minimal database version this query
|
||
|
# will run on.
|
||
|
#
|
||
|
# The max_version field when set specifies maximal database version
|
||
|
# this query will NOT run on.
|
||
|
#
|
||
|
# Database version in `minversion` and `maxversion` is represented as
|
||
|
# a single integer without last component, for example:
|
||
|
# 9.6.2 -> 906
|
||
|
# 15.2 -> 1500
|
||
|
#
|
||
|
# Structure :
|
||
|
# [[inputs.postgresql_extensible.query]]
|
||
|
# measurement string
|
||
|
# sqlquery string
|
||
|
# min_version int
|
||
|
# max_version int
|
||
|
# withdbname boolean
|
||
|
# tagvalue string (coma separated)
|
||
|
# timestamp string
|
||
|
[[inputs.postgresql_extensible.query]]
|
||
|
measurement="pg_stat_database"
|
||
|
sqlquery="SELECT * FROM pg_stat_database WHERE datname"
|
||
|
min_version=901
|
||
|
tagvalue=""
|
||
|
[[inputs.postgresql_extensible.query]]
|
||
|
script="your_sql-filepath.sql"
|
||
|
min_version=901
|
||
|
max_version=1300
|
||
|
tagvalue=""
|