pgSCV - PostgreSQL ecosystem metrics collector.
- collects a lot of stats about PostgreSQL environment.
- exposes metrics through the HTTP
/metricsendpoint in Prometheus metrics exposition format.
- Supported services: PostgreSQL, Pgbouncer, Patroni, metrics of operating system.
- Pull mode. pgSCV can listen on
/metricsendpoint and serving requests from
- Push mode. pgSCV can scrape its own
/metricsendpoint and push scraped metrics to specified HTTP service. This feature primarily used for sending metrics to Weaponry SaaS, but not limited by this purpose.
- TLS and authentication.
/metricsendpoint could be protected with basic authentication and TLS.
- Collecting metrics from multiple services. pgSCV can collect metrics from many databases instances.
- Services auto-discovery. pgSCV can automatically discover Postgres and other Postgres-ecosystem services and start collecting metrics from them. In case of authentication, valid requisites should be specified.
- Remote services support. pgSCV is recommended to start on the same systems where monitored services are running. But this is not strict and pgSCV could connect and collect metrics from remote services.
- Bootstrap. pgSCV can bootstrap itself - it is one-time procedure, during bootstrap pgSCV installs itself into system path, creates minimal required configuration, installs systemd unit and starts itself. Requires root privileges.
- Auto-update. pgSCV can track new releases and update itself. This feature is mostly useful for Weaponry users. Requires root privileges.
- User-defined metrics. pgSCV could be configured in a way to collect metrics defined by user.
- Collectors management. Collectors could be disabled if necessary.
- Collectors filters. Collectors could be adjusted to skip collecting metrics based on labels values, like block devices, network interfaces, filesystems, users, databases, etc.
- can run on Linux only; can connect to remote services running on other OS/PaaS.
- requisites for connecting to the services, such as login and password.
- database user should have privileges for executing stats functions and reading views. For more details see security considerations.
Download the archive from releases. Unpack the archive. Start pgSCV under
wget https://github.com/weaponry/pgscv/releases/download/v0.6.0/pgscv_0.6.0_linux_amd64.tar.gz tar xvzf pgscv_0.6.0_linux_amd64.tar.gz sudo -u postgres ./pgscv
or using Docker, use
DATABASE_DSN for setting up a connection to Postgres:
docker pull weaponry/pgscv:latest docker run -ti -e PGSCV_LISTEN_ADDRESS=0.0.0.0:9890 -e PGSCV_DISABLE_COLLECTORS="system" -e DATABASE_DSN="postgresql://postgres@dbhost/postgres" -p 9890:9890 weaponry/pgscv:latest
When pgSCV has been started it is ready to accept HTTP requests at
pgSCV complete setup is possible in two ways:
- For non-Weaponry users. Setup as a standalone service, which accepts metrics scrape requests only. Checkout complete setup guide.
- For Weaponry users. Setup as an agent of Weaponry SaaS, which receives metrics to Weaponry service. Checkout complete setup guide. Listening for scrape requests also work.
For further documentation see wiki.
Support and feedback
If you need help using pgSCV feel free to open discussion or create an issue
Development and contribution
To help development you are encouraged to:
BSD-3. See LICENSE for more details.