diff --git a/Dockerfile b/Dockerfile index 86128d41a..7d17c9266 100644 --- a/Dockerfile +++ b/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 diff --git a/README.md b/README.md index a81bcd9b2..8864b88c4 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/cmd/postgres_exporter/postgres_exporter.go b/cmd/postgres_exporter/postgres_exporter.go index 6f2c2b71d..ab6124bca 100644 --- a/cmd/postgres_exporter/postgres_exporter.go +++ b/cmd/postgres_exporter/postgres_exporter.go @@ -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) diff --git a/example.alerts.yml b/example.alerts.yml index 1b08a437f..ff3d75a7f 100644 --- a/example.alerts.yml +++ b/example.alerts.yml @@ -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 @@ -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 diff --git a/magefile.go b/magefile.go index b3e0992f8..eedd529d6 100644 --- a/magefile.go +++ b/magefile.go @@ -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"}, diff --git a/queries.yaml b/queries.yaml index db2c0680b..76a91245d 100644 --- a/queries.yaml +++ b/queries.yaml @@ -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: