Page 1 of 2
Critical: Return code of 139 is out of bounds
Posted: Wed Oct 29, 2014 9:51 pm
by Ravil
Hello!
I have Nagios Core 3.5. I connected the UPS to Nagios and wrote plugin to control its parametrs. It worked a month, but tonight I got this error: Return code of 139 is out of bounds. This error appeared only one request. Next, everything was back in OK condition.
What this error mean?
P.S. Sorry for dirty English

Re: Critical: Return code of 139 is out of bounds
Posted: Thu Oct 30, 2014 12:16 pm
by slansing
Are you running the plugin on the nagios server? What are it's permissions, and can you attach it here? Along with the command definition in commands.cfg, and it's service definition? Thanks!
Re: Critical: Return code of 139 is out of bounds
Posted: Thu Oct 30, 2014 12:55 pm
by eloyd
It worked a month, but tonight I got this error: Return code of 139 is out of bounds. This error appeared only one request. Next, everything was back in OK condition.
As @slansing said, we would need to know the command and service definitions to know what command you are executing, but my guess is that your plugin saw a problem but did not report it properly to Nagios. In other words, checking the UPS either timed out or returned an error code 139, which got passed back up to Nagios without being properly translated into a 1 (for WARNING) or 2 (for CRITICAL).
Re: Critical: Return code of 139 is out of bounds
Posted: Thu Oct 30, 2014 10:47 pm
by Ravil
slansing wrote:Are you running the plugin on the nagios server? What are it's permissions, and can you attach it here? Along with the command definition in commands.cfg, and it's service definition? Thanks!
Yes, I use plugin on the nagios server.
file commands.cfg:
Code: Select all
#The battery capacity
define command{
command_name check_apc_capacity
command_line $USER1$/check_apc_capacity $ARG1$ $ARG2$ $ARG3$ $HOSTADDRESS$
}
permissions:
Code: Select all
ls -l
-rwxr-xr-x. 1 root root 1696 Апр 9 2014 check_apc_capacity
file services.cfg:
Code: Select all
#The battery capacity
define service{
use local-service
hostgroup_name APC_smart_UPS
service_description Доступная ёмкость батарей
check_command check_apc_capacity!public!pass1!pass2
}
The plugin is written in python, and he could not pass such a mistake nagios. If the plugin has generated an exception nagios would not display it, and would have written "(null)" in the status information.
Re: Critical: Return code of 139 is out of bounds
Posted: Fri Oct 31, 2014 7:48 am
by eloyd
Plugins which do not adequately check for error conditions can (and do) send improper results back to Nagios.
Can you share the source of the plugin with us? It looks like you might be checking via SNMP:
Plugins which do not adequately check for error conditions can (and do) send improper results back to Nagios.
It's entirely possible that the script is not parsing the error condition correctly, and since it only happened once, I am guessing that it was during an error.
Re: Critical: Return code of 139 is out of bounds
Posted: Fri Oct 31, 2014 1:38 pm
by sreinhardt
Couldn't agree more with eloyd! If you could share the plugin or a link to it, that would likely help a fair amount in seeing what this plugin is doing incorrectly.
Re: Critical: Return code of 139 is out of bounds
Posted: Wed Nov 05, 2014 11:59 am
by josnavch
Hi Ravil
I see that the plugin has root permissions can try running as nagios from the console to rule than a permissions issue.
further validate a recommendation that the folder where the plugins also have the same permissions and run nagios nagios plugins with full path.
JN
Re: Critical: Return code of 139 is out of bounds
Posted: Wed Nov 05, 2014 5:25 pm
by slansing
Good ideas @josnavch, let us know what your results are Ravil. Thanks! Out of bounds errors are usually permissions related.
Re: Critical: Return code of 139 is out of bounds
Posted: Sun Nov 23, 2014 10:48 pm
by Ravil
eloyd wrote:Plugins which do not adequately check for error conditions can (and do) send improper results back to Nagios.
Can you share the source of the plugin with us? It looks like you might be checking via SNMP:
Plugins which do not adequately check for error conditions can (and do) send improper results back to Nagios.
It's entirely possible that the script is not parsing the error condition correctly, and since it only happened once, I am guessing that it was during an error.
Code: Select all
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import argparse
import re
import subprocess
def createParser ():
parser = argparse.ArgumentParser()
parser.add_argument ('u')
parser.add_argument ('A')
parser.add_argument ('X')
parser.add_argument ('H')
return parser
per = createParser()
namespace = per.parse_args()
#__________________________________________________________________
flag_error = 0
result = subprocess.Popen('snmpwalk -v 3 -u ' + namespace.u + ' -a SHA -A ' + namespace.A + ' -x AES -X ' + namespace.X + ' -l authPriv ' + namespace.H + ' upsInput', stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True)
(result_out, result_error) = result.communicate()
if result_out == '':
read = result_error
flag_error = 1
else:
read = result_out
if flag_error == 1:
out = re.findall ('^.*$',read, re.M)
print " ;; ".join ([out[i] for i in range(len(out))])
sys.exit (0) # UNKNOWN
#__________________________________________________________________
message = ""
flag_critical = 0
InVolt = re.search ('^.*PrecInputLineVoltage.*: (\d+).*$', read, re.M)
if InVolt != None:
InVoltDiv = int(InVolt.group(1))/10
InVoltMod = int(InVolt.group(1))%10
message += "Напряжение: "+str(InVoltDiv)+","+str(InVoltMod)+" В "
if InVoltDiv > 264:
message += "(больше 264 В) ;; "
flag_critical = 1
elif InVoltDiv < 176:
message += "(меньше 176 В) ;; "
flag_critical = 1
else:
message += ";; "
else:
message += "Напряжение: нет данных ;; "
InFreq = re.search ('^.*PrecInputFrequency.*: (\w+)$', read, re.M)
if InFreq != None:
InFreqDiv = int(InFreq.group(1))/10
InFreqMod = int(InFreq.group(1))%10
message += "Частота: "+str(InFreqDiv)+","+str(InFreqMod)+" Гц "
if InFreqDiv > 55:
message += "(больше 55 Гц) ;; "
flag_critical = 1
elif InFreqDiv < 45:
message += "(меньше 45 Гц) ;; "
flag_critical = 1
else:
message += ";;"
else:
message += "Частота: нет данных"
if flag_critical == 1:
print message
sys.exit(2)
else:
print message
sys.exit(0)
Re: Critical: Return code of 139 is out of bounds
Posted: Sun Nov 23, 2014 10:50 pm
by Ravil
josnavch wrote:Hi Ravil
I see that the plugin has root permissions can try running as nagios from the console to rule than a permissions issue.
further validate a recommendation that the folder where the plugins also have the same permissions and run nagios nagios plugins with full path.
JN
Ok, Thank you, follow your advice. Hope this helps