Skip to content

Latest commit

 

History

History
102 lines (65 loc) · 4.28 KB

04_prometheus.md

File metadata and controls

102 lines (65 loc) · 4.28 KB

Prometheus metrics for pgagroal

This tutorial will show you how to do basic Prometheus{:target="_blank"} setup for pgagroal.

pgagroal is able to provide a set of metrics about what it is happening within the pooler, so that a Prometheus instance can collect them and help you monitor the pooler.

Preface

This tutorial assumes that you have already an installation of PostgreSQL 12 (or higher) and pgagroal.

In particular, this tutorial refers to the configuration done in Install pgagroal.

Change the pgagroal configuration

In order to enable to export of the metrics, you need to add the metrics option in the main pgagroal.conf configuration. The value of this setting is the TCP/IP port number that Prometheus will use to grab the exported metrics.

Add a line like the following to /etc/pgagroal/pgagroal.conf by editing such file with your editor of choice:

metrics = 2346

Place it withingr the [pgagroal] section, like

[pgagroal]
...
metrics = 2346

This will bind the TCP/IP port number 2346 to the metrics export.

See the pgagroal configuration settings with particular regard to metrics, metrics_cache_max_age and metrics_cache_max_size for more details.

Restart pgagroal

In order to apply changes, you need to restart pgagroal, therefore run the following commands as the pgagroal operating system user:

pgagroal-cli -c /etc/pgagroal/pgagroal.conf shutdown
pgagroal -c /etc/pgagroal/pgagroal.conf -a /etc/pgagroal/pgagroal_hba.conf

If you need to specify other configuration files, for example for remote management (see the related tutorial), add them on the pgagroal command line. If the cofiguration files have standard names, you can omit them.

Get Prometheus metrics

Once pgagroal is running you can access the metrics with a browser at the pooler address, specifying the metrics port number and routing to the /metrics page. For example, point your web browser at:

http://localhost:2346/metrics

It is also possible to get an explaination of what is the meaning of each metric by pointing your web browser at:

http://localhost:2346/

Prometheus metrics for pgagroal-vault

This tutorial will show you how to do basic Prometheus{:target="_blank"} setup for pgagroal-vault.

pgagroal-vault is able to provide a set of metrics about what it is happening within the vault, so that a Prometheus instance can collect them and help you monitor the vault activities.

Change the pgagroal-vault configuration

In order to enable to export of the metrics, you need to add the metrics option in the main pgagroal_vault.conf configuration. The value of this setting is the TCP/IP port number that Prometheus will use to grab the exported metrics.

Add a line like the following to /etc/pgagroal/pgagroal_vault.conf by editing such file with your editor of choice:

metrics = 2501

Place it within the [pgagroal-vault] section, like

[pgagroal-vault]
...
metrics = 2501

This will bind the TCP/IP port number 2501 to the metrics export.

See the pgagroal-vault configuration settings with particular regard to metrics, metrics_cache_max_age and metrics_cache_max_size for more details.

Get Prometheus metrics

Once pgagroal-vault is running you can access the metrics with a browser at the pgagroal-vault address, specifying the metrics port number and routing to the /metrics page. For example, point your web browser at:

http://localhost:2501/metrics

It is also possible to get an explaination of what is the meaning of each metric by pointing your web browser at:

http://localhost:2501/