Return code of 255 is out of bounds

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
iptribe
Posts: 52
Joined: Sun Aug 31, 2014 11:03 am

Return code of 255 is out of bounds

Post 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?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Return code of 255 is out of bounds

Post 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
Former Nagios employee
iptribe
Posts: 52
Joined: Sun Aug 31, 2014 11:03 am

Re: Return code of 255 is out of bounds

Post 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.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Return code of 255 is out of bounds

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
iptribe
Posts: 52
Joined: Sun Aug 31, 2014 11:03 am

Re: Return code of 255 is out of bounds

Post 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".
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Return code of 255 is out of bounds

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
iptribe
Posts: 52
Joined: Sun Aug 31, 2014 11:03 am

Re: Return code of 255 is out of bounds

Post 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
}
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Return code of 255 is out of bounds

Post by Box293 »

Can you also please give us the command definition for check_postgres
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Return code of 255 is out of bounds

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
iptribe
Posts: 52
Joined: Sun Aug 31, 2014 11:03 am

Re: Return code of 255 is out of bounds

Post 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?
You do not have the required permissions to view the files attached to this post.
Locked