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

M

muttu2244

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
 
M

Martin P. Hellwig

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.
 
E

Eyal Lotem

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
 
N

Nick Craig-Wood

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
 
S

Sybren Stuvel

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
 
S

skip

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
 
J

jao

Quoting (e-mail address removed):
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,291
Messages
2,571,453
Members
48,137
Latest member
IndiraMcCo

Latest Threads

Top