[Nagiosplug-help] Re: check_ssh

Kelvin Wu kelvin.wu at gmail.com
Tue Aug 10 23:59:07 CEST 2004


no nagios won't.

finally i solevd the problem by using Expect, here is the code:

#!/usr/bin/perl

use strict;
use Expect;

my $host = $ARGV[0];

my $timeout = 10;

my $cmd = "ssh -l root $host \"pwd > /dev/null\"";

# spawn the ssh program
my $ssh = Expect->spawn($cmd) or die "Can't spawn cmd: $!";

# wait 10 seconds for password prompt:
if ( $ssh->expect($timeout, -re , '.*assword:') ) {
    print "Timed out or something else went wrong\n";
    exit 2;
}
else {
    print "Login successfully\n";
    exit 0;
}


On Tue, 10 Aug 2004 08:11:15 -0500 (CDT), C. Bensend
<benny at bennyvision.com> wrote:
> 
> > I do use ssh key to login and it works perfectly, my problem is, i
> > want nagios to send me alert when ssh login failed(the ssh key was
> > deleted for example), otherwise all ssh related plugins are useless if
> > login failed.
> 
> I'm guessing you can get that result if you alert on UNKNOWN as well as
> WARNING and CRITICAL.  Just a guess - something to try.
> 
> Benny
> 
> --
> "Horrible pain!  I made sounds like a dolphin giving birth."
>                                                  -- Mr. Corman, "Scrubs"
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> _______________________________________________
> Nagiosplug-help mailing list
> Nagiosplug-help at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> ::: Please include plugins version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>




More information about the Help mailing list