pdsys
Pandas-powered package for systems monitoring
To Inatall
pip install pdsys
Basic usage
import pdsys
To get a system utilization report (as dataframe) on local:
df = pdsys.report()
pdsys returns by default all process attributes information from psutil process iterator:
df.columns.tolist()
>>> ['cmdline',
'connections',
'cpu_affinity',
'cpu_num',
'cpu_percent',
'cpu_times.children_system',
'cpu_times.children_user',
'cpu_times.system',
'cpu_times.user',
'create_time',
'cwd',
'environ',
'exe',
'gids.effective',
'gids.real',
'gids.saved',
'hostname',
'io_counters',
'io_counters.read_bytes',
'io_counters.read_chars',
'io_counters.read_count',
'io_counters.write_bytes',
'io_counters.write_chars',
'io_counters.write_count',
'ionice.value',
'memory_full_info',
'memory_full_info.data',
'memory_full_info.dirty',
'memory_full_info.lib',
'memory_full_info.pss',
'memory_full_info.rss',
'memory_full_info.shared',
'memory_full_info.swap',
'memory_full_info.text',
'memory_full_info.uss',
'memory_full_info.vms',
'memory_info.data',
'memory_info.dirty',
'memory_info.lib',
'memory_info.rss',
'memory_info.shared',
'memory_info.text',
'memory_info.vms',
'memory_maps',
'memory_percent',
'name',
'nice',
'num_ctx_switches.involuntary',
'num_ctx_switches.voluntary',
'num_fds',
'num_threads',
'open_files',
'pid',
'ppid',
'status',
'terminal',
'threads',
'uids.effective',
'uids.real',
'uids.saved',
'username']
You can query the output dataframe to get more insights about the system:
# getting top 5 processes sorted by memory utilization
df.sort_values(by='memory_percent',
ascending=False)[['name', 'memory_percent']].head(5)
| name | memory_percent | |
|---|---|---|
| 104 | systemd-journald | 20.865 |
| 76 | gunicorn | 4.06886 |
| 75 | gunicorn | 4.05697 |
| 77 | gunicorn | 4.01536 |
| 74 | gunicorn | 1.92189 |
Also, pdsys can run reports from remote systems by providing list of hosts:
df = pdsys.report(hosts=['user@host1', 'user@host2'])
df[df.memory_percent > 0.9].groupby(['hostname',
'name']).agg({'memory_percent': 'sum',
'pid': 'count',
'num_threads': 'sum',
'memory_info.rss': lambda x: sum(x) / 1e6})
| hostname | name | memory_percent | pid | num_threads | memory_info.rss | |
|---|---|---|---|---|---|---|
| 0 | host1 | Google Chrome | 2.13456 | 1 | 31 | 183.357 |
| 1 | host1 | Google Chrome Helper (GPU) | 1.31197 | 1 | 9 | 112.697 |
| 2 | host1 | Google Chrome Helper (Renderer) | 9.3699 | 8 | 107 | 804.868 |
| 3 | host1 | Python | 1.0848 | 1 | 12 | 93.184 |
| 4 | host1 | Terminal | 1.7745 | 1 | 6 | 152.429 |
| 5 | host1 | pycharm | 9.88402 | 1 | 66 | 849.031 |
| 6 | host2 | do-agent | 1.19791 | 1 | 6 | 12.3822 |
| 7 | host2 | gunicorn | 14.0631 | 4 | 4 | 145.363 |
| 8 | host2 | postgres | 1.54504 | 1 | 1 | 15.9703 |
| 9 | host2 | python3 | 3.47208 | 3 | 4 | 35.8892 |
| 10 | host2 | systemd-journald | 21.0484 | 1 | 1 | 217.567 |
Metadata
Release files for pdsys 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pdsys-0.3.tar.gz | 4.8 kB | Without provenance | Details for pdsys-0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pdsys-0.3-py3-none-any.whl | Python 3 | none | any | Details for pdsys-0.3-py3-none-any.whl |
Total release size: 9.5 kB
Release files / pdsys-0.3.tar.gz
| Download URL | pdsys-0.3.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09cc83ae590376c850e6acd0416abfb022bf2065cbcc04b2d9f82f43ade1453e
|
|
BLAKE2b-256 checksum How to use checksums |
aa8c17047f304181737103304b1035b1fcf5b5c35c35ba234657ba1cd35ff714
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.6
|
Release files / pdsys-0.3-py3-none-any.whl
| Download URL | pdsys-0.3-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be91b7d61c7dc5169fdab33c060af17da05be533c4a1192161fdc2e6beb6db0d
|
|
BLAKE2b-256 checksum How to use checksums |
59aca432db54b4936c0c945506e426d7cea45740c2fdda51d9b3a48aafff441b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.6
|
Security for pdsys 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.