from twisted.internet.defer import succeed from landscape.lib.process import ProcessInformation class Processes(object): def __init__(self, proc_dir="/proc"): self._proc_dir = proc_dir def register(self, sysinfo): self._sysinfo = sysinfo def run(self): num_processes = 0 num_zombies = 0 info = ProcessInformation(proc_dir=self._proc_dir) for process_info in info.get_all_process_info(): num_processes += 1 if process_info["state"] == b"Z": num_zombies += 1 if num_zombies: if num_zombies == 1: msg = "There is 1 zombie process." else: msg = "There are %d zombie processes." % (num_zombies,) self._sysinfo.add_note(msg) self._sysinfo.add_header("Processes", str(num_processes)) return succeed(None)
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
__init__.py | File | 0 B | 0644 |
|
deployment.py | File | 4.86 KB | 0644 |
|
disk.py | File | 2.52 KB | 0644 |
|
landscapelink.py | File | 336 B | 0644 |
|
load.py | File | 264 B | 0644 |
|
loggedinusers.py | File | 497 B | 0644 |
|
memory.py | File | 606 B | 0644 |
|
network.py | File | 1.14 KB | 0644 |
|
processes.py | File | 896 B | 0644 |
|
sysinfo.py | File | 9.72 KB | 0644 |
|
temperature.py | File | 806 B | 0644 |
|
testplugin.py | File | 541 B | 0644 |
|