Page 1 of 1

Problems with check_cisco_ping_ssh

Posted: Fri Oct 26, 2012 1:07 pm
by esarsa
Hello,

I have problems with check_cisco_ping_ssh pluglin

Code: Select all

"
#!/usr/bin/perl
#
# Usa la libreria Net::SSH de http://www.stupidfool.org/perl/net-ssh/
#
# Uso: /usr/local/sbin//usr/local/sbin/check_cisco_ping_ssh <host> <port> <user> <pass> <ip> <warn> <crit>
#
#
use strict;

use Net::SSH::Perl;

$ENV{'HOME'} = '/var/lib/nagios/';
 
my $router=$ARGV[0];
my $puerto=$ARGV[1];

my $usuariort=$ARGV[2]; 
my $clave=$ARGV[3]; 

my $ip=$ARGV[4]; 

my $warn=$ARGV[5]; 
my $crit=$ARGV[6]; 



my $sesion_ssh = Net::SSH::Perl->new($router, protocol=>1, cipher=>'DES', port=>$puerto, debug=> 'false'); 
$sesion_ssh->login($usuariort, $clave);

my $comando="ping $ip";

my($salida, $salida_error, $valor_exit) = $sesion_ssh->cmd($comando);

$salida =~ /Success rate is (\d*) (.*)/;

my $rate=$1;

if ( $rate <= $crit ) {
        print "PROBLEMA: Rate=$rate%\n";
        exit 2;
}

if ( $rate <= $warn ) {
        print "WARNING: Rate=$rate%\n";
        exit 1;
}

if ( $rate <= 100 ) {
        print "OK: Rate=$rate%\n"; 
        exit 0;
}

exit 3;
"
becasuse when I execute the plugin it presente me this error

"Waiting for server public key.
Connection closed by remote host. at /usr/share/perl5/vendor_perl/Net/SSH/Perl/SSH1.pm line 78"

I install:

Code: Select all

yum install perl-Net-Telnet-Cisco.noarch

yum install perl-Net-SSH-Perl.noarch

yum install perl-Net-OpenSSH-Parallel.noarch
but the problem persists, somebody have any idea of this error

Re: Problems with check_cisco_ping_ssh

Posted: Fri Oct 26, 2012 7:21 pm
by jsmurphy
You may need to ask the plugin author about this one if you can find his details. It looks like it's never getting past the authentication stage, like the cisco device is expecting PSK auth rather than username/password... but as I said you would be best served asking the author on this one.