Nagios "check_pgactivity" failed

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
admincauce
Posts: 34
Joined: Wed Sep 19, 2018 3:20 am

Nagios "check_pgactivity" failed

Post by admincauce »

Hi

I'm trying to monitor several Postgres 10 servers in my Nagios, and I downloaded the "check_pgactivity" plugin from https://exchange.nagios.org/directory/P ... ty/details

I have seen that this plugin is valid for Postgres version 10.

I have configured the check in the postgres server as follows:

command [check_pgactivity_connection] = / usr / lib / nagios / plugins / check_pgactivity -h localhost -s connection

I make the NRPE call from the Nagios server in the following way:

[root @ GESNAG00] # / usr / local / nagios / libexec / check_nrpe -H 10.203.227.3 -c check_pgactivity_connection

Command output:

CHECK_PGACTIVITY UNKNOWN: Query failed!
Password:
psql: fe_sendauth: no password supplied


If I launch this check locally on the Postgres server, it asks for a password from the "postgres" user, which is the default user.

In the documentation I do not see by any means how to configure the authentication of the user that happened to him by parameter, either the user "postgres" by defect or another user that has been created.

Thank you very much in advance.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios "check_pgactivity" failed

Post by scottwilkerson »

Here is an issue on the projects github page with the same question, an a proposed work around
https://github.com/OPMDG/check_pgactivity/issues/92
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
admincauce
Posts: 34
Joined: Wed Sep 19, 2018 3:20 am

Re: Nagios "check_pgactivity" failed

Post by admincauce »

Thank you very much for the quick answer

I have put into practice what you suggest in the link that you have passed me. I tell you the results:

- If I launch the check to test it directly on my Postgres server, I get the result of the check. In this example, it's about the "connection" service

root @ BBDPGS10: ~ # sudo -u postgres / usr / lib / nagios / plugins / check_pgactivity -h / var / run / postgresql --service connection
POSTGRES_CONNECTION OK: Connection successful at 2018-10-25 14: 11: 38.654818 + 01

Now I configure the file nrpe.cfg to add the command and to be executed by nrpe from the Nagios server. The command in the nrpe.cfg file is as follows:

command [check_pgactivity_connection] = sudo -u postgres / usr / lib / nagios / plugins / check_pgactivity -h / var / run / postgresql --service connection

Now, I make the call from my Nagios, and I get the following:

[root @ GESNAG00 ~] # / usr / local / nagios / libexec / check_nrpe -H 10.203.227.3 -c check_pgactivity_connection
NRPE: Unable to read output

That could be happening?

Thank you very much in advance.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios "check_pgactivity" failed

Post by scottwilkerson »

so you have this set as your command in your nrpe config and can run it as root:

Code: Select all

sudo -u postgres /usr/lib/nagios/plugins/check_pgactivity -h /var/run/postgresql --service connection
but can the user NRPE is running as execute that command?

Code: Select all

su nagios

sudo -u postgres /usr/lib/nagios/plugins/check_pgactivity -h /var/run/postgresql --service connection
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked