summaryrefslogtreecommitdiff
path: root/get_client_cpu_mem.py
blob: fe1aeec2a41b53cbe17189834f8c5311f89840cf (plain)
1
2
3
4
5
6
7
8
9
10
11
import commands
import urllib
import psutil

pid, phase = urllib.urlopen('http://localhost:8080/stats').read().split()
res = commands.getoutput("ps -p " + pid + " -o \%cpu,\%mem")
splitted = res.split()
cpu = splitted[2]
mem = splitted[3]

print cpu, mem, phase