in reply to grabbing logfile excerpts from remote machines

What I have been trying to do is use open3 to telnet to the target machines
One idea: you can use Net::Telnet to access the remote machine. It might make the interface a bit more versatile. I'm not absolutely sure, but I wouldn't be too surprised if it comes with Perl.

Lincoln Stein has written about it in his book "Network programming with Perl", and this particular chapter about telnet, is available online.

  • Comment on Re: grabbing logfile excerpts from remote machines

Replies are listed 'Best First'.
Re: Re: grabbing logfile excerpts from remote machines
by gnu@perl (Pilgrim) on Aug 31, 2002 at 04:00 UTC

    MY GOD WAS I MAKING THAT HARDER THAN IT HAD TO BE!!!

    This was SOOOOOOOOOOOOO easy, thanks for the Net::Telnet tip.

    BTW, here's the code. I went from what I have above to this:

    #!/usr/bin/perl –w use strict; use Net::Telnet; my $tnet = new Net::Telnet; $tnet = new Net::Telnet; $tnet->open("deneb"); $tnet->login($username, $passwd); my @lines = $tnet->cmd("tail /var/log/syslog"); print @lines;
      All I can use is what comes with perl 5.00503 and I cannot load any additional modules.

      Well, I guess it's a good thing bart gave you that tip in spite of the above comment in your original question. Does Net::Telnet really come with 5.00503?

      -sauoq
      "My two cents aren't worth a dime.";
      
        Does Net::Telnet really come with 5.00503?

        Weeell... CPAN.pm likes to use some of the Net::* stuff, which can be a reason why the whole suite might be there. But OTOH, maybe not...

        I think that I may be able to talk my manager into letting me add Net::Telnet but he is kind of wierd about upgrading currently installed software. But thanks for your input.
Re: Re: grabbing logfile excerpts from remote machines
by gnu@perl (Pilgrim) on Aug 31, 2002 at 03:07 UTC
    Thanks a lot, I didn't even think of it. I will definately check that out.