Skip to main content

Pandas-powered package for systems monitoring

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdsys-0.3.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

pdsys-0.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pdsys-0.3.tar.gz.

File metadata

  • Download URL: pdsys-0.3.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pdsys-0.3.tar.gz
Algorithm Hash digest
SHA256 09cc83ae590376c850e6acd0416abfb022bf2065cbcc04b2d9f82f43ade1453e
MD5 f0c92a4b4e14155d5acb678c08da694b
BLAKE2b-256 aa8c17047f304181737103304b1035b1fcf5b5c35c35ba234657ba1cd35ff714

See more details on using hashes here.

File details

Details for the file pdsys-0.3-py3-none-any.whl.

File metadata

  • Download URL: pdsys-0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pdsys-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 be91b7d61c7dc5169fdab33c060af17da05be533c4a1192161fdc2e6beb6db0d
MD5 cc976b853dea3e0a1de0cb643598f855
BLAKE2b-256 59aca432db54b4936c0c945506e426d7cea45740c2fdda51d9b3a48aafff441b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page