Update stats.py
IP and HOST were being returned with newline characters at the end causing issue #349 I've used tr to trim the newline character from the stream.
This commit is contained in:
parent
81556d81b3
commit
5d285cc366
1 changed files with 2 additions and 2 deletions
|
|
@ -74,9 +74,9 @@ while True:
|
|||
|
||||
# Shell scripts for system monitoring from here :
|
||||
# https://unix.stackexchange.com/questions/119126/command-to-display-memory-usage-disk-usage-and-cpu-load
|
||||
cmd = "hostname -I | cut -d\' \' -f1"
|
||||
cmd = "hostname -I | cut -d\' \' -f1 | tr -d \'\\n\'"
|
||||
IP = subprocess.check_output(cmd, shell=True)
|
||||
cmd = "hostname"
|
||||
cmd = "hostname | tr -d \'\\n\'"
|
||||
HOST = subprocess.check_output(cmd, shell=True)
|
||||
cmd = "top -bn1 | grep load | awk " \
|
||||
"'{printf \"CPU Load: %.2f\", $(NF-2)}'"
|
||||
|
|
|
|||
Loading…
Reference in a new issue