Javier Castillo Alcibar wrote: > > 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!!. >
Have you compiled nagios with embedded perl support? If so, use /usr/bin/perl /path/to/your/script.pl instead of just /path/to/your/script.pl in the command definition. Other than that, make sure that the nagios-user has access to execute the script and try it from the command-line *as the nagios user*. If that works, you've made some mistake in your configuration. -- Andreas Ericsson [EMAIL PROTECTED] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 ------------------------------------------------------------------------- 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@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