Changed method for obtaining memory info
This commit is contained in:
parent
66c31c6ff8
commit
839c36bbf7
1 changed files with 2 additions and 4 deletions
6
main.py
6
main.py
|
@ -59,10 +59,8 @@ def monitorHost(stop_event):
|
||||||
|
|
||||||
load1, load5, load15 = psutil.getloadavg() # this takes time to warm up if not running script on *nix
|
load1, load5, load15 = psutil.getloadavg() # this takes time to warm up if not running script on *nix
|
||||||
loadavg = round((load1/os.cpu_count()) * 100, 2)
|
loadavg = round((load1/os.cpu_count()) * 100, 2)
|
||||||
|
|
||||||
total_memory, used_memory, free_memory = map(
|
memory = psutil.virtual_memory().percent
|
||||||
int, os.popen('free -t -m').readlines()[-1].split()[1:])
|
|
||||||
memory = round((used_memory/total_memory) * 100, 2)
|
|
||||||
|
|
||||||
print("CPU %: " + str(loadavg))
|
print("CPU %: " + str(loadavg))
|
||||||
print("Memory %: " + str(memory))
|
print("Memory %: " + str(memory))
|
||||||
|
|
Loading…
Reference in a new issue