By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,068 Members | 825 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,068 IT Pros & Developers. It's quick & easy.

To run a python script in all the machines from one server

P: n/a
Hi Everyone

I want to run a python script in all the machines that are connected
through local network and collect the information about that machine
such as HDD size, RAM capacity(with number of slots) ,processer speed
etc.

But i want to run a script from just the server, so that it should
start scripts in all other machines, and get their local machines
information and dump the same information in some FTP.

Could you please let me know how can i do this??

Thanks
Yogi

Mar 28 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
mu*******@yahoo.com wrote:
Hi Everyone

I want to run a python script in all the machines that are connected
through local network and collect the information about that machine
such as HDD size, RAM capacity(with number of slots) ,processer speed
etc.

But i want to run a script from just the server, so that it should
start scripts in all other machines, and get their local machines
information and dump the same information in some FTP.

Could you please let me know how can i do this??

Thanks
Yogi

You could create a xmlrpc server on all clients, that listens for such a
request, then your server (which is an xmlrpc client) calls all the
clients on the appropriate exposed function, then the client proceeds on
gathering the required information and puts it using ftplib on the ftp
share. It is also possible to return all info via the xmlrpc call and
let the server do the ftp part, all depends on your requirements.

If your on a NT only network a better route would be to use WMI.

--
mph
Mar 28 '06 #2

P: n/a
mu*******@yahoo.com wrote:
Hi Everyone

I want to run a python script in all the machines that are connected
through local network and collect the information about that machine
such as HDD size, RAM capacity(with number of slots) ,processer speed
etc.

But i want to run a script from just the server, so that it should
start scripts in all other machines, and get their local machines
information and dump the same information in some FTP.

Could you please let me know how can i do this??

Thanks
Yogi


Take a look at: http://pybuild.sf.net/pyinvoke.html or
http://rpyc.sourceforge.net
Mar 28 '06 #3

P: n/a
mu*******@yahoo.com <mu*******@yahoo.com> wrote:
I want to run a python script in all the machines that are connected
through local network and collect the information about that machine
such as HDD size, RAM capacity(with number of slots) ,processer speed
etc.

But i want to run a script from just the server, so that it should
start scripts in all other machines, and get their local machines
information and dump the same information in some FTP.

Could you please let me know how can i do this??


If these are unix machines then I would use ssh/scp.

Use scp to copy the script to /tmp then run it and collect the output
with ssh (and os.popen/subprocess)

You can set ssh/scp up with keys too.

Number of RAM slots is reasonably hard to obtain. You might want to
investigate dmidecode for unix which queries the bios. It gives you
stuff like this showing my machine has 4 slots, with 2x512 MB in.

Handle 0x0007, DMI type 6, 12 bytes
Memory Module Information
Socket Designation: A0
Bank Connections: 1 2
Current Speed: Unknown
Type: ECC DIMM SDRAM
Installed Size: 512 MB (Double-bank Connection)
Enabled Size: 512 MB (Double-bank Connection)
Error Status: OK

Handle 0x0008, DMI type 6, 12 bytes
Memory Module Information
Socket Designation: A1
Bank Connections: 3 4
Current Speed: Unknown
Type: Unknown
Installed Size: Not Installed
Enabled Size: Not Installed
Error Status: OK

Handle 0x0009, DMI type 6, 12 bytes
Memory Module Information
Socket Designation: A2
Bank Connections: 5 6
Current Speed: Unknown
Type: ECC DIMM SDRAM
Installed Size: 512 MB (Double-bank Connection)
Enabled Size: 512 MB (Double-bank Connection)
Error Status: OK

Handle 0x000A, DMI type 6, 12 bytes
Memory Module Information
Socket Designation: A3
Bank Connections: 7 8
Current Speed: Unknown
Type: Unknown
Installed Size: Not Installed
Enabled Size: Not Installed
Error Status: OK

--
Nick Craig-Wood <ni**@craig-wood.com> -- http://www.craig-wood.com/nick
Mar 28 '06 #4

P: n/a
Nick Craig-Wood enlightened us with:
If these are unix machines then I would use ssh/scp.

Use scp to copy the script to /tmp then run it and collect the output
with ssh (and os.popen/subprocess)


I'd use ssh only. Just give a 'cat > /tmp/myscript.sh' command, then
output the contents of the script, followed by CTRL+D. That also
enables you to get the output directly (by giving the result of the
script on stdout) instead of having to create an FTP server too.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Mar 28 '06 #5

P: n/a
Nick Craig-Wood wrote:
If these are unix machines then I would use ssh/scp.


Even if they are Windows PCs, you could just install cygwin, openssh,
and python.
Mar 28 '06 #6

P: n/a

Yogi> I want to run a python script in all the machines that are
Yogi> connected through local network and collect the information about
Yogi> that machine such as HDD size, RAM capacity(with number of slots)
Yogi> ,processer speed etc.

Yogi> But i want to run a script from just the server, so that it should
Yogi> start scripts in all other machines, and get their local machines
Yogi> information and dump the same information in some FTP.

Yogi> Could you please let me know how can i do this??

Take a look at Nagios and plugins line nrpe.

Skip
Mar 28 '06 #7

P: n/a
jao
Quoting sk**@pobox.com:

Yogi> I want to run a python script in all the machines that are
Yogi> connected through local network and collect the information about
Yogi> that machine such as HDD size, RAM capacity(with number of slots)
Yogi> ,processer speed etc.

Yogi> But i want to run a script from just the server, so that it should
Yogi> start scripts in all other machines, and get their local machines
Yogi> information and dump the same information in some FTP.

Yogi> Could you please let me know how can i do this??

Take a look at Nagios and plugins line nrpe.


Another possibility is osh (http://geophile.com/osh). You could do something
like this:

osh @your_cluster [ f 'your_function' ] $

- your_cluster: logical name for the cluster.
- your_function: A python function you write to be run on each host.
- $: Prints information from each node as a python tuple.

You could, instead of printing with $, pipe the result to other
osh commands to further process the tuples containing information
from each host.

I wouldn't recommend this if the hosts are Windows since osh hasn't
been tested on Windows.

Jack Orenstein
(author of osh)

Mar 28 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.