[news.software.nntp] NNTP news monitor

jbeckley@qualcomm.com (Gumby) (02/22/91)

I'm looking for a program that monitors news usage via NNTP.  I've seen
the program arbitron, but that only takes a snapshot on one machine.
The news system we have set up is highly distributed over 30 clients, each
using NNTP to connect to the server.  My question then is, does anyone
know of any programs that can trace news usage by monitoring NNTP?  It would
most likely be in a patch to inews.

Any help would be appreciated.

-- 
----------------------------------------------------------------------------
EMail: jbeckley@lajolla.eng.uci.edu  VoiceMail: (619) 292-1156
       jbeckley@wizard.qualcomm.com             (714) 856-1654
       jbeckley@drzeus.qualcomm.com             (619) 587-1121

skunz@iastate.edu (Kunz Steven L) (02/22/91)

In <1991Feb22.063725.26321@qualcomm.com> jbeckley@qualcomm.com (Gumby) writes:

>I'm looking for a program that monitors news usage via NNTP.  I've seen
>the program arbitron, but that only takes a snapshot on one machine.
>The news system we have set up is highly distributed over 30 clients, each
>using NNTP to connect to the server.  My question then is, does anyone
>know of any programs that can trace news usage by monitoring NNTP?  It would
>most likely be in a patch to inews.

The program you want is already distributed with nntp.  Look in the "support"
subdirectory for the "nntp_awk" file.  Use this by putting a line in your
"newsdaily" script as follows:

	# note: assumption made you are cd'd to directory with nntplog and
        #       nnto_awk script in it.
	rm -f nntplog.o
	mv nntplog nntplog.o && >nntplog
	awk -f nntp_awk nntplog.o | mail <your mail-id>

Note that you must have built nntp with logging on (look in the config files)
so that a file like "nntplog" is actually kept.  The above  will mail you the 
daily report you want.

Steve Kunz --   Usenet News Administrator
		Iowa State University Computation Center
		Ames, IA
		skunz@iastate.edu

kaul@icarus.eng.ohio-state.edu (Rich Kaul) (02/22/91)

In article <1991Feb22.063725.26321@qualcomm.com> jbeckley@qualcomm.com (Gumby) writes:
   I'm looking for a program that monitors news usage via NNTP.

If you compiled your nntpd with the LOG option you can do it.  For
example, I have NNTP logging directed to its own file, which I then
run the perl script at the end of this posting on.  Doing this daily,
I get reports mailed to me daily which look like:

			Summary of News Usage for Fri Feb 22 06:06:08 EST 1991

				Time By Machine
	       Machine Name	 Conn.	     User	  System	   Wall
                      akela         8       34.18          42.18       19269.36
	[list of many other machines and times deleted]
-------------------------------------------------------------------------------
      total (without feeds)       110      344.90         358.48       87456.86
                      total       298      673.20         887.74      171513.72

				Refused Connections

					Groups Read
			       Group name	 Conn.
                             alt.activism	    5
                              alt.aquaria	    1
	[list of groups deleted]

The perl script to do this is pretty simple.  I know it's not pretty
and not very efficient, but it still runs in well under a minute on my
Sun 3/160 so I have little incentive to fix it.  Perl is available for
anonymous ftp from tut.cis.ohio-state.edu, jpl-devvax.jpl.nasa.gov and
anonymous uucp from osu-cis.

-rich

#!/usr/bin/perl
#
# A perl script to summarize nntp usage for our reading hosts
# (our feeds, are handled differently in this summary).
# The report generated lists the number of connections and times of
# the news reading sessions.
#
# Author:	Rich Kaul (kaul@icarus.eng.ohio-state.edu)
# Date:		Nov. 2, 1990
# Modified:	Jan. 13, 1991   - Cleaned up the format for very long
#				group names and broke out feeder stats.

# NNTP feed sites.  Change here.  Two given as an example.
$FEEDA="foobaz.edu";
$FEEDB="foobar.edu";

$date=`date`;
($program = $0) =~ s%.*/%%;

if ($#ARGV < 0) {
  die "usage: $program [[nntplogfile]...]\n";
}

while (<>) {
  chop;		# avoid \n on last field
  @tmp=split;

  $host=$tmp[5];
  if ( $tmp[6] eq "times" ) {
    $machine_usrtime{$tmp[5]} += $tmp[8];
    $machine_systime{$tmp[5]} += $tmp[10];
    $machine_etime{$tmp[5]} += $tmp[12];
  } elsif ( $tmp[6] eq "connect" ) {
    $machine_connect{$tmp[5]} += 1;
  } elsif ( $tmp[6] eq "group" ) {
    $group_count{$tmp[7]} += 1;
  } elsif ( $tmp[6] eq "refused" ) {
    $refused{$tmp[5]} += 1;
  }
}

print "\n\t\t\tSummary of News Usage for $date\n";

print "\t\t\t\tTime By Machine\n";
print "\t       Machine Name\t Conn.\t     User\t  System\t   Wall\n";
foreach $key (sort(keys machine_usrtime)) {
  printf "%27s     %5d  %10.2f %14.2f %14.2f\n", $key, $machine_connect{$key},
    $machine_usrtime{$key}, $machine_systime{$key}, $machine_etime{$key};
  $total_connect += $machine_connect{$key};
  $total_usrtime += $machine_usrtime{$key};
  $total_systime += $machine_systime{$key};
  $total_etime += $machine_etime{$key};
}
print"-------------------------------------------------------------------------------\n";

# Adjust this line based on the number of feeds you have
printf "%27s     %5d  %10.2f %14.2f %14.2f\n", "total (without feeds)", 
  $total_connect-$machine_connect{$FEEDA}-$machine_connect{$FEEDB},
  $total_usrtime-$machine_usrtime{$FEEDA}-$machine_usrtime{$FEEDB},
  $total_systime-$machine_systime{$FEEDA}-$machine_systime{$FEEDB},
  $total_etime-$machine_etime{$FEEDA}-$machine_etime{$FEEDB};
printf "%27s     %5d  %10.2f %14.2f %14.2f\n", total, $total_connect, 
  $total_usrtime, $total_systime, $total_etime;

print "\n\t\t\t\tRefused Connections\n";
foreach $key (sort(keys refused)) {
  printf "%27s     %5d\n", $key, $refused{$key};
}

print"\n\t\t\t\t\tGroups Read\n";
print "\t\t\t       Group name\t Conn.\n";
foreach $key (sort(keys group_count)) {
  printf "%41s\t%5d\n", $key, $group_count{$key};
}