From 5da0ff19d44a5bb036edfcef595a14657db49664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toralf=20F=C3=B6rster?= Date: Thu, 11 Jul 2024 22:08:59 +0200 Subject: [PATCH] sum is not needed in the histogram --- metrics.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/metrics.sh b/metrics.sh index faa600f..3b66303 100755 --- a/metrics.sh +++ b/metrics.sh @@ -26,18 +26,15 @@ function _histogram() { BEGIN { @arr = (0) x 24; # 0-23 hour $inf = 0; # anything above - $sum = 0; } { - chomp(); - my $hour = int(($F[2]-1)/3600); - if ($hour <= 23) { - $arr[$hour]++; + my $hour = int( ($F[2] - 1) / 3600); + if ($hour <= 23) { + $arr[$hour]++ } else { $inf++; } - $sum += $hour; } END { @@ -49,7 +46,6 @@ function _histogram() { my $count = $N + $inf; print "'${var}'_bucket{ipver=\"'${v:-4}'\",nickname=\"'$nickname'\",mode=\"'$mode'\",le=\"+Inf\"} $count\n"; print "'${var}'_count{ipver=\"'${v:-4}'\",nickname=\"'$nickname'\",mode=\"'$mode'\"} $count\n"; - print "'${var}'_sum{ipver=\"'${v:-4}'\",nickname=\"'$nickname'\",mode=\"'$mode'\"} $sum\n"; }' }