Page 1 of 2

Return code of 255 is out of bounds

Posted: Sat Oct 11, 2014 9:56 am
by iptribe
Hi guys,

Currently, I am using Nagios XI to monitor my database(Postgresql). However, on my webpage the service of monitoring database connection is always state as "Return code of 255 is out of bounds".

On my Nagios Server, when I execute below command, it's working fine.
/user/local/nagios/libexec/check_postgres.pl -H <remote ip> -p <port> -db <database> -u <user> --action=connection

The output return as ok:
POSTGRES_CONNECTION OK: DB "postgres" (host:192.168.1.123) version 9.3.4 | time=7.73s

On the CCM, when I run the test check command is also working fine. However, the webpage still state as "Return code of 255 is out of bounds".
Any advice for this issue?

Re: Return code of 255 is out of bounds

Posted: Mon Oct 13, 2014 9:14 am
by tmcdonald
Try running that as the nagios user and see what the exit code is:

Code: Select all

su - nagios
/usr/local/nagios/libexec/check_postgres.pl -H <remote ip> -p <port> -db <database> -u <user> --action=connection
echo $?
exit

Re: Return code of 255 is out of bounds

Posted: Wed Oct 15, 2014 8:11 am
by iptribe
I have tried the command you provided on my nagios server, it will prompt up a password authentication, after I input the database password it return the output which shown as below:

POSTGRES_CONNECTION OK: DB "mytestdb" (host:192.168.1.100) version 9.3.4 | time=10.20

However, in my nagios Xi webpage is still stating as return code 255 is out of bound.

Re: Return code of 255 is out of bounds

Posted: Wed Oct 15, 2014 10:44 am
by Box293
iptribe wrote:I have tried the command you provided on my nagios server, it will prompt up a password authentication
So, in that case when the plugin is run by nagios it is prompting for a password.

When I run check_postgres.pl --help I get the following information:
-u --dbuser=NAME database user(s) to connect as; defaults to 'postgres'
--dbpass=PASS database password(s); use a .pgpass file instead when possible
--dbservice=NAME service name to use inside of pg_service.conf

Re: Return code of 255 is out of bounds

Posted: Wed Oct 15, 2014 11:00 pm
by iptribe
I also have tried on Nagios Server with this command:

/usr/local/nagios/libexec/check_postgres.pl -H <remote ip> -p <port> -db <database> -u <user> --dbpass=password --action=connection, and it's working fine in command line and also in the CCM when I test check command is also display the correct output.

However, on the Nagios XI service webpage, my service still state as "Return code of 255 is out of bounds".

Re: Return code of 255 is out of bounds

Posted: Thu Oct 16, 2014 6:46 am
by lmiltchev
Is your service defined properly? Is is using the same command as the one that you tested from the CLI? Go to the CCM->Services-><your service>->View Text Output, and show us the service definition. Hide sensitive info.

Re: Return code of 255 is out of bounds

Posted: Thu Oct 16, 2014 11:01 am
by iptribe
Here is my service.....

define service {
host_name WCAS-DB
service_description Postgres Database Connection - db
use xiwizard_postgresdb_service
check_command check_postgres!-H <ip> -p <port> -db <db> -u <user> --dbpass=<password> --action=connection!!!!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
notifications_enabled 1
contacts nagiosadmin
contact_groups null
_xiwizard postgresdb
register 1
}

define service {
host_name WCAS-DB
service_description Postgres Database Size - db
use xiwizard_postgresdb_service
check_command check_postgres!-H <ip> -p <port> -db <db> -u <user> --dbpass=<password> --action=database_size --include=db -w 500M -c 800M!!!!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
contacts nagiosadmin
_xiwizard postgresdb
register 1
}

Re: Return code of 255 is out of bounds

Posted: Thu Oct 16, 2014 12:01 pm
by Box293
Can you also please give us the command definition for check_postgres

Re: Return code of 255 is out of bounds

Posted: Thu Oct 16, 2014 12:03 pm
by lmiltchev
How this servces were created? Did you run our Postgres Database wizard?

The "default" command that is used is:

Code: Select all

check_command			check_xi_postgres_db!...
which uses "check_postgres.pl"...

You have:

Code: Select all

check_command check_postgres!...
Can you show us the "check_postgres" command definition?

Re: Return code of 255 is out of bounds

Posted: Thu Oct 16, 2014 9:09 pm
by iptribe
I have tried the default command before, but it didn't work for me. The CCM using this command is working fine, but also display the "Return code of 255 is out of bounds" on my service status.

Code: Select all

define command {
       command_name                  		check_xi_postgres_db
       command_line                  		$USER1$/check_postgres.pl $ARG1$
}	
Then I tried create another command name but with the same plugins which I am using now. But the result is same as the default command.

Code: Select all

define command {
       command_name                  		check_postgres
       command_line                  		$USER1$/check_postgres.pl $ARG1$
}	
I also have updated the check_postgres.pl plugin to the latest version 2.21.0, please see my attachment. Any advice for this issue?