diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2016-04-08 11:59:47 -0400 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2016-04-08 11:59:47 -0400 |
commit | d8a18ebcaef17ce81001ee8404e2a31982d9079e (patch) | |
tree | b6d9de4a192aa9968aad062017d758297e3e21e5 | |
parent | 7e0ed282983fc1389aaf97094ef0d0de821ad6a8 (diff) |
add script to parse cpu and mem usage
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | get-client-cpu-mem.py | 10 |
2 files changed, 12 insertions, 0 deletions
@@ -1,2 +1,4 @@ __pycache__ *.pyc +*.swp +*.swo diff --git a/get-client-cpu-mem.py b/get-client-cpu-mem.py new file mode 100644 index 0000000..eeac1b2 --- /dev/null +++ b/get-client-cpu-mem.py @@ -0,0 +1,10 @@ +import commands + +pid = commands.getoutput('ps x | grep "[s]erver-solsync" | cut -d " " -f 2') +res = commands.getoutput("ps -p " + pid + " -o \%cpu,\%mem") +splitted = res.split() +cpu = splitted[2] +mem = splitted[3] + +print cpu +print mem |