Process monitoring

Monitor and collect information about running processes including CPU and memory usage rankings.

source

get_process_info

 get_process_info (top_n:int=5)

Get top processes by CPU and memory usage.

Type Default Details
top_n int 5
Returns dict Number of top processes to return for CPU and memory categories # A dictionary containing top processes and process statistics
get_process_info()
{'top_cpu': [{'pid': 1,
   'name': 'systemd',
   'cpu_percent': 0,
   'memory_percent': 0.014959169314795313,
   'memory_mb': 14.07421875,
   'username': 'root',
   'status': 'sleeping'},
  {'pid': 621,
   'name': 'systemd-journald',
   'cpu_percent': 0,
   'memory_percent': 0.016449688821875943,
   'memory_mb': 15.4765625,
   'username': 'root',
   'status': 'sleeping'},
  {'pid': 696,
   'name': 'systemd-udevd',
   'cpu_percent': 0,
   'memory_percent': 0.007884391487315099,
   'memory_mb': 7.41796875,
   'username': 'root',
   'status': 'sleeping'},
  {'pid': 1175,
   'name': 'systemd-oomd',
   'cpu_percent': 0,
   'memory_percent': 0.007867784027626177,
   'memory_mb': 7.40234375,
   'username': 'systemd-oom',
   'status': 'sleeping'},
  {'pid': 1191,
   'name': 'systemd-resolved',
   'cpu_percent': 0,
   'memory_percent': 0.012592606309124113,
   'memory_mb': 11.84765625,
   'username': 'systemd-resolve',
   'status': 'sleeping'}],
 'top_memory': [{'pid': 14235,
   'name': 'firefox',
   'cpu_percent': 0,
   'memory_percent': 1.9376462961503658,
   'memory_mb': 1823.01953125,
   'username': 'innom-dt',
   'status': 'sleeping'},
  {'pid': 15126,
   'name': 'Isolated Web Co',
   'cpu_percent': 0,
   'memory_percent': 0.9300717168235476,
   'memory_mb': 875.05078125,
   'username': 'innom-dt',
   'status': 'sleeping'},
  {'pid': 5452,
   'name': 'gnome-shell',
   'cpu_percent': 0,
   'memory_percent': 0.5894402630090176,
   'memory_mb': 554.5703125,
   'username': 'innom-dt',
   'status': 'sleeping'},
  {'pid': 12565,
   'name': 'code',
   'cpu_percent': 0,
   'memory_percent': 0.48500010089031764,
   'memory_mb': 456.30859375,
   'username': 'innom-dt',
   'status': 'sleeping'},
  {'pid': 65825,
   'name': 'Isolated Web Co',
   'cpu_percent': 0,
   'memory_percent': 0.4831400654051585,
   'memory_mb': 454.55859375,
   'username': 'innom-dt',
   'status': 'sleeping'}],
 'total': 199,
 'status_counts': {'sleeping': 198, 'running': 1}}