Provides Patroni related metrics for Prometheus.
This exporter scrapes Patroni API (https://github.com/zalando/patroni) and transforms the obtained information into Prometheus-scrapable (https://prometheus.io/) format.
The following commandline arguments are available:
- port:
-p,--portspecifies the port it should listen at - bind:
-b,--bindspecifies the address to bind to - patroni url:
-u,--patroni-urlspecifies the full to path the patroni API endpoint - debug:
-d,--debugenables debug output - timeout:
-t,--timeoutconfigures the timeout for patroni API - address family:
-a,--address-familychooses which adress family to use. Eitheripv4(AF_INET) oripv6(AF_INET6). If listening on bothipv6andipv4is required,AF_INET6and a bind to '' or '::' must be used (the unfortunate side-effect is that it listens on all interfaces) - requests verify:
--requests-verifyAcceptstrue|false, in which case it controls whether Python's requests library verifies the server's TLS certificate. It also accepts a path to a CA bundle to use. Defaults totrue
This service also responds on the /health endpoint and can be monitored this way.
The /metrics endpoint is designated for the prometheus scraping.
The default 9547 port has been reserved on https://github.com/prometheus/prometheus/wiki/Default-port-allocations
Requires python >= 3.6 because of the usage of f-strings and type hints.
There is a simple Dockerfile which allows you to run patroni-exporter in the Docker container.
Usage example:
- Build
patroni-exporterdocker image.
docker build -t patroni_exporter .
- Run Docker container. Don't forget to pass required commandline arguments at the end of the
runcommand.
docker run -d -ti patroni_exporter --port some_port --patroni-url http://some_host_fqdn:some_port/patroni --timeout 5 --debug