From 66d287e44d4278ec65df731dd43c6e8a1f6e423f Mon Sep 17 00:00:00 2001 From: ndarshan Date: Mon, 21 Apr 2014 12:47:14 +0530 Subject: Server-addon:Fix: Modified graph templates for memory and swap. Modified graph templates for memory and swap to handle the unit change in respective plugins . https://bugzilla.redhat.com/show_bug.cgi?id=1080004 Signed-off-by: ndarshan Change-Id: Id11dee8992b7a4ba93df0fb107fa73e29035088e Reviewed-on: http://review.gluster.org/7641 Reviewed-by: Sahina Bose --- templates/check_memory.php | 17 +++++++---------- templates/check_swap_usage.php | 11 ++++------- 2 files changed, 11 insertions(+), 17 deletions(-) (limited to 'templates') diff --git a/templates/check_memory.php b/templates/check_memory.php index c06ffc5..a758d29 100644 --- a/templates/check_memory.php +++ b/templates/check_memory.php @@ -18,8 +18,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # $def[1]=""; $opt[1]=""; $ds_name[1]=""; -$upper_limit = round($MAX[1] / (1048576),2); -$opt[1] = "--vertical-label \"$UNIT[1](Total:$upper_limit GB)\" -l 0 -u $upper_limit -r --title \"Memory usage for $hostname / $servicedesc\" --slope-mode -N"; +$opt[1] = "-X 0 --vertical-label \"$UNIT[1](Total:$MAX[1] GB)\" -l 0 -u $MAX[1] -r --title \"Memory usage for $hostname / $servicedesc\" --slope-mode -N"; $ds_name[1] = "Memory Usage"; @@ -29,31 +28,29 @@ $def[1] .= "DEF:used_mem_in=$RRDFILE[1]:$DS[2]:AVERAGE " ; $def[1] .= "DEF:buffer_mem_in=$RRDFILE[1]:$DS[3]:AVERAGE " ; $def[1] .= "DEF:cached_mem_in=$RRDFILE[1]:$DS[4]:AVERAGE " ; -$def[1] .= rrd::cdef("used_mem_out","used_mem_in,1048576,/"); +$def[1] .= "CDEF:used_mem_out=used_mem_in "; $def[1] .= "LINE1:used_mem_out#0000ff:\"Used \" "; $def[1] .= "GPRINT:used_mem_out:LAST:\"%8.2lf GB LAST \" "; $def[1] .= "GPRINT:used_mem_out:MAX:\"%8.2lf GB MAX \" "; $def[1] .= "GPRINT:used_mem_out" . ':AVERAGE:"%8.2lf GB AVERAGE \j" '; -$def[1] .= rrd::cdef("buffer_mem_out","buffer_mem_in,1048576,/"); +$def[1] .= "CDEF:buffer_mem_out=buffer_mem_in "; $def[1] .= "LINE1:buffer_mem_out#800080:\"Buffer \" "; $def[1] .= "GPRINT:buffer_mem_out:LAST:\"%8.2lf GB LAST \" "; $def[1] .= "GPRINT:buffer_mem_out:MAX:\"%8.2lf GB MAX \" "; $def[1] .= "GPRINT:buffer_mem_out" . ':AVERAGE:"%8.2lf GB AVERAGE \j" '; -$def[1] .= rrd::cdef("cached_mem_out","cached_mem_in,1048576,/"); +$def[1] .= "CDEF:cached_mem_out=cached_mem_in "; $def[1] .= "LINE1:cached_mem_out#008000:\"Cached \" "; $def[1] .= "GPRINT:cached_mem_out:LAST:\"%8.2lf GB LAST \" "; $def[1] .= "GPRINT:cached_mem_out:MAX:\"%8.2lf GB MAX \" "; $def[1] .= "GPRINT:cached_mem_out" . ':AVERAGE:"%8.2lf GB AVERAGE \j" '; if ($WARN[1] != ""){ - $WAR = $WARN[1] / 1048576 ; - $def[1] .= "LINE2:$WAR#FFA500:\"Warning \\n\" "; + $def[1] .= "LINE2:$WARN[1]#FFA500:\"Warning \\n\" "; } if ($CRIT[1] != "") { - $CRT = $CRIT[1] / 1048576 ; - $def[1] .= "LINE2:$CRT#FF0000:\"Critical \\n\" "; - } + $def[1] .= "LINE2:$CRIT[1]#FF0000:\"Critical \\n\" "; +} ?> \ No newline at end of file diff --git a/templates/check_swap_usage.php b/templates/check_swap_usage.php index ef62064..1444f74 100644 --- a/templates/check_swap_usage.php +++ b/templates/check_swap_usage.php @@ -17,24 +17,21 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -$upper_limit = round($MAX[1] / (1048576),2); -$opt[1] = "-X 0 --vertical-label \"$UNIT[1](Total:$upper_limit GB)\" -l 0 -r -u $upper_limit --title \"Swap usage $hostname / $servicedesc\" "; +$opt[1] = "-X 0 --vertical-label \"$UNIT[1](Total:$MAX[1] GB)\" -l 0 -r -u $MAX[1] --title \"Swap usage $hostname / $servicedesc\" "; $ds_name[1] = "Swap Usage"; $def[1] = "DEF:used_swap_in=$RRDFILE[1]:$DS[1]:AVERAGE " ; -$def[1] .= rrd::cdef("used_swap_out","used_swap_in,1048576,/"); +$def[1] .= "CDEF:used_swap_out=used_swap_in "; $def[1] .= "AREA:used_swap_out#3D1AA8:\"Used \" "; $def[1] .= "GPRINT:used_swap_out:LAST:\"%3.2lf GB LAST \" "; $def[1] .= "GPRINT:used_swap_out:MAX:\"%3.2lf GB MAX \" "; $def[1] .= "GPRINT:used_swap_out" . ':AVERAGE:"%3.2lf GB AVERAGE \j" '; if ($WARN[1] != ""){ - $WAR = $WARN[1] / 1048576 ; - $def[1] .= "LINE2:$WAR#FFA500:\"Warning \\n\" "; + $def[1] .= "LINE2:$WARN[1]#FFA500:\"Warning \\n\" "; } if ($CRIT[1] != "") { - $CRT = $CRIT[1] / 1048576 ; - $def[1] .= "LINE2:$CRT#FF0000:\"Critical \\n\" "; + $def[1] .= "LINE2:$CRIT[1]#FF0000:\"Critical \\n\" "; $def[1] .= "COMMENT:\" \\n\" "; $def[1] .= "COMMENT:\" \\n\" "; } -- cgit