PostgreSQL monitoring in checkmk 2.2

Hi,

Can someone please let me know whether we can monitor below postgres monitoring metrics in checkmk 2.2 using plugin mk_postgres?

Service monitoring rules :

PostgreSQL database bloat
PostgreSQL VACUUM and ANALYZE
PostgreSQL Sessions
PostgreSQL database connections
PostgreSQL Locks
PostgreSQL Database Statistics

Enforced services :

PostgreSQL Sessions
PostgreSQL database connections
PostgreSQL database bloat
PostgreSQL VACUUM and ANALYZE
PostgreSQL Locks
PostgreSQL Database Statistics

I’m using the mk_postgres plugin and checkmk 2.2. But the agent is fetching the metrics from plugin when we run the agent manually. The same it is not showing the metrics in agent output in the console when we give connection test . what could be the reason ?
Is these metrics are not applicable for this checkmk version?

Hello, With which user you run the agent manually?

Running the agent manually as root user.(linux server).

It is fetching the data from the plugin. But when we run the service discovery… nothing is coming from the plugin mk_postgres. also, checked the same by running connection test from the checkmk console. that agent output also don’t have anything from mk_postgres

The solution which I found is, the postgres.cfg file should have the variable PG_BINARY_PATH. so that the agent can identify the bin location of psql and use the same to connect the postgres instances. Two things here you need to do.

  1. Declare PG_BINARY_PATH in postgres.cfg
  2. PG_HOST variable in .bash_profile file of postgres user. (If unix socket path is set to different locations other than /tmp or /var/run/postgresql