Using Python, how can information such as CPU usage, memory usage (free, used, etc), process count, etc be returned in a generic manner so that the same code can be run on Linux, Windows, BSD, etc?
Alternatively, how could this information be returned on all the above systems with the code specific to that OS being run only if that OS is indeed the operating environment?
Regarding cross-platform: your best bet is probably to write platform-specific code, and then import it conditionally. e.g.
For specific resources, as Anthony points out you can access
/procunder linux. For Windows, you could have a poke around at the Microsoft Script Repository. I’m not sure where to get that kind of information on Macs, but I can think of a great website where you could ask 🙂