<div dir="ltr">Hello!<div><br></div><div style>Try to use this command_line:</div><div style><p class="" style="font-family:arial,sans-serif;font-size:13px">    command_line    $USER1$/check_by_ssh -H $HOSTNAME -l nagios -i /home/nagios/.ssh/id_rsa -E -o StrictHostKeyChecking=no -C /home/nagios/checkRAID.sh<u></u><u></u></p>
<div style>where $USER1$ variable is set in resource.cfg file</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/6/11 MAHONEY, DANIEL <span dir="ltr"><<a href="mailto:dm572j@att.com" target="_blank">dm572j@att.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal">Send to <a href="mailto:nagios-users@lists.sourceforge.net" target="_blank">nagios-users@lists.sourceforge.net</a><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></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.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></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).<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></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.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">In /usr/local/nagios/etc/checkcommands.cfg I have :<u></u><u></u></p>
<p class="MsoNormal">define command{<u></u><u></u></p>
<p class="MsoNormal">    command_name    check_raid<u></u><u></u></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<u></u><u></u></p>
<p class="MsoNormal">}<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">When I become nagios (“su – nagios”) and run that script, I get:<u></u><u></u></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<u></u><u></u></p>

<p class="MsoNormal">Check failed<u></u><u></u></p>
<p class="MsoNormal">[nagios@nagios ~]$ echo $?<u></u><u></u></p>
<p class="MsoNormal">2<u></u><u></u></p>
<p class="MsoNormal">[nagios@nagios ~]$<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></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 :<u></u><u></u></p>
<p class="MsoNormal">                <u></u><u></u></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)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This has me baffled. The return code is quite clearly 2. <u></u>
<u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I recently set debug_level to -1 and restarted. I’m hoping that the debug log will
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Daniel Mahoney<u></u><u></u></p>
<p class="MsoNormal"><a href="mailto:Dm572j@att.com" target="_blank">Dm572j@att.com</a><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

<br>------------------------------------------------------------------------------<br>
This SF.net email is sponsored by Windows:<br>
<br>
Build for Windows Store.<br>
<br>
<a href="http://p.sf.net/sfu/windows-dev2dev" target="_blank">http://p.sf.net/sfu/windows-dev2dev</a><br>_______________________________________________<br>
Nagios-users mailing list<br>
<a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/nagios-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.<br>
::: Messages without supporting info will risk being sent to /dev/null<br></blockquote></div><br></div>