Commit 2e82e233 by Bach Dániel

update psutil

parent beee6ccb
...@@ -107,13 +107,15 @@ class Client: ...@@ -107,13 +107,15 @@ class Client:
""" """
now = time.time() now = time.time()
vmem = psutil.virtual_memory()
metrics = { metrics = {
'cpu.usage': psutil.cpu_percent(interval=0.0), 'cpu.usage': psutil.cpu_percent(),
'cpu.times': psutil.cpu_times().user + psutil.cpu_times().system, 'cpu.times': psutil.cpu_times().user + psutil.cpu_times().system,
'memory.usage': psutil.virtual_memory().percent, 'memory.usage': vmem.percent,
'memory.used_bytes': (vmem.total - vmem.available),
'swap.usage': psutil.swap_memory().percent, 'swap.usage': psutil.swap_memory().percent,
'user.count': len(psutil.get_users()), 'user.count': len(psutil.users()),
'system.boot_time': psutil.get_boot_time() 'system.boot_time': psutil.boot_time()
} }
for k, v in psutil.disk_io_counters().__dict__.items(): for k, v in psutil.disk_io_counters().__dict__.items():
...@@ -145,12 +147,12 @@ class Client: ...@@ -145,12 +147,12 @@ class Client:
for entry in psutil.get_process_list(): for entry in psutil.get_process_list():
try: try:
if entry.name in ('kvm', 'qemu-system-x86_64'): if entry.name() in ('kvm', 'qemu-system-x86_64'):
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('-name') parser.add_argument('-name')
parser.add_argument('--memory-size', '-m ', type=int) parser.add_argument('--memory-size', '-m ', type=int)
args, unknown = parser.parse_known_args( args, unknown = parser.parse_known_args(
entry.cmdline[1:]) entry.cmdline()[1:])
process = psutil.Process(entry.pid) process = psutil.Process(entry.pid)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment