plugins with rsh

dave stern - e-mail.pluribus.unum dit.dash at gmail.com
Thu Jan 4 21:28:06 CET 2007


*Forwarded Conversation*
Subject: *plugins with rsh*
------------------------

* From: dave stern - e-mail.pluribus.unum* <dit.dash at gmail.com> To:
nagios-users at lists.sourceforge.net
Date: Wed, Jan 3, 2007 at 3:17 PM

We have a legacy setup with tru64 hosts that are currently configured for
rsh, not ssh. I've installed the latest and greatest nagios on a relatively
recent fedora host and have used plugins with ssh in the past. The problem
is that rsh doesn't return status codes properly. Rather, it returns
only the status code of rsh itself, not the command. A search implies you
just need to echo $? with rsh.

rsh linux to linux, I get this:

linux1> rsh linux1 'date ; echo $?'
Wed Jan  3 15:15:07 EST 2007

and trying to generate an error:
linux1> rsh linux1 'bogus ; echo $?'
bogus; Command not found.
1

So that looks ok but first problem is when I put into nagios commands
define ....
   rsh $HOSTADDRESS$ 'mycommand; echo $?'
The web page show "(No output!)

Is it possible it swallows the quotes?

Further, rsh behaves differently on tru64:

linux1> rsh tru64-host 'date;echo $?'
Variable syntax.

Any ideas for these problems?

Thanks

and

--------
* From: Lacayo, Luis F* <lflacayo at cps.k12.il.us> To: "dave stern -
e-mail.pluribus.unum" <dit.dash at gmail.com>,
nagios-users at lists.sourceforge.net
Date: Wed, Jan 3, 2007 at 3:26 PM

 Try adding a second $ at the end of the command.



rsh $HOSTADDRESS$ 'mycommand; echo $$?'




Luis Lacayo

Sr. UNIX Admin

Chicago Public Schools

Office of Technology Services

125 S. Clark Street – Suite 300

Chicago, IL 60603

Direct:773-553-3835

Office: 773-553-1300

FAX:773-553-1363

lflacayo at cps.k12.il.us
  ------------------------------

*From:* nagios-users-bounces at lists.sourceforge.net [mailto:
nagios-users-bounces at lists.sourceforge.net] *On Behalf Of *dave stern -
e-mail.pluribus.unum
*Sent:* Wednesday, January 03, 2007 2:17 PM
*To:* nagios-users at lists.sourceforge.net
*Subject:* [Nagios-users] plugins with rsh
[Quoted text hidden]

--------
* From: Darren Dunham* <ddunham at taos.com> To: "dave stern -
e-mail.pluribus.unum" <dit.dash at gmail.com>
Date: Wed, Jan 3, 2007 at 4:17 PM

> Further, rsh behaves differently on tru64:
>
> linux1> rsh tru64-host 'date;echo $?'
> Variable syntax.

$? is a bourne-style parameter for status.  Older csh-style shells may
not support it (although looking around, I was surprised to find a few
/bin/csh shells that did).  Specifically, "Variable syntax" appears to
be a csh error message to me.

Is the account you're accessing on the tru64 machine using a csh shell?

--
Darren Dunham                                           ddunham at taos.com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
        < This line left intentionally blank to confuse you. >

--------

These were both great suggestions. Here's where I stand now (hopefully this
can help others altho this
isn't yet resolved)

nagios user has a csh. I can either change that or get around it by
prepending to the nagios command /usr/bin/sh
Also, rsh interprets two dollars as PID eg if I
Linux1> rsh hostname 'date; echo $$?'
Thu Jan  4 12:38:36 EST 2007
12344

Turns out, it will interpret $status correctly ie
Linux1> rsh hostname 'date; echo $status'
Thu Jan  4 12:38:36 EST 2007
0

>linux1> rsh hostname 'bogus; echo $status'
bogus; Command not found
1

(Hope I got that right, manufacturing this from memory as nagios network is
airgapped to internet)

The problem is still getting the info back to nagios. Putting the above
command into nagios's command.cfg
and setting up two such services, one on a host that will report success and
one on a host that will fail, I get
both hosts reporting "(No output!) in the far right nagios column. If I
remove everything after the semicolon,
the command runs and the output is correct but the status code isn't
returned thus the service color isn't
updated. Changing "echo $status" to "echo $$status" also makes no difference
so nagios appears to be
choking on the two commands (ie when it hits the ";")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20070104/b422a752/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list