INN commit: trunk (samples/innreport.conf.in scripts/innreport_inn.pm)

INN Commit Russ_Allbery at isc.org
Sat Jul 12 18:11:34 UTC 2008


    Date: Saturday, July 12, 2008 @ 11:11:33
  Author: iulius
Revision: 7934

Bug-fixes:
* Trailing comma after %innfeed_spooled with "Outgoing feeds (innfeed) by Articles";
* Column "Total" of "Outgoing feeds (innfeed) by Volume" tries to add two hashes
  which evaluates to a constant 0;
* Gracefully handle undefined hash elements in "NNRP readership statistics (by domain)";
* Correct handling of undefined values in %innd_time_min, %innd_time_max,
  %innfeed_time_min, %innfeed_time_max, %nnrpd_time_min and %nnrpd_time_max.

Also added two error messages generated by perl-nocem.


Thanks again, Alexander Bartolich, for this patch.

Modified:
  trunk/samples/innreport.conf.in
  trunk/scripts/innreport_inn.pm

---------------------------+
 samples/innreport.conf.in |   36 ++++++++++++++---------------
 scripts/innreport_inn.pm  |   53 +++++++++++++++++++++++++++++---------------
 2 files changed, 53 insertions(+), 36 deletions(-)

Modified: samples/innreport.conf.in
===================================================================
--- samples/innreport.conf.in	2008-07-05 13:57:55 UTC (rev 7933)
+++ samples/innreport.conf.in	2008-07-12 18:11:33 UTC (rev 7934)
@@ -19,21 +19,25 @@
 	unwanted_log	"unwanted.log";   # ${logpath}/${unwanted_log}
 	text            true;
 	html            false;
-	graph           true;        # need 'html'
+	graph           true;  # need 'html'
 	archive		true;  # use false to keep only the latest HTML report.
-	index		"index.html"; # name of the HTML index file.
 
-      # Change to .xhtml to let Apache server correct MIME type.
-      # html_file_extension    ".html";
+      # Change to .xhtml to let Apache serve correct MIME type.
+	index			"index.html"; # name of the HTML index file.
+      # html_file_extension	".html";
 
       # html_dir     "/var/www/News/stats"; # default to pathhttp in inn.conf
 	img_dir         "pics";      # images will go to ${html_dir}/${img_dir}
 	cycle		none;        # use a number or 'none'.
         separator       ".";         # use a valid filename character.
 	title		"Daily Usenet report";
-      # title	        "Daily Usenet report for <A HREF=\"/News/stats/\">news.y.z</A>";
-      # footer		"Local contact: <A HREF=\"mailto:x at y.z\">x at y.z</A>";
-      # html_body	"BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"";
+      # title	        "Daily Usenet report for <a href=\"/News/stats/\">news.y.z</a>";
+      # footer		"Local contact: <a href=\"mailto:x at y.z\">x at y.z</a>";
+
+      # Attributes inside <body> tag.  Note that this is not valid XHTML.
+      # Use the CSS file below if you want valid XHTML.
+      # html_body	"bgcolor=\"#ffffff\" text=\"#000000\"";
+
       # html_header_file "header.html";  # ${html_dir}/${html_header_file}
       # html_footer_file "footer.html";  # ${html_dir}/${html_footer_file}
       # html_xhtml11_icon "http://www.w3.org/Icons/valid-xhtml11";
@@ -43,7 +47,7 @@
       # html_encoding	"ISO-8859-1";
 
       # URL to CSS file.  If undefined, a style sheet is embedded in HTML instead.
-      # html_css_url    "";
+      # html_css_url    "innreport.css";
 
       # URL to XSL file.  See <http://www.w3.org/MarkUp/2004/xhtml-faq#ie>.
       # html_xsl_url    "";
@@ -1296,7 +1300,7 @@
 		data {
 		          name    "Spooled";
 			  color   "#AF00FF";
-			  value   "%innfeed_spooled,";
+			  value   "%innfeed_spooled";
                 };
 	};
 };
@@ -1376,12 +1380,6 @@
 			color	"#FFAF00";
 			value	"%innfeed_rejected_size";
 		};
-		data {
-			name	"Total";
-			color	"#00FF00";
-			value	"%innfeed_accepted_size +
-                                 %innfeed_rejected_size";
-		};
 	};
 };
 
@@ -2145,8 +2143,8 @@
                 name          "Rej";
                 format_name   "%4s";
                 format        "%4d";
-		value         "$nnrpd_post_rej{$key} +
-                               $nnrpd_post_error{$key}";
+		value         "($nnrpd_post_rej{$key}||0) +
+                               ($nnrpd_post_error{$key}||0)";
 		total         "total(%nnrpd_post_rej) +
 		               total(%nnrpd_post_error)";
         };
@@ -2208,8 +2206,8 @@
                 name          "Rej";
                 format_name   "%4s";
                 format        "%4d";
-                value         "$nnrpd_dom_post_rej{$key} +
-	                       $nnrpd_dom_post_error{$key}";
+                value         "($nnrpd_dom_post_rej{$key}||0) +
+	                       ($nnrpd_dom_post_error{$key}||0)";
                 total         "total(%nnrpd_dom_post_rej) +
                                total(%nnrpd_dom_post_error)";
         };

Modified: scripts/innreport_inn.pm
===================================================================
--- scripts/innreport_inn.pm	2008-07-05 13:57:55 UTC (rev 7933)
+++ scripts/innreport_inn.pm	2008-07-12 18:11:33 UTC (rev 7934)
@@ -701,24 +701,24 @@
     # The exact timers change from various versions of INN, so try to deal
     # with this in a general fashion.
     if ($left =~ m/^\S+\s+                         # ME
-	           time\ (\d+)\s+                  # time
-                   ((?:\S+\ \d+\(\d+\)\s*)+)       # timer values
+                   time\s(\d+)\s+                  # time
+                   ((?:\S+\s\d+\(\d+\)\s*)+)       # timer values
                    $/ox) {
       $innd_time_times += $1;
       my $timers = $2;
 
       while ($timers =~ /(\S+) (\d+)\((\d+)\)\s*/g) {
         my $name = $timer_names{$1} || $1;
-        my $average = $2 / ($3 || 1);
         $innd_time_time{$name} += $2;
-        $innd_time_num{$name} += $3;
         if ($3) {
+	  my $average = $2 / $3;
+	  $innd_time_num{$name} += $3;
           my $min = $innd_time_min{$name};
           $innd_time_min{$name} = $average
-            if (defined($min) && $min > $average);
+            if (!defined($min) || $min > $average);
           my $max = $innd_time_max{$name};
           $innd_time_max{$name} = $average
-            if (defined($max) && $max < $average);
+            if (!defined($max) || $max < $average);
         }
       }
       return 1;
@@ -992,13 +992,17 @@
 
       while ($timers =~ /(\S+) (\d+)\((\d+)\)\s*/g) {
         my $name = $innfeed_timer_names{$1} || $1;
-        my $average = $2 / ($3 || 1);
         $innfeed_time_time{$name} += $2;
-        $innfeed_time_num{$name} += $3;
-        $innfeed_time_min{$name} = $average
-          if ($3 && $innfeed_time_min{$name} > $average);
-        $innfeed_time_max{$name} = $average
-          if ($3 && $innfeed_time_max{$name} < $average);
+	if ($3) {
+	  $innfeed_time_num{$name} += $3;
+	  my $average = $2 / $3;
+	  my $min = $innfeed_time_min{$name};
+	  $innfeed_time_min{$name} = $average
+	    if (!defined($min) || $min > $average);
+	  my $max = $innfeed_time_max{$name};
+	  $innfeed_time_max{$name} = $average
+	    if (!defined($max) || $max < $average);
+        }
       }
       return 1;
     }
@@ -1735,16 +1739,16 @@
 
       while ($timers =~ /(\S+) (\d+)\((\d+)\)\s*/g) {
         my $name = $nnrpd_timer_names{$1} || $1;
-        my $average = $2 / ($3 || 1);
         $nnrpd_time_time{$name} += $2;
-        $nnrpd_time_num{$name} += $3;
         if ($3) {
+	  my $average = $2 / $3;
+	  $nnrpd_time_num{$name} += $3;
           my $min = $nnrpd_time_min{$name};
           $nnrpd_time_min{$name} = $average
-            if (defined($min) && $min > $average);
+            if (!defined($min) || $min > $average);
           my $max = $nnrpd_time_max{$name};
           $nnrpd_time_max{$name} = $average
-            if (defined($max) && $max < $average);
+            if (!defined($max) || $max < $average);
         }
       }
       return 1;
@@ -1951,13 +1955,28 @@
       $nocem_totalids{$nocem_lastid} += $2;
       return 1;
     }
-    if ($left =~ /bad signature from (.*)/o) {
+    if ($left =~ /Article <[^>]*>: (.*) \(ID [[:xdigit:]]*\) not in keyring/o) {
       $nocem_badsigs{$1}++;
       $nocem_goodsigs{$1} = 0 unless ($nocem_goodsigs{$1});
       $nocem_totalbad++;
       $nocem_lastid = $1;
       return 1;
     }
+    if ($left =~ /Article <[^>]*>: bad signature from (.*)/o) {
+      $nocem_badsigs{$1}++;
+      $nocem_goodsigs{$1} = 0 unless ($nocem_goodsigs{$1});
+      $nocem_totalbad++;
+      $nocem_lastid = $1;
+      return 1;
+    }
+    if ($left =~ /Article <[^>]*>: malformed signature/o) {
+      $nocem_badsigs{'N/A'}++;
+      $nocem_goodsigs{'N/A'} = 0 unless ($nocem_goodsigs{'N/A'});
+      $nocem_totalbad++;
+      $nocem_lastid = 'N/A';
+      return 1;
+    }
+
     return 1;
   }
 



More information about the inn-committers mailing list