From 7fcd6c03b11f6b071a2b10f1f94454ac88d723d2 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Fri, 9 Mar 2012 11:07:59 +0000 Subject: [PATCH] support the latest ganglia output git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11805 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/xcat/plugins/web.pm | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/xCAT-UI/xcat/plugins/web.pm b/xCAT-UI/xcat/plugins/web.pm index 066298b2a..95daaf990 100644 --- a/xCAT-UI/xcat/plugins/web.pm +++ b/xCAT-UI/xcat/plugins/web.pm @@ -703,17 +703,20 @@ sub web_gangliaShow{ my $cpunum = 0; for($index = 0; $index < $size; $index += $step){ if ($runInfo->[$index] =~ /^(\S+): (\S+) (\S+)/){ - if (($2 eq 'NaNQ') || ($2 eq 'nan')){ + my $timestamp = $1; + my $value = $2; + my $valuenum = $3; + if ((lc($value) =~ /nanq/) || (lc($value) =~ /nan/)){ #the rrdtool fetch last outline line always nan, so no need to add into return string if ($index == ($size - 1)){ next; } - $temp .= $1 . ',0,'; + $temp .= $timestamp . ',0,'; } else{ - $cpuidle = sprintf "%.2f", $2; - $cpunum = sprintf "%.2f", $3; - $temp .= $1 . ',' . (sprintf "%.2f", $cpuidle/$cpunum) . ','; + $cpuidle = sprintf "%.2f", $value; + $cpunum = sprintf "%.2f", $valuenum; + $temp .= $timestamp . ',' . (sprintf "%.2f", $cpuidle/$cpunum) . ','; } } } @@ -721,15 +724,17 @@ sub web_gangliaShow{ else{ for($index = 0; $index < $size; $index += $step){ if ($runInfo->[$index] =~ /^(\S+): (\S+).*/){ - if (($2 eq 'NaNQ') || ($2 eq 'nan')){ + my $timestamp = $1; + my $value = $2; + if ((lc($value) =~ /nanq/) || (lc($value) =~ /nan/)){ #the rrdtool fetch last outline line always nan, so no need to add into return string if ($index == ($size - 1)){ next; } - $temp .= $1 . ',0,'; + $temp .= $timestamp . ',0,'; } else{ - $temp .= $1 . ',' . (sprintf "%.2f", $2) . ','; + $temp .= $timestamp . ',' . (sprintf "%.2f", $2) . ','; } } } @@ -1061,7 +1066,7 @@ sub web_rmcmonShow() { next; } - if ($temp =~ /[NaNQ|nan]/){ + if (lc($temp) =~ /[nanq|nan]/){ next; }