开发者

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?


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜