diff --git a/xCAT-rmc/plugin/rmcmetrix.pm b/xCAT-rmc/plugin/rmcmetrix.pm index a4d3cfe56..8478c4be0 100755 --- a/xCAT-rmc/plugin/rmcmetrix.pm +++ b/xCAT-rmc/plugin/rmcmetrix.pm @@ -353,6 +353,7 @@ sub get_sum_metrix my $nodename = undef; my $time = undef; # my $end:shared; + my %summetrix = {}; my $end = undef; $end = xCAT::Utils->runcmd("date +%s", 0); # my $step:shared; @@ -420,8 +421,8 @@ sub get_sum_metrix # $summary{$a}{$n}{$timestamp} = &share({}); # $summary{$a}{$n}{$timestamp}{sum} = &share({}); # $summary{$a}{$n}{$timestamp}{num} = &share({}); - $summary{$a}{$n}{$timestamp}{sum} = $sum; - $summary{$a}{$n}{$timestamp}{num} = $num; + $summetrix{$a}{$timestamp}{sum} += $sum * $num; + $summetrix{$a}{$timestamp}{num} += $num; } } } @@ -435,18 +436,18 @@ sub get_sum_metrix # } # } - my %summetrix = {}; - foreach $attribute (keys %summary){ - foreach $nodename (keys %{$summary{$attribute}}){ - foreach $time (keys %{$summary{$attribute}{$nodename}}){ - print "$attribute.$nodename.$time $summary{$attribute}{$nodename}{$time}{sum} $summary{$attribute}{$nodename}{$time}{num}\n"; - $temp = $summary{$attribute}{$nodename}{$time}{sum} * $summary{$attribute}{$nodename}{$time}{num}; - $summetrix{$attribute}{$time}{sum} += $temp; - $summetrix{$attribute}{$time}{num} += $summary{$attribute}{$nodename}{$time}{num}; - } - } +# my %summetrix = {}; +# foreach $attribute (keys %summary){ +# foreach $nodename (keys %{$summary{$attribute}}){ +# foreach $time (keys %{$summary{$attribute}{$nodename}}){ +# print "$attribute.$nodename.$time $summary{$attribute}{$nodename}{$time}{sum} $summary{$attribute}{$nodename}{$time}{num}\n"; +# $temp = $summary{$attribute}{$nodename}{$time}{sum} * $summary{$attribute}{$nodename}{$time}{num}; +# $summetrix{$attribute}{$time}{sum} += $temp; +# $summetrix{$attribute}{$time}{num} += $summary{$attribute}{$nodename}{$time}{num}; +# } +# } - } +# } my $rrdcluster = "/var/rrd/cluster"; if(! -d $rrdcluster){ diff --git a/xCAT-rmc/plugin/rmcmon.pm b/xCAT-rmc/plugin/rmcmon.pm index a30ad8af5..cb02a72b8 100644 --- a/xCAT-rmc/plugin/rmcmon.pm +++ b/xCAT-rmc/plugin/rmcmon.pm @@ -1552,7 +1552,7 @@ sub showmetrix($rrddir, $attrs, $start_time, $end_time) if(! grep {/$timestamp/} @timelist){ push @timelist, $timestamp; } - $hash{$name}{$timestamp} = sprintf "%.4f", $sum/$num; + $hash{$name}{$timestamp} = sprintf "%.4f", $sum; } elsif ($line =~ /^(\d+): (\S+)/){ $timestamp = $1; $sum = $2;