Want to write a rest API to get OS CPU, memory and other system information, is preparing the bitter haha wheel of a/proc/stat parser, found Psutil ~ a cross-platform to obtain system information of the Python library, support LINUX,WINDOWS,OSX, SunOS, can say very good, very comprehensive, very pythonic
Https://github.com/giampaolo/psutil
Brief introduction:
Psutil (python system and process utilities) is a cross-platform library forretrieving information on running Processe s and system utilization(CPU, memory, disks, network) in Python. It is useful mainly for systemmonitoring, profiling and limiting process resources and management of Running Processes. It implements many functionalities offered by command linetools such as:ps, top, lsof, Netstat, ifconfig, who, DF, kill, Free, Nice,ionice, Iostat, Iotop, uptime, pidof, TTY, Taskset, Pmap. It currently supportsLinux, Windows, OSX, FreeBSD and Sun Solaris, both 32-bit and64-bit architectures, with the Python versions from 2.6 to 3.4 (users Ofpython 2.4 and 2.5 if use 2.1.3 version). PyPy is also known to work.
Cross-platform System information get Python library-Psutil