check_by_ssh little help

Paul Metzger pmetzger at bellsouth.net
Wed Nov 3 05:53:16 CET 2004



> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-


> I setup passwordless SSH, using keys. Tested it with my account and it
> works. (Going to use my login as a test, jwilliams)
How did you set up your keys? My advice in what I found as best is to
let root run the checks. It makes the permissions work out a little
easier. If you don't, say you are checking say a samba server for quota
via ssh, well if you are checking your user's directories you will get a
failed check. Setting up root to do that is a slightly higher security
risk, but with the way ssh works, I wouldn't worry about it just a whole
lot. Esp if you are running checks on a private subnet. 

> 
> Anyway, if I navigate to the plugin directory and execute the
following
> command:
> 
> ./check_by_ssh -H 192.168.1.199 -C uptime
> 
> I get the result printed back to me, which is great (BTW, the above
> command
> is executed by my login name).
> 
So far so good. Thought I still hold to that running it as you will lead
to issues in the future. 

> But the problem I think is when I am setting up the checkcommands
portion.
> I think I am making it more difficult than it is and may be going in
> circles. :(
> 
> Here is what I have setup (Checking the load average BTW)
> 
> First, I have this:
> 
> # 'check_local_load' command definition
> define command{
>          command_name    check_load_avg
>          command_line    $USER1$/check_by_ssh -H $HOSTADDRESS$ -C
> "$USER1$/check_load -w $ARG1$ -c $ARG2$"
>          }
> 
One thing I will advise you on. Check the strings in the def files. What
I found was that it was calling something as $WHATEVER(I have back up of
the back-ups on my configuration. I spent 40 hours or better getting
everything set up, so I don't remember exactly which file) but if I left
it as $whatever, it just flat wouldn't do right. I went, edited, gave it
specific path and it works like a champ. So I just took the time to make
my one line vi command and change them all:)

> 
> Then, I have this:
> 
> # check_by_ssh
> define command{
>          command_name    check_by_ssh
>          command_line    $USER1$/check_by_ssh -H $HOSTADDRESS -C
uptime -l
> jwilliams
>          }
> 
> 
check how the ssh command is set up. I'm not a big one on all the
variables, but again, I found a place or two that it just got them
backwards. Reverse them and it all works just as it should.  
This line just look wrong for ssh. 
command_line    $USER1$/check_by_ssh -H $HOSTADDRESS -C uptime -l
> jwilliams

You need to look at it like the computer is going to see it. The command
would be ssh <options> <address> <command> <command options> ie if I had
a server in 10.1.1.2 and I wanted to check to see if a dir existed in
the world I would do something like
ssh -l root 10.1.1.2 test -d /home/paul

you command should set up to look something like
ssh -l $USER $HOSTNAME <command to run and options>

> I think I may be doing something backwards here, or something is
missing,
> as I cannot get it to bring back the info I am requesting.

Is it giving you an error, or just ignoreing you?

I'm not sure if all that even addresses your problem or will help you. I
hope it does, but if not please overlook me tonight. 

Paul



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
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