Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
wrouesnel committed Apr 9, 2020
2 parents b469045 + 77d4293 commit 4a665e0
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
5 changes: 1 addition & 4 deletions Dockerfile
@@ -1,9 +1,6 @@
FROM debian:7.11-slim
FROM debian:10-slim
RUN useradd -u 20001 postgres_exporter

FROM scratch

COPY --from=0 /etc/passwd /etc/passwd
USER postgres_exporter

ARG binary
Expand Down
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -94,8 +94,9 @@ 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
without a username and password component.
an alternative to `DATA_SOURCE_NAME` which exclusively accepts the hostname
without a username and password component. For example, `my_pg_hostname` or
`my_pg_hostname?sslmode=disable`.

* `DATA_SOURCE_URI_FILE`
The same as above but reads the URI from a file.
Expand Down
2 changes: 1 addition & 1 deletion cmd/postgres_exporter/postgres_exporter.go
Expand Up @@ -542,7 +542,7 @@ func parseUserQueries(content []byte) (map[string]intermediateMetricMap, map[str
func addQueries(content []byte, pgVersion semver.Version, server *Server) error {
metricMaps, newQueryOverrides, err := parseUserQueries(content)
if err != nil {
return nil
return err
}
// Convert the loaded metric map into exporter representation
partialExporterMap := makeDescMap(pgVersion, server.labels, metricMaps)
Expand Down
4 changes: 2 additions & 2 deletions example.alerts.yml
Expand Up @@ -3,7 +3,7 @@ groups:
- name: PostgreSQL
rules:
- alert: PostgreSQLMaxConnectionsReached
expr: sum(pg_stat_activity_count) by (instance) > sum(pg_settings_max_connections) by (instance)
expr: sum(pg_stat_activity_count) by (instance) >= sum(pg_settings_max_connections) by (instance) - sum(pg_settings_superuser_reserved_connections) by (instance)
for: 1m
labels:
severity: email
Expand All @@ -12,7 +12,7 @@ groups:
description: "{{ $labels.instance }} is exceeding the currently configured maximum Postgres connection limit (current value: {{ $value }}s). Services may be degraded - please take immediate action (you probably need to increase max_connections in the Docker image and re-deploy."

- alert: PostgreSQLHighConnections
expr: sum(pg_stat_activity_count) by (instance) > sum(pg_settings_max_connections * 0.8) by (instance)
expr: sum(pg_stat_activity_count) by (instance) > (sum(pg_settings_max_connections) by (instance) - sum(pg_settings_superuser_reserved_connections) by (instance)) * 0.8
for: 10m
labels:
severity: email
Expand Down
1 change: 1 addition & 0 deletions magefile.go
Expand Up @@ -97,6 +97,7 @@ func (p *Platform) ReleaseBase() string {
var platforms []Platform = []Platform{
{"linux", "amd64", ""},
{"linux", "386", ""},
{"linux", "arm64", ""},
{"darwin", "amd64", ""},
{"darwin", "386", ""},
{"windows", "amd64", ".exe"},
Expand Down
2 changes: 1 addition & 1 deletion queries.yaml
Expand Up @@ -122,7 +122,7 @@ pg_statio_user_tables:
description: "Number of buffer hits in this table's TOAST table indexes (if any)"

pg_database:
query: "SELECT pg_database.datname, pg_database_size(pg_database.datname) as size FROM pg_database"
query: "SELECT pg_database.datname, pg_database_size(pg_database.datname) as size_bytes FROM pg_database"
master: true
cache_seconds: 30
metrics:
Expand Down

0 comments on commit 4a665e0

Please sign in to comment.