chiark / gitweb /
Cope with NNTP_STRLEN abolishment (replaced with NNTP_MAXLEN_COMMAND)
[innduct.git] / innduct-stats-report
index 391dac1b3806764b910ec1b71c54220bbb2065c2..ebcae748b3fe9843ed198120adc2693e6df1ad1a 100755 (executable)
@@ -10,13 +10,17 @@ our %counts;
 # Input lines look like this:
 # May 23 19:00:02 chiark innduct[23236]: news.relativity.greenend.org.uk| info: completed feedfile read=76 (+bl=7,+err=0) missing=0 offered=76 (ch=76,nc=0) accepted=75 (ch=75,nc=0) unwanted=1 (id=1,bod=0,nc=0) rejected=0 (id=0,bod=0,nc=0) deferred=0 (id=0,bod=0,nc=0) missing=0 (id=0,bod=0,nc=0) connretry=0 (id=0,bod=0,nc=0)
 
+if (@ARGV && $ARGV[0] =~ m/^\-/) {
+    die "$0: bad usage: no options supported\n";
+}
+
 while (<>) {
     next unless
        m/^ [:0-9A-Za-z ]+[ ]
            \w+[ ]
            innduct\[\d+\]:[ ]
            ([^|<>: \t]+)\|[ ]
-           info:[ ]
+           (?: info | notice ):[ ]
            (?: completed | processed )[ ]
            .*?
            ( (?: [ ]
@@ -60,9 +64,11 @@ while (<>) {
 
 our $cwr;
 our $site;
+our $processed;
 
 foreach $site (sort keys %counts) {
     $cwr= $counts{$site};
+    $processed= $cwr->{offered} - $cwr->{deferred};
     write;
 }
 
@@ -81,14 +87,15 @@ sub amt ($) {
 }
 
 format STDOUT_TOP =
-offrd acctd unwtd rejtd ac% rj% nochk nc% 
+offrd defer acctd unwtd rejtd df% ac% rj% nochk nc% 
 .
 format STDOUT =
-@>>>> @>>>> @>>>> @>>>> ^## ^## @>>>> ^## @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<...
-{ (map { amt($cwr->{$_}) } qw(offered accepted unwanted rejected)),
-  (map { pct($cwr->{$_}, $cwr->{offered}) } qw(accepted rejected)),
+@>>>> @>>>> @>>>> @>>>> @>>>> ^## ^## ^## @>>>> ^## @<<<<<<<<<<<<<<<<<<<<<<<...
+{ (map { amt($cwr->{$_}) } qw(offered deferred accepted unwanted rejected)),
+  (pct($cwr->{deferred}, $cwr->{offered})),
+  (map { pct($cwr->{$_}, $processed) } qw(accepted rejected)),
   ($cwr->{offered_nc} ? (amt($cwr->{offered_nc}),
-                        pct($cwr->{offered_nc}, $cwr->{offered}))
+                        pct($cwr->{offered_nc}, $processed))
                       : ('',undef)),
   ($site)
   }