Postgres check can not find executable!

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
S54326
Posts: 31
Joined: Fri Mar 28, 2014 9:30 am

Postgres check can not find executable!

Post by S54326 »

Hi, I've tried setting up a Postgres query check but when Nagios runs the check it can't find the psql executable.
I started with the Postgres Query wizard, so it's using the check_xi_postgres_query command. That command uses check_postgres.pl plugin.
I reverted to the CLI to verify the syntax of the query. I'm now using the simplest query of "SELECT Count(name) AS num FROM mi_user_ldap_group" and still the same error.

From the command line as root AND as nagios the command works fine. For example as the user nagios with pwd of /tmp -

Code: Select all

[nagios]$ /usr/local/nagios/libexec/check_postgres.pl -H hisas115.sussex.nhs.uk --port=5432 --dbuser=<dbuser> --dbpass="<dbpassword>" --dbname=mireportdb --action=custom_query -query="SELECT Count(name) AS num FROM mi_user_ldap_group" -warning=850 --critical=880
POSTGRES_CUSTOM_QUERY CRITICAL: DB "mireportdb" (host:hisas115.sussex.nhs.uk) 1088 | time=0.03
The executable obviously exists

Code: Select all

[nagios]$  whereis psql
psql: /usr/bin/psql /usr/share/man/man1/psql.1.gz
[nagios]$ file /usr/bin/psql
/usr/bin/psql: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
The service status detail web page shows this

Code: Select all

ERROR: Could not find a suitable psql executable

[which: no psql in (/usr/lib64/mpi/gcc/openmpi/bin:/home/nagios/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games)] 
So the psql executable is in /usr/bin and the it looks like the plugin includes /usr/bin in it's path - but can't find psql !!!!!!!!!!!!

Has anyone managed to get a Postgres query to work?

Our system is Nagios XI 2014R2.0.
Steve
S54326
Posts: 31
Joined: Fri Mar 28, 2014 9:30 am

Re: Postgres check can not find executable!

Post by S54326 »

Scratch this, I've sussed out the issue. Postgres checks are now working.
Steve
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Postgres check can not find executable!

Post by jdalrymple »

Steve - before locking and marking solved, can you identify for us what the issue was?

Thanks.
Locked