Angelo Vargas
Angelo Vargas

Reputation: 1991

SSH "Framework" to write programs that will keep a connection open and feed commands to the servers

I am looking for some kind of framework that will allow me to do connect to multiple servers using SSH and keep the connection open, reopen it if it dies, and allow me to run commands to it and report back. For example, check disk space on all the machines right away, so I'd do results = object.run("df -h") and it returns an array with the response from all the machines (I am not looking for a monitoring system).

Anyone have any idea?

Upvotes: 1

Views: 320

Answers (2)

JiminyCricket
JiminyCricket

Reputation: 7420

I would use Python and the Fabric framework. Lets you easily execute commands on a set of servers - like doing deployment

with Fabric you could do

from fabric import run, env
def getSpace(server):
   env.host_string
   run("df -h")

>>> fab getSpace("234.24.32.1") 

Upvotes: 2

Greg Hewgill
Greg Hewgill

Reputation: 994629

One way to do this would be to use Python and the paramiko library. Writing the functionality that runs a given command on a specified set of servers is then a simple matter of programming.

Upvotes: 0

Related Questions