<div> </div>
<div>Quite a lot of ways to solve this issue, it seem. :)</div>
<div> </div>
<div>I have a working configuration in which the $USER macro is defined with <font size="2">"/usr/lib<strong>64</strong>/nagios/plugins/check_disk", and on 32-bit systems I make a symlink from /usr/lib64/nagios to /usr/lib/nagios. This works like a charm, and doesn't seem to be very messy. </font></div>

<div><font size="2"></font> </div>
<div><font size="2">I may consider the Gavins approach setting the PATH environment though, since it looked like a very neat solution.</font></div>
<div><font size="2"></font> </div>
<div><br> </div>
<div><span class="gmail_quote">On 9/25/08, <b class="gmail_sendername">Tom Throckmorton</b> <<a href="mailto:throck@gmail.com">throck@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On Sep 23 08:18, Kenneth Holter wrote:<br>> Hello all.<br>><br>><br>> I've set up Nagios to monitor a few 64-bit machines, and this seems to be<br>
> working correctly. For example, my command for checking a remote disk is<br>> defined like this:<br>><br>><br>> define command{<br>>         command_name    check_remote_disk<br>>         command_line    /somepath/check_by_ssh <args> -C<br>
> "/usr/lib64/nagios/plugins/check_disk <remote args>"<br>> }<br>><br>> This command executes /usr/*lib64*/nagios/plugins/check_disk on the remote<br>> system. On 32-bit systems, on the other hand, the path to the plugin is<br>
> /usr/*lib*/nagios/plugins/check_disk. It thus looks like I have to<br>> differentiate between 32-bit and 64-bit commands, and in effect devide the<br>> configuration itself in a 32-bit section and 64-bit section.<br>
><br>> I'm sure there is a neat way of solving this, and could use some advice. I<br>> guess I could symlink all over the place to get things going, but there are<br>> probably a better way of doing this.<br>
<br>Kenneth,<br><br>Here are two more ideas for you:<br><br>1) You could add some test logic into your command def, like so:<br><br>$USER1$/check_by_ssh <args> -C "if [ -e /usr/lib64/nagios/plugins/ ] ; then /usr/lib64/nagios/plugins/check_disk <remote args> ; else /usr/lib/nagios/plugins/check_disk <remote args> ; fi"<br>
<br>Rather ugly, but I think that would do what you want.<br><br>2) configure the remote ssh client to know it's local path to the plugins; you<br>could do this either in the public key, by using something like<br>'environment="NAGIOSPATH=/usr/lib64/plugins' after your command and host<br>
restrictions (you _are_ using command and host restrictions in your public<br>keys, right? ;-), or in ~/.ssh/environment on the remote host.  Note that to<br>use either of those, you'd need to set PermitUserEnvironment=yes in your<br>
sshd_config - see sshd(8) and sshd_config(5).  Once that's set, you should be<br>able to run:<br><br>$USER1$/check_by_ssh <args> -C "\$NAGIOSPATH\/check_disk <remote_args>"<br><br>...which would also get you there, I think.<br>
<br>Couple of disclaimers...<br>- allowing user environments to be set via sshd can be a security risk<br>- I've only tried this from the command line; you'll likely need to do some<br>interesting escaping to get it to work correctly.<br>
<br>Also,<br><br>Gavin Carr wrote:<br>> We've found it easier to just leave the plugin invocations unqualified and<br>> add the relevant nagios plugins directory to the $PATH for the remote nagios<br>> user.  Works nicely here.<br>
<br>+1 on that one, too - simple is good.<br><br>Cheers,<br><br>-tt<br><br>--<br>Tom Throckmorton<br></blockquote></div><br>