summaryrefslogtreecommitdiffstats
path: root/src/com.gluster.storage.management.gateway.scripts
diff options
context:
space:
mode:
authorTim <timothyasir@gluster.com>2011-08-04 13:41:12 +0530
committerTim <timothyasir@gluster.com>2011-08-04 13:43:40 +0530
commit403971bb3606f7a7f917fefedeaaccbe3ce70b46 (patch)
tree8429d1646f0b0e1d97d00839334cd4999be30b96 /src/com.gluster.storage.management.gateway.scripts
parentcbf33ecd9cfdb138b543e7f67cdce775455e1915 (diff)
Bug 3278 - Upper limit for CPU usage should be 100%
Diffstat (limited to 'src/com.gluster.storage.management.gateway.scripts')
-rwxr-xr-xsrc/com.gluster.storage.management.gateway.scripts/src/get_rrd_cpu_details.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/com.gluster.storage.management.gateway.scripts/src/get_rrd_cpu_details.py b/src/com.gluster.storage.management.gateway.scripts/src/get_rrd_cpu_details.py
index 57ab4025..8d2efd1a 100755
--- a/src/com.gluster.storage.management.gateway.scripts/src/get_rrd_cpu_details.py
+++ b/src/com.gluster.storage.management.gateway.scripts/src/get_rrd_cpu_details.py
@@ -29,13 +29,19 @@ import Utils
def getCpuData(period):
cpuRrdFile = "/var/lib/rrd/cpu.rrd"
rs = ResponseXml()
+
command = "rrdtool xport --start -%s \
DEF:cpuuser=%s:user:AVERAGE \
DEF:cpusystem=%s:system:AVERAGE \
- CDEF:total=cpuuser,cpusystem,+ \
- XPORT:cpuuser:user \
- XPORT:cpusystem:system \
- XPORT:total:total" % (period, cpuRrdFile, cpuRrdFile)
+ DEF:cpuidle=%s:idle:AVERAGE \
+ CDEF:total=cpuuser,cpusystem,cpuidle,+,+ \
+ CDEF:userpct=100,cpuuser,total,/,* \
+ CDEF:systempct=100,cpusystem,total,/,* \
+ CDEF:idlepct=100,cpuidle,total,/,* \
+ CDEF:totalpct=userpct,systempct,+ \
+ XPORT:userpct:userpct \
+ XPORT:systempct:systempct \
+ XPORT:totalpct:totalpct" % (period, cpuRrdFile, cpuRrdFile, cpuRrdFile)
rv = Utils.runCommand(command, output=True, root=True)
message = Utils.stripEmptyLines(rv["Stdout"])