Critical: Return code of 139 is out of bounds
Critical: Return code of 139 is out of bounds
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
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
-
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Critical: Return code of 139 is out of bounds
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
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).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.
Re: Critical: Return code of 139 is out of bounds
Yes, I use plugin on the nagios server.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!
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$
}
Code: Select all
ls -l
-rwxr-xr-x. 1 root root 1696 Апр 9 2014 check_apc_capacity
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
}
Re: Critical: Return code of 139 is out of bounds
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:
Can you share the source of the plugin with us? It looks like you might be checking via SNMP:
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.Plugins which do not adequately check for error conditions can (and do) send improper results back to Nagios.
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Critical: Return code of 139 is out of bounds
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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Critical: Return code of 139 is out of bounds
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
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
Jose Navarrete
-
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Critical: Return code of 139 is out of bounds
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
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:
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.Plugins which do not adequately check for error conditions can (and do) send improper results back to Nagios.
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
Ok, Thank you, follow your advice. Hope this helpsjosnavch 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