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.03Code: 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, strippedCode: 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)] Has anyone managed to get a Postgres query to work?
Our system is Nagios XI 2014R2.0.