[TriLUG] scripted sesssions with ssh

Reginald Reed reginald.reed at gmail.com
Mon Jul 6 11:39:04 EDT 2009

On Mon, Jul 6, 2009 at 11:07 AM, Joseph Mack NA3T <jmack at wm7d.net> wrote:

> At $work I nonitor about 1000 parameters every 5 minutes (cpu usage,
> ethernet throughput, temperature of disks...). I'm required to do this by
> ssh from another machine. This involves scripts which make calls like
> monitoring_machine#: result=`ssh remote_machine du | grep ...`
> This works, except the large number (1000/5mins) of ssh calls cause a high
> load on the both the client and remote machine.
> My $manager says that since he can ssh to the remote machine and do the at
> the command prompt the same thing as my scripts do, that my scripts should
> only have to make one ssh connection and they should run all their commands
> and receive the responses without exiting the ssh session.
> The only way I can see to do this is with expect scripts (it would be a
> nightmare to code up)

Why would this be a nightmare?  I ask this question without having an
understanding of how you actually get the output of your command.  Need more

> Are there other ways for a script to open an ssh connection, make about
> 1000 calls, and process 1000 respones before closing the ssh session?

If you are worried about machine, load, wouldn't this be the same as what
you are proposing below (running the monitoring on each monitored machine)?

What about creating a script that redirects the output of your monitoring
stuff to a file, ship the file back to the monitoring machine and parse it

My preference would be to run the monitoring on each machine and ship the
> results back to the monitoring machine, but I'm not allowed to do that (it
> would result in too much load on the monitored machine).

This is my preference as well.  I think it would be useful to setup some
experiments to determine what the additional load of doing something like:
- firing up scripts every 5 minutes via cron
- shipping the data from the scripts back to the monitoring machine via
direct database inserts or a simple socket client/server setup

My guess is doing something like this would be pretty darn close to jackin'
open an ssh session to transfer the same data.


> Thanks
> Joe
> --
> Joseph Mack NA3T EME(B,D), FM05lw North Carolina
> jmack (at) wm7d (dot) net - azimuthal equidistant map
> generator at http://www.wm7d.net/azproj.shtml
> Homepage http://www.austintek.com/ It's GNU/Linux!
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG FAQ  : http://www.trilug.org/wiki/Frequently_Asked_Questions

More information about the TriLUG mailing list