Now regexes the output for load command to only get the load values. TODO: Error handling and type checking.

This commit is contained in:
2017-02-11 12:09:43 +01:00
parent 622af02298
commit 8464abd097

7
status/load.py Normal file → Executable file
View File

@@ -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()
load()