Minor changes to innreport_inn.pm and innreport.conf.in
Alexander Bartolich
alexander.bartolich at gmx.at
Wed Jun 25 00:52:02 UTC 2008
I'm currently checking the result of all eval statements in innreport.
These are some minor issues I found:
1. The expressions in innreport.conf don't check whether hash elements
exist. Initializing them with 0 in innreport_inn.pm makes life much
simpler.
2. For two sections in innreport.conf there is a mismatch between
sort function and sorted hash.
Index: scripts/innreport_inn.pm
===================================================================
--- scripts/innreport_inn.pm (revision 7920)
+++ scripts/innreport_inn.pm (working copy)
@@ -612,8 +612,7 @@
$innd_cp_seconds{$server} = $seconds;
$innd_cp_stored_size{$server} = $accptsize;
$innd_cp_duplicated_size{$server} = $dupsize;
- $innd_cp_rejected_size{$server} = $rjctsize
- if defined($rjctsize);
+ $innd_cp_rejected_size{$server} = ($rjctsize || 0);
} elsif ($status eq "closed") {
$innd_cp_accepted{$server} = 0;
$innd_cp_refused{$server} = 0;
@@ -631,8 +630,7 @@
$innd_rejected{$server} += $rejected;
$innd_stored_size{$server} += $accptsize;
$innd_duplicated_size{$server} += $dupsize;
- $innd_rejected_size{$server} += $rjctsize
- if defined($rjctsize);
+ $innd_rejected_size{$server} += ($rjctsize || 0);
}
return 1;
# closed (with times)
@@ -714,12 +712,12 @@
my $average = $2 / ($3 || 1);
$innd_time_time{$name} += $2;
$innd_time_num{$name} += $3;
- if ($3) {
+ if ($3) {
my $min = $innd_time_min{$name};
$innd_time_min{$name} = $average
if (defined($min) && $min > $average);
my $max = $innd_time_max{$name};
- $innd_time_max{$name} = $average
+ $innd_time_max{$name} = $average
if (defined($max) && $max < $average);
}
}
@@ -2172,7 +2170,7 @@
$innd_seconds{$server} += $innd_cp_seconds{$server};
$innd_stored_size{$server} += $innd_cp_stored_size{$server};
$innd_duplicated_size{$server} += $innd_cp_duplicated_size{$server};
- $innd_rejected_size{$server} += $innd_cp_rejected_size{$server};
+ $innd_rejected_size{$server} += ($innd_cp_rejected_size{$server} || 0);
}
}
@@ -2187,26 +2185,16 @@
# Sum all incoming traffic for each full server.
foreach $key (keys (%innd_connect)) {
($hostname, $channel) = split(':', $key);
- $innd_seconds_sum{$hostname} += $innd_seconds{$key}
- if defined($innd_seconds{$key});
- $innd_connect_sum{$hostname} += $innd_connect{$key}
- if defined($innd_connect{$key});
- $innd_offered_sum{$hostname} += $innd_offered{$key}
- if defined($innd_offered{$key});
- $innd_accepted_sum{$hostname} += $innd_accepted{$key}
- if defined($innd_accepted{$key});
- $innd_refused_sum{$hostname} += $innd_refused{$key}
- if defined($innd_refused{$key});
- $innd_rejected_sum{$hostname} += $innd_rejected{$key}
- if defined($innd_rejected{$key});
- $innd_stored_size_sum{$hostname} += $innd_stored_size{$key}
- if defined($innd_stored_size{$key});
- $innd_duplicated_size_sum{$hostname} += $innd_duplicated_size{$key}
- if defined($innd_duplicated_size{$key});
- $innd_offered_size_sum{$hostname} += $innd_offered_size{$key}
- if defined($innd_offered_size{$key});
- $innd_rejected_size_sum{$hostname} += $innd_rejected_size{$key}
- if defined($innd_rejected_size{$key});
+ $innd_seconds_sum{$hostname} += ($innd_seconds{$key} || 0);
+ $innd_connect_sum{$hostname} += ($innd_connect{$key} || 0);
+ $innd_offered_sum{$hostname} += ($innd_offered{$key} || 0);
+ $innd_accepted_sum{$hostname} += ($innd_accepted{$key} || 0);
+ $innd_refused_sum{$hostname} += ($innd_refused{$key} || 0);
+ $innd_rejected_sum{$hostname} += ($innd_rejected{$key} || 0);
+ $innd_stored_size_sum{$hostname} += ($innd_stored_size{$key} || 0);
+ $innd_duplicated_size_sum{$hostname} += ($innd_duplicated_size{$key} || 0);
+ $innd_offered_size_sum{$hostname} += ($innd_offered_size{$key} || 0);
+ $innd_rejected_size_sum{$hostname} += ($innd_rejected_size{$key} || 0);
}
# adjust min/max of innd timer stats.
Index: samples/innreport.conf.in
===================================================================
--- samples/innreport.conf.in (revision 7920)
+++ samples/innreport.conf.in (working copy)
@@ -1053,7 +1053,7 @@
section nocem {
title "NoCeM on Spool:";
data "%nocem_goodsigs";
- sort "$nocem_ids{$b} <=> $nocem_ids{$a}";
+ sort "$nocem_goodsigs{$b} <=> $nocem_goodsigs{$a}";
column {
name "Id";
format "%-47.47s";
@@ -2097,7 +2097,7 @@
section nnrpd_groups {
title "NNRP readership statistics:";
- data "%nnrpd_connect";
+ data "%nnrpd_articles";
sort "$nnrpd_articles{$b} <=> $nnrpd_articles{$a}";
numbering true;
column {
More information about the inn-patches
mailing list