1

I was wondering if there was a platform independent way of getting system information for linux, windows, mac. I know you can use platform module to get some basic information. I am looking for more detailed information like

  1. CPU information like number of logical cores, number of physical cores, number of sockets, frequency, capabilities
  2. Total amount of physical memory
  3. Disk space -- total, free for each disk
  4. Network interfaces, mac address, ip address (ipv4/ipv6), speed, hostname
  5. OS information
tuxalot
  • 313
  • 4
  • 11

1 Answers1

1

I recommend using psutil library for this. Not everything you require is available, but it's a good place to start. For example, to get the CPU count, you can use the following code.

>>> import psutil
>>> psutil.cpu_count() # Logical core
4
>>> psutil.cpu_count(logical=False) # Physical core
2
Kien Truong
  • 11,179
  • 2
  • 30
  • 36
  • Thank you for your comments, I ended up writing something linux parsing /proc/cpuinfo and /proc/meminfo. I need to figure things out for windows and os x. – tuxalot Jun 05 '14 at 05:12