Plugin error: Remote cisco command via SSH notworking

Javier Castillo Alcibar Javier.Castillo at a-e.es
Thu Nov 16 15:34:28 CET 2006


Hello All,

No one has faced this problem?? :((
 
Kind regards,
Javier
 
 

-----Mensaje original-----
De: nagios-users-bounces at lists.sourceforge.net
[mailto:nagios-users-bounces at lists.sourceforge.net] En nombre de Javier
Castillo Alcibar
Enviado el: lunes, 13 de noviembre de 2006 10:19
Para: nagios-users at lists.sourceforge.net
Asunto: [Nagios-users] Plugin error: Remote cisco command via SSH
notworking

Hello all,
 
I have some cisco routers that can only be managed using SSH. I wrote an
script, to do remotely some PING's from these routers, integrated in
nagios.

My problem is very strange:
	- if a execute this script from the command line by myself, it
works as expected.
	- if nagios process executes the script, it does not work. It
looks like ssh process didn't return anything....

I think it's a problem related with ttys.....but I'm not sure.

This is my (perl) script:

#!/usr/bin/perl
#
# Uso: usr/local/sbin/check_cisco_ping_ssh <host> <port> <user> <pass>
<ip> <warn-rate> <crit-rate> # use Net::SSH::Perl;

$router=$ARGV[0];
$port=$ARGV[1];
$user=$ARGV[2];
$pass=$ARGV[3];
$ip=$ARGV[4];
$warn=$ARGV[5];
$crit=$ARGV[6]; 

my $sesion_ssh = Net::SSH::Perl->new($router, protocol=>1,
cipher=>'DES', port=>$port); $sesion_ssh->login($user, $pass);

$command="ping $ip";

my($output, $output_error, $val_exit) = $sesion_ssh->cmd($command);

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

if ( $rate <= $crit ) {
        print "PROBLEM: PING Rate=$rate%\n";
        exit 2;
}
if ( $rate <= $warn ) {
        print "WARNING: PING Rate=$rate%\n";
        exit 1;
}
if ( $rate <= 100 ) {
        print "OK: PING Rate=$rate%\n"; 
        exit 0;
}
exit 3;


Any help is welcome!!.

Thx in advance.
Regards
 
--------------------------------------------------------
Alhambra-Eidos ha cambiado su dominio de correo electronico. Por favor
revise sus contactos, y proceda a actualizar nuestras direcciones a
@a-e.es. 


 
Muchas gracias.
Alhambra-Eidos. We solve IT, we solve it
--------------------------------------------------------

------------------------------------------------------------------------
-
Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
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
 
--------------------------------------------------------
Alhambra-Eidos ha cambiado su dominio de correo electronico. Por favor revise sus contactos, y proceda a actualizar nuestras direcciones a @a-e.es. 


 
Muchas gracias.
Alhambra-Eidos. We solve IT, we solve it
--------------------------------------------------------

-------------------------------------------------------------------------
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
_______________________________________________
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