Almost all who use Prometheus and PostgreSQL know about postgres_exporter. It is quite easy to start to use this exporter. It also have
metrics extending capabilities. Using SQL query, it is possible to describe your own metrics and collect them. Having good knowledge about Postgres stats it is possible to collect a lot of metrics. But, often with PostgreSQL there are many other Postgres-related tools are used, connection pools for example (e.g. Pgbouncer, Odyssey, etc). Metrics about all of them also have to be collected. It means extra exporters have to be installed.
With pgSCV I tried to solve both issues.
The first. pgSCV can collect almost all metrics from PostgreSQL with no additional configuration made by user. This make step of getting started is easy. Instead of wasting time on configuring and defining necessary metrics, they could be collected right now. By the way, ability to define your own, custom metrics also is present in pgSCV. Here is might be a question — What if there are too many metrics and user might not need some of them? In this case, it is possible to disable collecting some metrics or limit databases from which metrics should be collected.
The second. Currently, pgSCV can collect metrics from operating system, PostgreSQL and Pgbouncer. For this, it automatically discovers services and starts collecting metrics. Obviously, valid credentials for connecting to service should be passed. Collecting metrics is not limited by only locally discovered services. It is also possible to define remote services and collect metrics from them.
The basic usecase requires a created user and starting pgSCV. In example below, it is supposed the user is already created.
$ curl -O -L https://github.com/weaponry/pgscv/releases/download/v0.5.0/pgscv_0.5.0_linux_amd64.tar.gz
$ tar xvzf pgscv_0.5.0_linux_amd64.tar.gz
$ cat << EOF > pgscv.yaml
$ ./pgscv — config-file pgscv.yaml
After start, open the second terminal and get metrics using “curl -s 127.0.0.1:9890/metrics” command.
Note, pgSCV was created for Weaponry needs (my project related to monitoring PostgreSQL and everything around it), but now pgSCV is quite mature and stable to wide usage.
That is all. If you have thoughts, ideas, you found a bug, or just would like to ask something or say Hello — let me know on discussions or issues page.
Some links in the end: