/usr/share/pyshared/landscape/sysinfo/processes.py is in landscape-common 12.04.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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"] == "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)
|