Plugin error: Remote cisco command viaSSH notworking

Javier Castillo Alcibar Javier.Castillo at a-e.es
Thu Nov 16 16:02:16 CET 2006


Pherhaps...... Do you know how to run a plugin from nagios like root. My nagios process run as nagios user. (Debian/Sarge)

But, if I run the plugin from a command line, and with user nagios (su - nagios), the plugin works as expected.....

I am confused.....

thx


 
 
 	
Javier Castillo Alcíbar (2404)
+34 91 787 23 00 javier.castillo at a-e.es
 	
 
 
 
 
 

-----Mensaje original-----
De: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-bounces at lists.sourceforge.net] En nombre de David Gerbec
Enviado el: jueves, 16 de noviembre de 2006 15:38
Para: nagios-users at lists.sourceforge.net
Asunto: Re: [Nagios-users] Plugin error: Remote cisco command viaSSH notworking

'lo

Javier Castillo Alcibar pravi:
> 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.
> 

Could it be premission related?



Regrads,
David

> 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=1216
> 42 _______________________________________________
> 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=DEV
> DEV _______________________________________________
> 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


-------------------------------------------------------------------------
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
 
--------------------------------------------------------
Alhambra-Eidos ha cambiado su dominio de correo electrónico. 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