How to program in Python to run system commands in 1000s of servers
babukk at gmail.com
Sun Apr 10 16:22:56 CEST 2011
On Apr 8, 5:40 am, Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-
a470-7603bd3aa... at spamschutz.glglgl.de> wrote:
> Am 07.04.2011 21:14, schrieb Anssi Saari:
> > Chris Angelico<ros... at gmail.com> writes:
> >> Depending on what exactly is needed, it might be easier to run a
> >> separate daemon on the computers, one whose sole purpose is to do the
> >> task / get the statistics needed and return them. Then the Python
> >> script need only collect each program's returned response.
> > Those would still need to be deployed somehow to the thousands of
> > machines though.
> But only once...
> > I realized after posting that something like pexpect might work for
> > stuffing the keystrokes needed to root login via ssh to all machines
> > and such... If that's what he needs to do, since it wasn't very clear.
> Maybe that works. But it is much, much worse than using keys...
Thank you all for various ideas. Let me give some background and more
information here. Reason that we cannot use root trusted ssh is a
Internal Information Security decision. Given that we have this
restriction, I wanted to explore what other creative options we have
so that we can still accomplish this.
In our enterprise environment, quick production support is very
important. An application problem troubleshooting might require
we check various status on multiple servers quickly. So we need to
execute commands depending on the situation. Let me summarize some of
the ideas presented in this thread.
1. Use pexpect to login and become root(or sudo - yes sudo is
allowed) on the remote machines
2. run a daemon on each server, which will respond to client
3. run your program through cron and collect data and dump into a
database which can be used for query later [ yes - this is on
4. Use fabric (fabile.org) for developing program. Does this assume
that ssh root trust is already in place?
Are there any more different approaches? I suppose if we take the
daemon approach then we can make it as a webservice as well?
More information about the Python-list