How to program in Python to run system commands in 1000s of servers

Chris Angelico rosuav at
Thu Apr 7 10:13:41 EDT 2011

On Thu, Apr 7, 2011 at 9:27 PM, Anssi Saari <as at> wrote:
> Roy Smith <roy at> writes:
>>> We cannot use ssh as root remote connectivity as well.
>> but with 1000's of servers, I really don't see any alternative to ssh,
>> with key authentication.  You don't really propose to type passwords at
>> 1000's of machines, do you?
> I guess it might mean someone decided to config sshd with
> PermitRootLogin no... I believe this is common? I don't think it's a
> particularly good idea, especially for a large scale deployment.
> So I guess there may be some config needed for the machines before
> they can be remotely administrated in an automatic fashion.

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.

Alternatively, if the program needs to be run periodically anyway, it
might be easier to simply cron it on every computer it needs to run
on, and then log the results to some central server (maybe a MySQL
database, or something). Then whenever you want stats, you just query
that server.

Chris Angelico

More information about the Python-list mailing list