Page 1 of 1

Nagios: Return code of 7 is out of bounds

Posted: Sun Dec 09, 2018 12:37 pm
by mouli449
Services are up and running on the remote nodes. CLI execution returns OK, but in UI it returning CRITICAL with Status Information:'Return code of 7 is out of bounds'

nagios-xxxxxxxx:~# /usr/lib/nagios/plugins/check_tcp -H hostname -p 8326 -w 5 -c 10 -t 60

TCP OK - 0.002 second response time on hostname port 8326|time=0.001642s;5.000000;10.000000;0.000000;60.000000

Can someone help me in fixing it?

Nagios log:

[1543834668] Warning: Return code of 7 for check of service 'repbiz-8891' on host was out of bounds.
[1543834669] Warning: Return code of 7 for check of service 'haproxy-29304' on host was out of bounds.
[1543834669] Warning: Return code of 7 for check of service 'haproxy-29312' on host was out of bounds.
[1543834669] Warning: Return code of 7 for check of service 'haproxy-29326' on host was out of bounds.
[1543834671] Warning: Return code of 7 for check of service 'haproxy-08888' on host was out of bounds.

Re: Nagios: Return code of 7 is out of bounds

Posted: Mon Dec 10, 2018 4:29 pm
by cdienger
Try switching to the nagios users before running teh check command:

su - nagios
/usr/lib/nagios/plugins/check_tcp -H hostname -p 8326 -w 5 -c 10 -t 60


Do you get an error or is it still successful?

Please provide the config for the services as well as the command definition if the above doesn't help resolve the problem.

Re: Nagios: Return code of 7 is out of bounds

Posted: Tue Dec 11, 2018 5:34 am
by mouli449
with nagios/nagios4 user it results good in CLI. But proble with nagios UI. CommandLine resulting good but not UI resulting (Return code of 7 is out of bounds) . I am adding the screenshot of UI for your reference.

All our services are running with nagios4 user. Most of the services are resulting good.
sudo -Hu nagios4 /usr/lib/nagios/plugins/check_tcp -H hostname -p 8888 -w 5 -c 10 -t 60
TCP OK - 0.003 second response time on repbiz-backend-i-037f397110411230a.b.prod.eng-us port 8888|time=0.002768s;5.000000;10.000000;0.000000;60.000000

recently we increased the server count in nagios. seems it caused the issues.

Tried one of solution provided in the forum[https://support.nagios.com/forum/viewto ... 10#p220778], but no luck.

Thanks

Re: Nagios: Return code of 7 is out of bounds

Posted: Tue Dec 11, 2018 5:36 am
by mouli449
please find the config file.

Issues started after we recently added new hosts and services to nagios instance.

Re: Nagios: Return code of 7 is out of bounds

Posted: Tue Dec 11, 2018 5:55 am
by mouli449
Nagios CLI resulting OK but UI is showing (Return code of 7 is out of bounds) for all new services in nagios.

Re: Nagios: Return code of 7 is out of bounds

Posted: Tue Dec 11, 2018 5:19 pm
by npolovenko
Hi, @mouli449. /usr/lib/nagios/plugins/ is a non standard folder for nagios plugins. Usually its /usr/local/nagios/etc/libexec/. Return code of 7 could mean that your commands are pointing to the plugin in a wrong location. Can you show me the config file with service check definitions and commands from the Core server?

Re: Nagios: Return code of 7 is out of bounds

Posted: Wed Dec 12, 2018 3:08 am
by mouli449
We set our infrastructure to use location: /usr/lib/nagios/plugins/ for plugins.
Service definition:
define service {
use generic-rep-service
servicegroups r4e-prod-repbiz
hostgroup_name r4e-prod-repbiz
service_description repbiz-8897
check_command check_rd_tcp!8897!5!10!
notification_interval 0 ; set > 0 if you want to be renotified
}

Command definition:
define command {
# Arg1= port Arg2=warning Arg3=critical
command_name check_rd_tcp
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$ -t 60

}


resource.cfg:
# Sets $USER1$ to be the path to the plugins
$USER1$=/usr/lib/nagios/plugins

# Sets $USER2$ to be the path to event handlers
#$USER2$=/usr/share/nagios4/lib/x86_64-linux-gnu/eventhandlers

We have other services which are resulting good, we are facing the issues with recently added instances. Can we many configuration change to get this fixed.

Atcching a screenshot for your reference:

Thanks

Re: Nagios: Return code of 7 is out of bounds

Posted: Thu Dec 13, 2018 3:22 pm
by npolovenko
@mouli449, The command you ran from the command line uses port 8888.
[user]sudo -Hu nagios4 /usr/lib/nagios/plugins/check_tcp -H hostname -p 8888 -w 5 -c 10 -t 60
TCP OK - 0.003 second response time on repbiz-backend-i-037f397110411230a.b.prod.eng-us port 8888|time=0.002768s;5.000000;10.000000;0.000000;60.000000
[/user]
But in the service definition, you're using the port 8897.
check_command check_rd_tcp!8897!5!10!
Please relplace the HOSTADDRESS in my command, then run the commands and show me the output:
su - nagios4
/usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p 8897 -w 5 -c 10 -t 60

Re: Nagios: Return code of 7 is out of bounds

Posted: Mon Dec 17, 2018 6:18 am
by mouli449
The issue is resolved. Actual issues are, there were duplicate service configurations generated for the same service. I just removed them and restarted Nagios service.

Issues fixed. Thanks for helping me out with some suggestions.

Regards,

Re: Nagios: Return code of 7 is out of bounds

Posted: Mon Dec 17, 2018 11:18 am
by scottwilkerson
mouli449 wrote:The issue is resolved. Actual issues are, there were duplicate service configurations generated for the same service. I just removed them and restarted Nagios service.

Issues fixed. Thanks for helping me out with some suggestions.

Regards,
glad to hear it is resolved.

Locking thread