Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 5/3/83; site whuxlb.UUCP
Path: utzoo!linus!wivax!decvax!harpo!floyd!whuxlb!mkg
From: mkg@whuxlb.UUCP
Newsgroups: net.news
Subject: Program for news feed statistics - (nf)
Message-ID: <1179@whuxlb.UUCP>
Date: Mon, 20-Jun-83 00:36:44 EDT
Article-I.D.: whuxlb.1179
Posted: Mon Jun 20 00:36:44 1983
Date-Received: Mon, 20-Jun-83 09:15:03 EDT
Sender: mkg@whuxlb.UUCP
Organization: Bell Labs, Whippany
Lines: 76

#N:whuxlb:7700006:000:1836
whuxlb!mkg    Jun 20 00:36:00 1983

Here is a nifty program that can be used to check on the reliability
of your netnews feeds.  It will tell you who got you articles first
and who didn't get you some articles.  

For example, whuxlb's latest stats are:
804 articles
         floyd:    429 first,     46 missing
    gummo.UUCP:    375 first,    110 missing

I originally posted this program for 2.9 news but since the format
of the log file changed in 2.10, here is an updated version of
that program.  Oh yes, our ncut program works like cut(1) but gives
you the fields in the order you ask for them (rather than in ascending
order).  If your cut can't do this, you'll have to swap the fields around
with sed.
   Marsh Gosnell  BTL Whippany  (201) 386-7095  whuxlb!mkg


egrep "received|Duplicate" /usr/lib/news/log* | \
	sed -e 's/	/ /g' -e 's/article //'  | \
	ncut -f6,5,4 -d' ' | \
	sort -u | \
	awk '
BEGIN { nsystems = 0; narticles = 0; got_received = 0 }

$1 != last {
	if (got_received == 1) {
		for (i = 1; i <= nsystems; i++) {
			if (received[i] == "received")
				first[i]++;
			else if (received[i] != "Duplicate")
				missing[i]++;
		}
		narticles++;
	}
	for (i = 1; i <= nsystems; i++)
		received[i] = "";
	got_received = 0;
	last = $1;
}

$1 == last {
	for (i = 1; i <= nsystems; i++)
		if (system[i] == $3)
			break;
	if (i > nsystems) {
		nsystems++;
		first[nsystems] = 0;
		missing[nsystems] = narticles;
		system[nsystems] = $3;
	}

	received[i] = $2;

	if ($2 == "received")
		got_received = 1;
}

END {
	if (got_received == 1) {
		for (i = 1; i <= nsystems; i++) {
			if (received[i] == "received")
				first[i]++;
			else if (received[i] != "Duplicate")
				missing[i]++;
		}
		narticles++;
	}
	print narticles " articles";
	for (i = 1; i <= nsystems; i++) 
		printf "%15s %6d first, %6d missing\n", system[i]":", first[i], missing[i];
      }' -