ObserveNow
...
Integrations
Infrastructure
PostgreSQL
opsverse's kubernetes agent https //docs opsverse io/install the opsverse agent#veqxm can be used to collect metrics from postgresql databases in order to collect metrics from postgresql, you must first enable the pg stat statements https //www postgresql org/docs/current/static/pgstatstatements html extension which generates postgresql metrics verify pg stat statements is installed run the following command in your database to check if pg stat statements is enabled show shared preload libraries; if you do not see an entry for pg stat statements , you can install it using the next step otherwise, skip to the enable on your database section install pg stat statements add the following snippet into your postgresql conf file shared preload libraries = 'pg stat statements' restart your postgresql server and verify you have pg stat statements enabled instances running postgresql 11+ and should have pg stat statements enabled by default but if not, you can follow their respective documentation on enabling pg stat statements in your postgresql server enable pg stat statements on your database connect to the postgresql database you want to collect metrics from and install pg stat statements using the following commands \c mydatabase mydatabase=# create extension if not exists pg stat statements; configure opsverse agent to collect metrics from postgresql add the following yaml snippets to the agent's values yaml and run the agent based on these instructions https //docs opsverse io/install the opsverse agent#veqxm first enable the postgres exporter by adding the following yaml snippet in the agent values \# enabled the postgres exporter in the agent postgres exporter enabled true annotations prometheus io/scrape 'true' once the postgres exporter in configured, add the extrascrapeconfigs under victoria metrics agent (must be already present in the agent values) as below victoria metrics agent extrascrapeconfigs \ job name 'postgres' static configs \ targets \ postgresql //\<username> \<password>@\<server> 5432 \ postgresql //\<username> \<password>@\<server> 5432/?sslmode=disable # use sslmode=disable param if ssl is disabled metrics path /probe relabel configs \ source labels \[ address ] target label param target \ source labels \[ param target] target label instance \ source labels \[instance] regex 'postgresql //\[^ ]+ \[^@]+@(\[^ ]+) \[0 9]+ ' target label instance replacement '${1}' \ target label address replacement devopsnow agent postgres exporter devopsnow\ svc cluster local reinstall the helm chart with the updated values yaml file and you should see the postgres exporter pod come up and postgres metrics should have started flowing into your observenow instance you may need to use sslmode require in the config above with amazon rds postgresql instances since amazon rds forces ssl connections since postgresql 15+ alternatively, you can disable the force ssl behaviour on amazon rds by following these instructions https //stackoverflow\ com/a/77787495 (requires a server restart) single machine alternatively, you can install the prometheus postgres exporter https //github com/prometheus community/postgres exporter on a single machine prerequisite(s) you have the opsverse agent running on the machine https //docs opsverse io/install the opsverse agent#dszlx run this command to install the postgres exporter as a systemd unit \# for amd64 curl https //raw\ githubusercontent com/opsverseio/installers/main/prometheus exporters/install exporter amd64 sh | sudo bash s e postgres \# for arm64 curl https //raw\ githubusercontent com/opsverseio/installers/main/prometheus exporters/install exporter arm64 sh | sudo bash s e postgres first you need to update postgres user and password info , after you install, you may edit /etc/opsverse/exporters/postgres/postgres exporter env and then restart the service the agent will begin scraping the metrics automatically; the script will drop the scrape target into /etc/opsverse/targets/ , so the agent will begin automatically scraping