postgres_exporter/postgres_mixin
Joe Adams 27d23d02ef
refactor pg_stat_bgwriter metrics into standalone collector
This moves the metrics that are queried from pg_stat_bgwriter into a dedicated collector instead of dynamically generating queries and metrics from a map. It renames some metrics including adding the `_total` suffix on all of the counters to match prometheus standards. This implementation uses QueryRowContext to allow for later addition of context for cancellation. From the Postgres documentation, it states that there is one line per WAL sender process, but it is unclear how to differentiate between them in any meaningful way. When querying the table, there is no column to identify the row, only metrics about bgwriter.

Signed-off-by: Joe Adams <github@joeadams.io>
2022-02-22 21:46:43 -05:00
..
alerts feat(mixin): Add grafana mixins support for postgres exporter 2021-03-02 13:18:59 +01:00
dashboards refactor pg_stat_bgwriter metrics into standalone collector 2022-02-22 21:46:43 -05:00
.gitignore feat(mixin): Add grafana mixins support for postgres exporter 2021-03-02 13:18:59 +01:00
go.mod feat(mixin): Add grafana mixins support for postgres exporter 2021-03-02 13:18:59 +01:00
Makefile feat(mixin): Add grafana mixins support for postgres exporter 2021-03-02 13:18:59 +01:00
mixin.libsonnet feat(mixin): Add grafana mixins support for postgres exporter 2021-03-02 13:18:59 +01:00
README.md feat(mixin): Add grafana mixins support for postgres exporter 2021-03-02 13:18:59 +01:00

Postgres Mixin

This is a work in progress. We aim for it to become a good role model for alerts and dashboards eventually, but it is not quite there yet.

The Postgres Mixin is a set of configurable, reusable, and extensible alerts and dashboards based on the metrics exported by the Postgres Exporter. The mixin creates recording and alerting rules for Prometheus and suitable dashboard descriptions for Grafana.

To use them, you need to have mixtool and jsonnetfmt installed. If you have a working Go development environment, it's easiest to run the following:

$ go get github.com/monitoring-mixins/mixtool/cmd/mixtool
$ go get github.com/google/go-jsonnet/cmd/jsonnetfmt

You can then build the Prometheus rules files alerts.yaml and rules.yaml and a directory dashboard_out with the JSON dashboard files for Grafana:

$ make build

For more advanced uses of mixins, see https://github.com/monitoring-mixins/docs.