3

I am trying to build a python script that will grab certain information about a system running mostly Windows or Linux. Here is what I got so far.

import socket
import os 
import sys
import platform
import psutil
import uuid

print  "Name: " +socket.gethostname() 
print "FQDN: " +socket.getfqdn()
print "System Platform: "+sys.platform
print "Machine: " +platform.machine()
print "Node " +platform.node()
print "Platform: "+platform.platform()
print "Pocessor: " +platform.processor()
print "System OS: "+platform.system()
print "Release: " +platform.release()
print "Version: " +platform.version()
print "Number of CPUs: " +str(psutil.cpu_count()) 
print "Number of Physical CPUs: " +str(psutil.cpu_count(logical=False))
#Need  Model of Computer i.e.  HP Compaq 8100 Elite SFF, HP X600 workstation
#need Ram
#need Disk space
#Need Manufacturer i.e. HP, Dell, Lenova

I am not sure how to get the Model Number of the System, and the Manufacturer both in Linux and Windows. I think I am able to get the RAM and Disk Space using psutil.

2
  • Hmm, could you also run say a shell command and get info from like df and whatnot? Commented Apr 7, 2014 at 16:22
  • I could use shell to do this but wondering if it was possible to do this in python. Commented Apr 7, 2014 at 16:25

1 Answer 1

2

I wrote an article sometime back which you may find useful. However, it is written exclusively for Linux and besides using some standard library modules, it directly reads data from the files in /proc and uses the subprocess module to execute Linux commands in some cases.

I haven't played with Windows recently, but you may find the technique of executing the relevant Windows commands using the subprocess module useful there as well.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.