multi-server-exporter multi server exporter is introduced
This commit is contained in:
committed by
Will Rouesnel
parent
72446a5b1e
commit
1d6a733ba2
34
README.md
34
README.md
@@ -49,16 +49,19 @@ Package vendoring is handled with [`govendor`](https://github.com/kardianos/gove
|
||||
Path under which to expose metrics. Default is `/metrics`.
|
||||
|
||||
* `disable-default-metrics`
|
||||
Use only metrics supplied from `queries.yaml` via `--extend.query-path`
|
||||
Use only metrics supplied from `queries.yaml` via `--extend.query-path`.
|
||||
|
||||
* `disable-settings-metrics`
|
||||
Use the flag if you don't want to scrape `pg_settings`.
|
||||
|
||||
* `extend.query-path`
|
||||
Path to a YAML file containing custom queries to run. Check out [`queries.yaml`](queries.yaml)
|
||||
for examples of the format.
|
||||
|
||||
|
||||
* `dumpmaps`
|
||||
Do not run - print the internal representation of the metric maps. Useful when debugging a custom
|
||||
queries file.
|
||||
|
||||
|
||||
* `log.level`
|
||||
Set logging level: one of `debug`, `info`, `warn`, `error`, `fatal`
|
||||
|
||||
@@ -78,21 +81,23 @@ The following environment variables configure the exporter:
|
||||
URI may contain the username and password to connect with.
|
||||
|
||||
* `DATA_SOURCE_URI`
|
||||
an alternative to DATA_SOURCE_NAME which exclusively accepts the raw URI
|
||||
an alternative to `DATA_SOURCE_NAME` which exclusively accepts the raw URI
|
||||
without a username and password component.
|
||||
|
||||
* `DATA_SOURCE_USER`
|
||||
When using `DATA_SOURCE_URI`, this environment variable is used to specify
|
||||
the username.
|
||||
|
||||
* `DATA_SOURCE_USER_FILE`
|
||||
The same, but reads the username from a file.
|
||||
|
||||
* `DATA_SOURCE_PASS`
|
||||
When using `DATA_SOURCE_URI`, this environment variable is used to specify
|
||||
the password to connect with.
|
||||
|
||||
* `DATA_SOURCE_PASS_FILE`
|
||||
The same as above but reads the password from a file.
|
||||
|
||||
|
||||
* `PG_EXPORTER_WEB_LISTEN_ADDRESS`
|
||||
Address to listen on for web interface and telemetry. Default is `:9187`.
|
||||
|
||||
@@ -102,13 +107,16 @@ The following environment variables configure the exporter:
|
||||
* `PG_EXPORTER_DISABLE_DEFAULT_METRICS`
|
||||
Use only metrics supplied from `queries.yaml`. Value can be `true` or `false`. Default is `false`.
|
||||
|
||||
* `PG_EXPORTER_DISABLE_SETTINGS_METRICS`
|
||||
Use the flag if you don't want to scrape `pg_settings`. Value can be `true` or `false`. Defauls is `false`.
|
||||
|
||||
* `PG_EXPORTER_EXTEND_QUERY_PATH`
|
||||
Path to a YAML file containing custom queries to run. Check out [`queries.yaml`](queries.yaml)
|
||||
for examples of the format.
|
||||
|
||||
* `PG_EXPORTER_CONSTANT_LABELS`
|
||||
Labels to set in all metrics. A list of `label=value` pairs, separated by commas.
|
||||
|
||||
|
||||
Settings set by environment variables starting with `PG_` will be overwritten by the corresponding CLI flag if given.
|
||||
|
||||
### Setting the Postgres server's data source name
|
||||
@@ -120,6 +128,10 @@ For running it locally on a default Debian/Ubuntu install, this will work (trans
|
||||
|
||||
sudo -u postgres DATA_SOURCE_NAME="user=postgres host=/var/run/postgresql/ sslmode=disable" postgres_exporter
|
||||
|
||||
Also, you can set a list of sources to scrape different instances from the one exporter setup. Just define a comma separated string.
|
||||
|
||||
sudo -u postgres DATA_SOURCE_NAME="port=5432,port=6432" postgres_exporter
|
||||
|
||||
See the [github.com/lib/pq](http://github.com/lib/pq) module for other ways to format the connection string.
|
||||
|
||||
### Adding new metrics
|
||||
@@ -143,18 +155,18 @@ The -extend.query-path command-line argument specifies a YAML file containing ad
|
||||
Some examples are provided in [queries.yaml](queries.yaml).
|
||||
|
||||
### Disabling default metrics
|
||||
To work with non-officially-supported postgres versions you can try disabling (e.g. 8.2.15)
|
||||
To work with non-officially-supported postgres versions you can try disabling (e.g. 8.2.15)
|
||||
or a variant of postgres (e.g. Greenplum) you can disable the default metrics with the `--disable-default-metrics`
|
||||
flag. This removes all built-in metrics, and uses only metrics defined by queries in the `queries.yaml` file you supply
|
||||
(so you must supply one, otherwise the exporter will return nothing but internal statuses and not your database).
|
||||
|
||||
### Running as non-superuser
|
||||
|
||||
To be able to collect metrics from `pg_stat_activity` and `pg_stat_replication`
|
||||
as non-superuser you have to create views as a superuser, and assign permissions
|
||||
separately to those.
|
||||
To be able to collect metrics from `pg_stat_activity` and `pg_stat_replication`
|
||||
as non-superuser you have to create views as a superuser, and assign permissions
|
||||
separately to those.
|
||||
|
||||
In PostgreSQL, views run with the permissions of the user that created them so
|
||||
In PostgreSQL, views run with the permissions of the user that created them so
|
||||
they can act as security barriers.
|
||||
|
||||
```sql
|
||||
|
||||
Reference in New Issue
Block a user