Mark, This is a pain to install. I would do it thru CPAN. perl -MCPAN -e shell
cpan>install Net::SSH::Perl I fyou don't have root access to install perl modules, try to use Net::SSH. use strict; use warnings; use Net::SSH qw( sshopen3 ); my $user = "bob"; my $host = "10.10.10.10"; my $cmd = "uptime"; sshopen3( "$user\@$host", *WRITER, *READER, *ERROR, "$cmd" ); my $uptime = <READER>; chomp $uptime; print "$uptime\n"; something like that ought to so it... chad On Tue, 2002-12-10 at 11:44, Mark-Nathaniel Weisman wrote: > My box does not seem to have the Net::SSH::Perl installed. How can I get > it installed? > > His Faithful Servant, > Mark-Nathaniel Weisman > President / CEO > Infinite Visions Educational Systems Inc. > Anchorage, Alaska > http://www.ivedsys.com > [EMAIL PROTECTED] > > > > -----Original Message----- > From: zentara [mailto:[EMAIL PROTECTED]] > Sent: Monday, December 09, 2002 7:58 AM > To: [EMAIL PROTECTED] > Subject: Re: Using ssh for uptime? > > > On Sun, 8 Dec 2002 23:14:36 -0900, [EMAIL PROTECTED] (Mark-Nathaniel > Weisman) wrote: > > >Mark, > > I've got the code you sent installed and working (or almost working > >anyway) snippet below: > > >I'm trying to get this silly thing working, so any ideas or suggestions > > >are more than appreciated. > Hi, > I used the other suggestion of using Net::SSH::perl and have this code > working. (minus any html output ) > ############################################################## > #!/usr/bin/perl > use strict; > use warnings; > use Net::SSH::Perl; > > my $user = "zzz"; > my $password = "zzztester"; > my @hosts = qw(localhost zentara.zentara.net); > > foreach my $host (@hosts){ > my $cmd = "/usr/bin/uptime"; > my $ssh = Net::SSH::Perl->new( $host, port => 22); > $ssh->login($user,$password); > > my($out) = $ssh->cmd($cmd); > my ($time,$uptime) = (split /\s+/,$out)[1,3]; > chop $uptime; > print "$host has been up $uptime\n"; > } ############################################################### > > Output: > > localhost has been up 4:28 > zentara.zentara.net has been up 4:28 > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >
signature.asc
Description: This is a digitally signed message part