summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-04-08 11:59:47 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2016-04-08 11:59:47 -0400
commitd8a18ebcaef17ce81001ee8404e2a31982d9079e (patch)
treeb6d9de4a192aa9968aad062017d758297e3e21e5
parent7e0ed282983fc1389aaf97094ef0d0de821ad6a8 (diff)
add script to parse cpu and mem usage
-rw-r--r--.gitignore2
-rw-r--r--get-client-cpu-mem.py10
2 files changed, 12 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 8d35cb3..3ba34a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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