<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hi I haven’t researched this or anything, but is there is a –v option to check_by_ssh to get the exact error thrown? – I’m simply wondering if you have a bad/mismatched key in ~/.ssh/known_hosts or authorized_keys
 (sorry, ive been too busy to be much help on nagios lately guys)…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Cheers! <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Jamie<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> MAHONEY, DANIEL [mailto:dm572j@att.com]
<br>
<b>Sent:</b> Monday, June 10, 2013 5:27 PM<br>
<b>To:</b> nagios-users@lists.sourceforge.net; MAHONEY, DANIEL<br>
<b>Subject:</b> [Nagios-users] Return code of 127 is out of bounds - plugin may be missing<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Send to <a href="mailto:nagios-users@lists.sourceforge.net">
nagios-users@lists.sourceforge.net</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Greetings, all. I’ve googled the subject above and evaluated the answers I’ve found but haven’t yet found info that pinpoints my issue.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m running Nagios Core 3.2.1 on RedHat 5.8. This installation has been running for a few years, I just inherited it’s care and maintenance recently. On one of my monitored servers I write a script “checkRAID.sh” that calls another piece
 of code, looks at the results, and returns either a 0 or a 2 (the result will always be either good or critical, depending on whether the RAID controller is unhappy).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Nagios runs as user “nagios”. The remote machine is configured to allow user “nagios” to log in without a password, using a key pair. This works.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">In /usr/local/nagios/etc/checkcommands.cfg I have :<o:p></o:p></p>
<p class="MsoNormal">define command{<o:p></o:p></p>
<p class="MsoNormal">    command_name    check_raid<o:p></o:p></p>
<p class="MsoNormal">    command_line    /usr/local/nagios/libexec/check_by_ssh -H $HOSTNAME -l nagios -i /home/nagios/.ssh/id_rsa -E -o StrictHostKeyChecking=no -C /home/nagios/checkRAID.sh<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">When I become nagios (“su – nagios”) and run that script, I get:<o:p></o:p></p>
<p class="MsoNormal">[nagios@nagios ~]$ /usr/local/nagios/libexec/check_by_ssh -H <remote server IP> -l nagios -i /home/nagios/.ssh/id_rsa -E -o StrictHostKeyChecking=no -C /home/nagios/checkRAID.sh<o:p></o:p></p>
<p class="MsoNormal">Check failed<o:p></o:p></p>
<p class="MsoNormal">[nagios@nagios ~]$ echo $?<o:p></o:p></p>
<p class="MsoNormal">2<o:p></o:p></p>
<p class="MsoNormal">[nagios@nagios ~]$<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">That “Check failed” line is what’s written to stdout just before returning an exit code of 2. This shows me that the remote script is working fine, and that the local nagios user is able to execute it with no problems.  However, once I
 add an entry to services.cfg to tie this service check to my remote host and give it time to run the command, when I look at nagios’ “Services” page it shows :<o:p></o:p></p>
<p class="MsoNormal">                <o:p></o:p></p>
<p class="MsoNormal">check_raid          CRITICAL              06-10-2013 21:17:25        0d 6h 14m 29s    3/3         (Return code of 127 is out of bounds - plugin may be missing)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">This has me baffled. The return code is quite clearly 2. <o:p>
</o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I recently set debug_level to -1 and restarted. I’m hoping that the debug log will
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Daniel Mahoney<o:p></o:p></p>
<p class="MsoNormal"><a href="mailto:Dm572j@att.com">Dm572j@att.com</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>