girishatreya2005 has asked for the wisdom of the Perl Monks concerning the following question:

Hello wise ones,

Using rsh I'm bombarding a remote machine with a lot of commands.

Using the Net::Telnet library I'm telnetting into the same remote machine, the intention being to monitor the machine's health.I would want the telnet object to capture the messages printed on the machine due to the commands executed from rsh . Also if the system goes down , I would want the telnet object to report the failure before it gets terminated by the system .

I tried using the get()/ getlines() functions to read the command outputs on the machine. But these functions do the reads only if I execute the commands through telnet and not through rsh. Is there any work around for this ?

Looking forward to gain some wisdom Thanks , Girish HV

  • Comment on Monitoring a remote machine using Net::Telnet

Replies are listed 'Best First'.
Re: Monitoring a remote machine using Net::Telnet
by sierpinski (Chaplain) on Jul 14, 2010 at 12:40 UTC
    If ssh access is available, try using Net::SSH::Expect. You can create a object that keeps the connection open (as long as the object exists) and pipe multiple commands to the host, capturing the output, and parsing as needed. When you kill the object, the connection closes. For multiple hosts, you can use that along with Parallel::ForkManager for multiple connections at once. At the least, read the docs to see if it fits your needs. Hope that helps.