From 8464abd097493279c9978ebd4fc7334a25713a6f Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Sat, 11 Feb 2017 12:09:43 +0100 Subject: [PATCH] Now regexes the output for load command to only get the load values. TODO: Error handling and type checking. --- status/load.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) mode change 100644 => 100755 status/load.py diff --git a/status/load.py b/status/load.py old mode 100644 new mode 100755 index 6686f06..54b8a6e --- a/status/load.py +++ b/status/load.py @@ -3,8 +3,9 @@ from subprocess import check_output from re import findall def load(): - arpOutput = check_output("sudo arp-scan -l", shell=True) - print(findall('[0-9]{1,2}[\.][0-9]{2}')) + arpOutput = check_output("cat /proc/loadavg", shell=True) + arpOutput = arpOutput.decode() + print(findall('[0-9]{1,2}[\.][0-9]{2}', arpOutput)) if __name__ == '__main__': - load() \ No newline at end of file + load()