You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See the [github.com/lib/pq](http://github.com/lib/pq) module for other ways to format the connection string.
123
137
124
138
### Adding new metrics
@@ -142,31 +156,78 @@ The -extend.query-path command-line argument specifies a YAML file containing ad
142
156
Some examples are provided in [queries.yaml](queries.yaml).
143
157
144
158
### Disabling default metrics
145
-
To work with non-officially-supported postgres versions you can try disabling (e.g. 8.2.15)
159
+
To work with non-officially-supported postgres versions you can try disabling (e.g. 8.2.15)
146
160
or a variant of postgres (e.g. Greenplum) you can disable the default metrics with the `--disable-default-metrics`
147
161
flag. This removes all built-in metrics, and uses only metrics defined by queries in the `queries.yaml` file you supply
148
162
(so you must supply one, otherwise the exporter will return nothing but internal statuses and not your database).
149
163
164
+
### Automatically discover databases
165
+
To scrape metrics from all databases on a database server, the database DSN's can be dynamically discovered via the
166
+
`--auto-discover-databases` flag. When true, `SELECT datname FROM pg_database` is run for all configured DSN's. From the
167
+
result a new set of DSN's is created for which the metrics are scraped.
168
+
150
169
### Running as non-superuser
151
170
152
-
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 they can act as security barriers.
171
+
To be able to collect metrics from `pg_stat_activity` and `pg_stat_replication`
172
+
as non-superuser you have to create functions and views as a superuser, and
173
+
assign permissions separately to those.
174
+
175
+
In PostgreSQL, views run with the permissions of the user that created them so
176
+
they can act as security barriers. Functions need to be created to share this
177
+
data with the non-superuser. Only creating the views will leave out the most
178
+
important bits of data.
153
179
154
180
```sql
155
-
CREATEUSERpostgres_exporter PASSWORD 'password';
181
+
-- To use IF statements, hence to be able to check if the user exists before
182
+
-- attempting creation, we need to switch to procedural SQL (PL/pgSQL)
0 commit comments