[TriLUG] scripted sesssions with ssh
mpusateri at wickedtrails.com
Mon Jul 6 16:57:13 EDT 2009
Look at master mode in man ssh and Master control mode in ssh_config.
I've never used it, but as I understand things. You create a master
connection to the host and then utilize that master connection for all
subsequent connections to the host this way everything goes across the
initial connection pipe. This would eliminate the overhead of setting
up multiple ssh connections to the same box. A quick google on "ssh
master mode" seemed to produce multiple howto's.
On Jul 6, 2009, at 11:07 AM, Joseph Mack NA3T 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)
> Are there other ways for a script to open an ssh connection, make
> about 1000 calls, and process 1000 respones before closing the ssh
> 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
> 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