PSutil - Cross-Platform Lib For Process and System Monitoring in Python
PSutil - Cross-Platform Lib For Process and System Monitoring in Python
# system-monitoring # process-monitor
Branch: master New pull request Create new file Upload files Find file Clone or download
giampaolo #1394 / win / exe: use QueryFullProcessImageNameW to get the exe() (#… … Latest commit 7381d4d 2 days ago
psutil #1394 / win / exe: use QueryFullProcessImageNameW to get the exe() (#… 2 days ago
.git-pre-commit Fix pre-commit hook for python 3.x. (#1159) a year ago
.gitignore (issue #581) add more stuff in .gitignore - bump up version to 3.0.0 4 years ago
HISTORY.rst #1394 / win / exe: use QueryFullProcessImageNameW to get the exe() (#… 2 days ago
LICENSE Removed all the crappy ^M line endings added when modifying files on … 9 years ago
tox.ini Revert "Move tests out of package to top level directory (#1232)" (#1242 a year ago
README.rst
downloads/month 7M Linux / macOS passing Windows passing coverage 93% docs passing pypi v5.5.1 stars 5k license BSD
Quick links
Home page
Install
Documentation
Download
Forum
StackOverflow
Blog
Development guide
What's new
Summary
psutil (process and system utilities) is a cross-platform library for retrieving information on running processes and system
utilization (CPU, memory, disks, network, sensors) in Python. It is useful mainly for system monitoring, profiling and limiting
process resources and management of running processes. It implements many functionalities offered by UNIX command line
tools such as: ps, top, lsof, netstat, ifconfig, who, df, kill, free, nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap. psutil
currently supports the following platforms:
Linux
Windows
macOS,
FreeBSD, OpenBSD, NetBSD
Sun Solaris
AIX
...both 32-bit and 64-bit architectures. Supported Python versions are 2.6, 2.7 and 3.4+**. PyPy is also known to work.
Example applications
https://github.com/facebook/osquery/
https://github.com/nicolargo/glances
https://github.com/google/grr
https://github.com/Jahaja/psdash
https://github.com/ajenti/ajenti
https://github.com/home-assistant/home-assistant/
Portings
Go: https://github.com/shirou/gopsutil
C: https://github.com/hamon-in/cpslib
Node: https://github.com/christkv/node-psutil
Rust: https://github.com/borntyping/rust-psutil
Ruby: https://github.com/spacewander/posixpsutil
Nim: https://github.com/johnscillieri/psutil-nim
Example usages
CPU
Memory
Disks
Network
Sensors
Process management
Popen wrapper:
Windows services
>>> list(psutil.win_service_iter())
[<WindowsService(name='AeLookupSvc', display_name='Application Experience') at 38850096>,
<WindowsService(name='ALG', display_name='Application Layer Gateway Service') at 38850128>,
<WindowsService(name='APNMCP', display_name='Ask Update Service') at 38850160>,
<WindowsService(name='AppIDSvc', display_name='Application Identity') at 38850192>,
...]
>>> s = psutil.win_service_get('alg')
>>> s.as_dict()
{'binpath': 'C:\\Windows\\System32\\alg.exe',
'description': 'Provides support for 3rd party protocol plug-ins for Internet Connection Sharing',
'display_name': 'Application Layer Gateway Service',
'name': 'alg',
'pid': None,
'start_type': 'manual',
'status': 'stopped',
'username': 'NT AUTHORITY\\LocalService'}
Other samples
See doc recipes.
Author
psutil was created and is maintained by Giampaolo Rodola'. A lot of time and effort went into making psutil as it is right now. If
you feel psutil is useful to you or your business and want to support its future development please consider donating me
(Giampaolo) some money.
Don't want to donate money? Then maybe you could write me a recommendation on Linkedin.