[TriLUG] scripted sesssions with ssh

Joseph Mack NA3T jmack at wm7d.net
Mon Jul 6 11:07:59 EDT 2009

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 

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)

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?

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).


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!

More information about the TriLUG mailing list