Problems with check_cisco_ping_ssh

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
esarsa
Posts: 1
Joined: Fri Oct 26, 2012 12:31 pm

Problems with check_cisco_ping_ssh

Post 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
Last edited by slansing on Fri Oct 26, 2012 1:12 pm, edited 1 time in total.
Reason: Added code wrapings
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Problems with check_cisco_ping_ssh

Post 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.
Locked