Обсуждение: Best Prometheus exporter?
Dear Colleagues, What good Prometheus exporter for Postgres can you recommend (from your own experience)? -- Victor Sudakov VAS4-RIPE http://vas.tomsk.ru/ 2:5005/49@fidonet
On Tue, 9 Nov 2021 at 00:19, Victor Sudakov <vas@sibptus.ru> wrote:
What good Prometheus exporter for Postgres can you recommend (from your own experience)?
I have not got a lot of exposure with prometheus, but was able to quickly set up using below,
but I was aware of monitoring and alerting otherwise , so it was easy. the below were combined with node_exporter (specially storage io metrics)
should be a good start.
PostgreSQL Database dashboard for Grafana | Grafana Labs would be the corresponding grafana dashboard.
and alerting queries for this exporter
these are very basics to start with, feel free to improvise.
the below utils are also very much handy.
pg_stat_monitor/USER_GUIDE.md at master · percona/pg_stat_monitor (github.com) (new but i like the option to check query plan via sql query)
I shared much more than asked, feel free to discard what is not needed.
I would recommend https://github.com/Vonng/pg_exporter for some reasons:
Support both Postgres & Pgbouncer
Flexible: Almost all metrics are defined in customizable configuration files in SQL style.
Fine-grained execution control: Tags Filter, Facts Filter, Version Filter, Timeout, Cache, etc..
Dynamic Planning: you could define multiple branches for a collecto. Queries matches server version & fact & tags will be actually executed.
Configurable caching policy & query timeout
Rich metrics about pg_exporter itself.
Auto discovery multi-database in the same instance
Tested and verified in real world production environment for 3+ years (200+ Nodes)
The most important part is: it has a complete solution for monitoring & dashboards:
Dashboards screenshots: https://github.com/Vonng/pigsty/raw/master/docs/_media/overview-monitor.jpg
2021年11月9日 02:49,Victor Sudakov <vas@sibptus.ru> 写道:Dear Colleagues,
What good Prometheus exporter for Postgres can you recommend (from your own experience)?
--
Victor Sudakov VAS4-RIPE
http://vas.tomsk.ru/
2:5005/49@fidonet
Hello Ruohang! I've installed pg_exporter (very simple setup) and indeed I'm impressed. All the metrics are customizable and the default set of metrics in the stock config is impressive. You are the author so can I ask a few questions? 1. Are you providing an official docker image, or a single binary I could just ADD to a docker image, without the additional RUN steps for curl'ing and unpacking? An official docker image would be best of course. 2. I don't think I'm presently going to use the whole of Pigsty, we are already using some in-house scripts over Patroni, but a collection of Grafana dashboards using the pg_exporter metrics is something I'd love having. Is it possible to get them separately from Pigsty? The exporter itsef is grand! Ruohang Feng wrote: > I would recommend https://github.com/Vonng/pg_exporter for some reasons: > > Support both Postgres & Pgbouncer > Flexible: Almost all metrics are defined in customizable configuration files in SQL style. > Fine-grained execution control: Tags Filter, Facts Filter, Version Filter, Timeout, Cache, etc.. > Dynamic Planning: you could define multiple branches for a collecto. Queries matches server version & fact & tags willbe actually executed. > Configurable caching policy & query timeout > Rich metrics about pg_exporter itself. > Auto discovery multi-database in the same instance > Tested and verified in real world production environment for 3+ years (200+ Nodes) > > > The most important part is: it has a complete solution for monitoring & dashboards: > > https://github.com/Vonng/pigsty > https://pigsty.cc <https://pigsty.cc/> > > > Dashboards screenshots: https://github.com/Vonng/pigsty/raw/master/docs/_media/overview-monitor.jpg > > > > > 2021年11月9日 02:49,Victor Sudakov <vas@sibptus.ru> 写道: > > > > Dear Colleagues, > > > > What good Prometheus exporter for Postgres can you recommend (from your own experience)? > > > > -- > > Victor Sudakov VAS4-RIPE > > http://vas.tomsk.ru/ > > 2:5005/49@fidonet > > > -- Victor Sudakov VAS4-RIPE http://vas.tomsk.ru/ 2:5005/49@fidonet
Hello Vijaykumar! Thank you for your useful links. I've just installed prometheus-community/postgres_exporter and it is working. It is also useful that it comes with a ready Grafana dashboard. I've installed Grafana dashboard "9628" and found it not very useful (in comparison e.g. with the standard Zabbix PostgreSQL template), but maybe I've not invested enough time studying it. I have not looked at the alerter yet. Vijaykumar Jain wrote: > On Tue, 9 Nov 2021 at 00:19, Victor Sudakov <vas@sibptus.ru> wrote: > > > > > What good Prometheus exporter for Postgres can you recommend (from your > > own experience)? > > > I have not got a lot of exposure with prometheus, but was able to quickly > set up using below, > but I was aware of monitoring and alerting otherwise , so it was easy. the > below were combined with node_exporter (specially storage io metrics) > > prometheus-community/postgres_exporter: A PostgreSQL metric exporter for > Prometheus (github.com) > <https://github.com/prometheus-community/postgres_exporter> > should be a good start. > PostgreSQL Database dashboard for Grafana | Grafana Labs > <https://grafana.com/grafana/dashboards/9628> would be the corresponding > grafana dashboard. > > and alerting queries for this exporter > Awesome Prometheus alerts | Collection of alerting rules (grep.to) > <https://awesome-prometheus-alerts.grep.to/rules.html#postgresql-1> > > these are very basics to start with, feel free to improvise. > > the below utils are also very much handy. > > NikolayS/postgres_dba: The missing set of useful tools for Postgres DBAs > and all engineers (github.com) <https://github.com/NikolayS/postgres_dba> > dataegret/pg-utils: Useful PostgreSQL utilities (github.com) > <https://github.com/dataegret/pg-utils> > pg_stat_monitor/USER_GUIDE.md at master · percona/pg_stat_monitor > (github.com) > <https://github.com/percona/pg_stat_monitor/blob/master/docs/USER_GUIDE.md> > (new but i like the option to check query plan via sql query) > > <https://github.com/prometheus-community/postgres_exporter>and the most > important wrt logs. > pgBadger Documentation (darold.net) > <https://pgbadger.darold.net/documentation.html> > <https://pgbadger.darold.net/documentation.html> > I shared much more than asked, feel free to discard what is not needed. -- Victor Sudakov VAS4-RIPE http://vas.tomsk.ru/ 2:5005/49@fidonet
Hi Victor: 1. There is no official docker image. But there's a dockerfile: https://github.com/Vonng/pg_exporter/blob/master/Dockerfile It is a single binary that could be just ADD to a docker image, and receive parameters via ENVIRONMENT. Maybe I would create an image in dockerhub in next minor release. 2. You can setup monitoring staff manually with following resources: Grafana Dashboards: https://github.com/Vonng/pigsty/tree/master/roles/grafana/files/dashboards/pgsql Prometheus Config: https://github.com/Vonng/pigsty/blob/master/roles/prometheus/files/example/prometheus-static.yml Prometheus Rules: https://github.com/Vonng/pigsty/blob/master/roles/prometheus/files/rules/pgsql-rules.yml Prometheus Targets: https://github.com/Vonng/pigsty/blob/master/roles/register/tasks/prometheus.yml PG Exporter Config: https://github.com/Vonng/pigsty/blob/master/roles/monitor/files/pg_exporter.yml Another option is only using the monitoring part of Pigsty which could setup everything automatically.
Install pigsty on a standalone machine, and it can be used for monitoring existing external postgres instances (with a viable PGURL only). http://demo.pigsty.cc/d/home Regards~
2021年11月9日 17:55,Victor Sudakov <vas@sibptus.ru> 写道:Hello Ruohang!
I've installed pg_exporter (very simple setup) and indeed I'm
impressed. All the metrics are customizable and the default set of
metrics in the stock config is impressive.
You are the author so can I ask a few questions?
1. Are you providing an official docker image, or a single binary I
could just ADD to a docker image, without the additional RUN steps for
curl'ing and unpacking? An official docker image would be best of
course.
2. I don't think I'm presently going to use the whole of Pigsty, we
are already using some in-house scripts over Patroni, but a collection
of Grafana dashboards using the pg_exporter metrics is something I'd
love having. Is it possible to get them separately from Pigsty?
The exporter itsef is grand!
Ruohang Feng wrote:I would recommend https://github.com/Vonng/pg_exporter for some reasons:
Support both Postgres & Pgbouncer
Flexible: Almost all metrics are defined in customizable configuration files in SQL style.
Fine-grained execution control: Tags Filter, Facts Filter, Version Filter, Timeout, Cache, etc..
Dynamic Planning: you could define multiple branches for a collecto. Queries matches server version & fact & tags will be actually executed.
Configurable caching policy & query timeout
Rich metrics about pg_exporter itself.
Auto discovery multi-database in the same instance
Tested and verified in real world production environment for 3+ years (200+ Nodes)
The most important part is: it has a complete solution for monitoring & dashboards:
https://github.com/Vonng/pigsty
https://pigsty.cc <https://pigsty.cc/>
Dashboards screenshots: https://github.com/Vonng/pigsty/raw/master/docs/_media/overview-monitor.jpg2021年11月9日 02:49,Victor Sudakov <vas@sibptus.ru> 写道:
Dear Colleagues,
What good Prometheus exporter for Postgres can you recommend (from your own experience)?
--
Victor Sudakov VAS4-RIPE
http://vas.tomsk.ru/
2:5005/49@fidonet
--
Victor Sudakov VAS4-RIPE
http://vas.tomsk.ru/
2:5005/49@fidonet
Ruohang Feng wrote: > Hi Victor: Hi Ruohang! > > 1. > > There is no official docker image. But there's a dockerfile: https://github.com/Vonng/pg_exporter/blob/master/Dockerfile > > It is a single binary that could be just ADD to a docker image, and receive parameters via ENVIRONMENT. > > Maybe I would create an image in dockerhub in next minor release. That would be great because I'd be able to use the image directly from dockerhub in my manifests, much like I use nginx, phpfpm and other official images, without copying the binary and running `docker build` somewhere. > 2. > > > You can setup monitoring staff manually with following resources: > > Grafana Dashboards: https://github.com/Vonng/pigsty/tree/master/roles/grafana/files/dashboards/pgsql Thanks a lot. I have looked at them and decided that I'll probably start by creating some dashboards from scratch using the metrics from your excellent exporter. -- Victor Sudakov VAS4-RIPE http://vas.tomsk.ru/ 2:5005/49@fidonet