Rejectsize diffs

Dan Merillat harik at chaos.ao.net
Fri Aug 11 10:04:58 UTC 2000


Ok, this appears to work properly, the sizes have been consistant for a few days
now.

It's got a few things before it should go into the main tree...
first, the FIXME in art.c.  I opted for minimal changes rather
then a 'correct' patch, so it's likely to break if someone decides
to send text to ARTlog for a stored article.

Second is innreport.  I can't for the life of me massage the fields
to line up in text.  bytes() is supposed to return a string, right?
so why won't a 7 byte string line up properly in a 10 byte format
specifier?

Third is probably not as important, but patching the perl filter to
log reject sizes to syslog, so innreport can calculate bytes rejected
based on different filters.

--Dan


Index: innd/art.c
===================================================================
RCS file: /home/cvs/inn/innd/art.c,v
retrieving revision 1.147
diff -u -r1.147 art.c
--- innd/art.c	2000/07/30 02:45:55	1.147
+++ innd/art.c	2000/08/09 07:38:17
@@ -850,7 +850,7 @@
 	(void)sprintf(buff, "Line %d includes null character", i);
 	return buff;
     }
-    Article->Used = out - Article->Data;
+	 Data->SizeValue = Article->Used = out - Article->Data;
     Data->LinesValue = (i - 1 < 0) ? 0 : (i - 1);
     
     if (innconf->linecountfuzz) {
@@ -939,13 +939,20 @@
     /* We could be a bit faster by not dividing Now.usec by 1000,
      * but who really wants to log at the Microsec level? */
     Done = code == ART_ACCEPT || code == ART_JUNK;
-    if (text)
-	i = fprintf(Log, "%.15s.%03d %c %s %s %s%s",
-		ctime(&Now.time) + 4, (int)(Now.usec / 1000),
-		code, Data->Feedsite,
-		Data->MessageID == NULL ? "(null)" : Data->MessageID,
-		text, Done ? "" : "\n");
-    else
+    if (text) { /* FIXME: assumes that only rejects have text */
+	if (Done)
+	    i = fprintf(Log, "%.15s.%03d %c %s %s %s",
+		    ctime(&Now.time) + 4, (int)(Now.usec / 1000),
+		    code, Data->Feedsite,
+		    Data->MessageID == NULL ? "(null)" : Data->MessageID,
+		    text);
+	else
+	    i = fprintf(Log, "%.15s.%03d %c %s %s %s *%ld*\n",
+		    ctime(&Now.time) + 4, (int)(Now.usec / 1000),
+		    code, Data->Feedsite,
+		    Data->MessageID == NULL ? "(null)" : Data->MessageID,
+		    text, Data->SizeValue);
+    } else
 	i = fprintf(Log, "%.15s.%03d %c %s %s%s",
 		ctime(&Now.time) + 4, (int)(Now.usec / 1000),
 		code, Data->Feedsite,
@@ -1943,6 +1950,7 @@
 #endif	/* defined(DO_KEYWORDS) */
     }
 }
+
 
 
 /*
Index: samples/innreport.conf.in
===================================================================
RCS file: /home/cvs/inn/samples/innreport.conf.in,v
retrieving revision 1.17
diff -u -r1.17 innreport.conf.in
--- samples/innreport.conf.in	1999/10/24 22:13:38	1.17
+++ samples/innreport.conf.in	2000/08/11 09:55:08
@@ -460,6 +460,61 @@
 	};
 };
 
+section innd_artsizes {
+        title   "Incoming Feed Sizes (INN):";
+	data    "%innd_seconds";
+	sort    "$innd_accepted{$b} <=> $innd_accepted{$a}";
+	numbering true;
+        column {
+                name          "Server";
+		format_name   "%-21.21s";
+		format        "%-21.21s";
+		value         "$key";
+		format_total  "TOTAL: %-17.17s";
+		total         "$num";
+        };
+	column {
+		name          "Offered";
+		format        "%10s";
+		value         "bytes($innd_offered_size{$key})";
+		total         "bytes(total(%innd_offered_size))";
+	};
+	column {
+		name          "Accepted";
+		fomat         "%10s";
+		value         "bytes($innd_accepted_size{$key})";
+		total         "bytes(total(%innd_accepted_size))";
+	};
+        column {
+                name          "Rejected";
+		format        "%10s";
+		value         "bytes($innd_rejected_size{$key})";
+		total         "bytes(total(%innd_rejected_size))";
+        };
+	column {
+		name          "%Acc";
+		format_name   "%5s";
+		format        "%4d%%";
+		value         "$innd_offered_size{$key} == 0 ? 0 : $innd_accepted_size{$key} / $innd_offered_size{$key} * 100";
+		total         "total(%innd_offered_size) == 0 ? 0 : total(%innd_accepted_size) / total(%innd_offered_size) * 100";
+	};
+	graph {
+	        title         "Bytes received by server";
+		type          histo3d;
+		sort	      "%innd_accepted";
+		data {
+		          name    "Bytes accepted";
+			  color   "#0000FF";
+			  value   "%innd_accepted_size";
+                };
+		data {
+		          name    "Articles rejected";
+			  color   "#FF0000";
+			  value   "%innd_rejected_size";
+                };
+	};
+};
+
 section inn_flow {
         title   "Incoming articles:";
 	data    "%inn_flow";
Index: scripts/innreport_inn.pm
===================================================================
RCS file: /home/cvs/inn/scripts/innreport_inn.pm,v
retrieving revision 1.5
diff -u -r1.5 innreport_inn.pm
--- scripts/innreport_inn.pm	2000/05/24 21:58:53	1.5
+++ scripts/innreport_inn.pm	2000/08/09 03:41:35
@@ -68,28 +68,39 @@
       # or
       # server <msg-id> (filename) size [feeds]
 
-      my ($s) = $left =~ /^\S+ \S+ (?:\(\S+\) )?(\d+)(?: |$)/o;
+      $left =~ /^(\S+) \S+ (?:\(\S+\) )?(\d+)(?: |$)/o;
+      my ($s)=$2;
+      $server=$1;
       if ($s) {
 	$inn_flow_size{"$day $hour"} += $s;
+	$innd_accepted_size{$server} += $s;
 	$inn_flow_size_total += $s;
       }
       return 1;
     }
+    if ($left =~ /^(\S+) .*\*(\d+)\*(?: |$)/o) {
+	my ($server, $s) = ( $1 , $2 );
+	if ($s) {
+	    $innd_rejected_size{$server} += $s;
+	   }
+    }
 
     # 437 Duplicate article
-    if ($left =~ /(\S+) <[^>]+> 437 Duplicate(?: article)?$/o) {
+    if ($left =~ /(\S+) <[^>]+> 437 Duplicate(?: article)?/o) {
       my $server = $1;
       $server = lc $server unless $CASE_SENSITIVE;
       $inn_badart{$server}++;
       $inn_duplicate{$server}++;
+      $inn_duplicate_size{$server}+=$s;
       return 1;
     }
     # 437 Unapproved for
-    if ($left =~ /(\S+) <[^>]+> 437 Unapproved for \"([^\"]+)\"$/o) {
+    if ($left =~ /(\S+) <[^>]+> 437 Unapproved for \"([^\"]+)\"/o) {
       my ($server, $group) = ($1, $2);
       $server = lc $server unless $CASE_SENSITIVE;
       $inn_badart{$server}++;
       $inn_unapproved{$server}++;
+      $inn_unapproved_size{$server}++;
       $inn_unapproved_g{$group}++;
       return 1;
     }
@@ -102,7 +113,7 @@
       return 1;
     }
     # 437 Unwanted site ... in path
-    if ($left =~ /(\S+) <[^>]+> 437 Unwanted site (\S+) in path$/o) {
+    if ($left =~ /(\S+) <[^>]+> 437 Unwanted site (\S+) in path/o) {
       my ($server, $site) = ($1, $2);
       $server = lc $server unless $CASE_SENSITIVE;
       $inn_badart{$server}++;
@@ -111,7 +122,7 @@
       return 1;
     }
     # 437 Unwanted newsgroup "..."
-    if ($left =~ /(\S+) <[^>]+> 437 Unwanted newsgroup \"(\S+)\"$/o) {
+    if ($left =~ /(\S+) <[^>]+> 437 Unwanted newsgroup \"(\S+)\"/o) {
       my ($server, $group) = ($1, $2);
       ($group) = split(/,/, $group);
       $server = lc $server unless $CASE_SENSITIVE;
@@ -121,7 +132,7 @@
       return 1;
     }
     # 437 Unwanted distribution "..."
-    if ($left =~ /(\S+) <[^>]+> 437 Unwanted distribution \"(\S+)\"$/o) {
+    if ($left =~ /(\S+) <[^>]+> 437 Unwanted distribution \"(\S+)\"/o) {
       my ($server, $dist) = ($1, $2);
       $server = lc $server unless $CASE_SENSITIVE;
       $inn_badart{$server}++;
@@ -1889,6 +1900,8 @@
       $innd_offered{$key} = ($innd_accepted{$key} || 0)
 	+ ($innd_refused{$key} || 0)
 	+ ($innd_rejected{$key} || 0);
+      $innd_offered_size{$key} = ($innd_accepted_size{$key} || 0)
+	+ ($innd_rejected_size{$key} || 0);
     }
 
 



More information about the inn-workers mailing list