Checmk and postgres monitoring

Hello folks, I need to configure the checkmk postgres plugin to start monitoring the same application.
I already download the mk_postgres_2.py and put inside the /usr/lib/check_mk_agent/plugins folder.
Also created a postgres.cfg file inside /etc/check_mk/ with these parameters:

DBUSER=dbuser
INSTANCE=/home/centos/.env:dbuser:/home/centos/.pgpass

But when I run the command python mk_postgres.py, I can’t connect with the database.
I tried to search more about this plugin in documentation and forum posts but nothing helps until now.
Also my postgres database don’t use the default values for user, password, database and port.
How I can make this works with checkmk postgres plugin?

Hi,

Looks like you installed the Python 2 version of the plugin. ( mk_postgres_2.py). Maybe you should replace it with the Python 3 version ( mk_postgres.py)

After install python3 and use the mk_postgres.py plugin, nothing changes. The script continues asking for password like described in this another post forum, but can’t connect with the database to get metrics.

su: user username does not exist
su: user username does not exist
su: user username does not exist
su: user username does not exist
<<<postgres_instances>>>
[[[]]]
26125 /usr/pgsql-14/bin/postmaster -D /usr/local/pgsql/14/data
<<<postgres_stat_database:sep(59)>>>
[[[]]]

<<<postgres_version:sep(1)>>>
[[[]]]

<<<postgres_conn_time>>>
[[[]]]
0.002

For me looks like something with my config files, but I don’t find a solution to this.

Just out of curiosity, you mention that you run the plugin from the command line. It looks like it’s not using your configuration. Did you set the environment variable MK_CONFDIR prior to running the script?

Something like:
export MK_CONFDIR=/etc/check_mk/

might help.

So after trying this, the result above does not change.
Also, I tried to use the docker plugin with python2.7 version, and works as expected.
I think the python version is not the problem. Maybe is something with my config file but can’t understand why it’s wrong.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.