Extracting info from OS/hardware

Adriano Varoli Piazza moranar at daleclick.com
Sun Mar 14 16:11:07 EST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

El Dom 14 Mar 2004 17:55, Cameron Laird escribió:
> In article <nOq3c.9451$_c4.119500 at news4.e.nsc.no>,
>
> Thomas Weholt <2002 at weholt.org> wrote:
> >I need a piece of code to extract as much info about OS, current status
> > and hardware from a machine as possible ( at least, all available
> > partitions and free space on these, CPU-speed, free/total memory and
> > stuff like that ) at one given moment on Linux and Windows.
> >
> >Any hints? Can I call something in win32all on Windows or read some file
> > on linux? I'm not sure where to begin.
>
> 			.
> 			.
> 			.
> I was hoping someone else would answer this.
>
> My impression is that there are dozens of answers to this.
> I know I've seen quite a few such utilities advertised in
> places like Freshmeat.  I haven't kept track of them at
> all.
>
> "... as much info ... as possible ...":  whoooo!  Usually
> when a manager says that to me, I ask for how much he's
> willing to pay.  As it turns out, notions like "free
> space", "CPU speed", and so on are surprisingly poorly
> standardized.  It's far from clear what they mean for any
> particular platform.
>
> Sooooooo, what I usually do is define my requirements
> carefully, and write up my own tool.
> --
>
> Cameron Laird <claird at phaseit.net>
> Business:  http://www.Phaseit.net

In Linux, you can get a lot of information on hardware and status by examining 
files in the /proc directory. For example, from doing cat /proc/cpuinfo on my 
system:
[adriano at localhost adriano]$ cat /proc/cpuinfo 
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 6
model           : 8
model name      : AMD Athlon(TM) XP 1700+
stepping        : 1
cpu MHz         : 1833.218
cache size      : 256 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca 
cmov pat pse36 mmx fxsr sse syscall mmxext 3dnowext 3dnow
bogomips        : 3629.05

For disk space and free space, you check /proc/diskstats, etc.
No idea about how to do it on Windows, but programs like "Treesize" tell me it 
mustn't be that hard.
Ciao.
- -- 
Adriano Varoli Piazza
http://moranar.com.ar
ICQ: 4410132
MSN: adrianomd at hotmail.com
Claves gpg / pgp en hkp://subkeys.pgp.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAVMqLkDP9anP2KHwRApTsAKChjLmg0AlCaQeRCzPhXBpZ3sq/twCg2kWq
XyZNT8JkZeDn+hcmchUDP+8=
=ioqx
-----END PGP SIGNATURE-----




More information about the Python-list mailing list