From b92bed686f58ef3458a52207bf2636c721efdbe9 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Thu, 3 Dec 2015 15:04:18 +0100 Subject: [PATCH] [IMP] support really old psutils --- dead_mans_switch_client/models/dead_mans_switch_client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dead_mans_switch_client/models/dead_mans_switch_client.py b/dead_mans_switch_client/models/dead_mans_switch_client.py index efb611509..9fe2719a9 100644 --- a/dead_mans_switch_client/models/dead_mans_switch_client.py +++ b/dead_mans_switch_client/models/dead_mans_switch_client.py @@ -36,10 +36,14 @@ class DeadMansSwitchClient(orm.AbstractModel): for process in processes: if hasattr(process, 'memory_percent'): ram += process.memory_percent() + elif hasattr(process, 'get_memory_percent'): + ram += process.get_memory_percent() else: ram = None if hasattr(process, 'cpu_percent'): cpu += process.cpu_percent() + elif hasattr(process, 'get_cpu_percent'): + cpu += process.get_cpu_percent() else: cpu = None return {