🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
1 messages
1 total messages Started by Andy Clews Fri, 15 Mar 1996 00:00
Monitoring news quantity - SUMMARY
#5687
Author: Andy Clews
Date: Fri, 15 Mar 1996 00:00
95 lines
3570 bytes
A short time ago I posted a request for advice/info on how to set up
monitoring of quantities of incoming news articles.

The following suggestion, from Tod Pike (tgp@sei.cmu.edu) - to whom many
thanks - and summarised here with his permission, worked just fine for me.
I've added a few observations of my own.

First you need to add an entry like the following to your 'newsfeeds' file:

================================ CUT HERE ============================
TALLY!\
        :*\
        :Tf,Wnb:/usr/spool/news/lib/tally
================================ CUT HERE ============================

(remember to "ctlinnd reload newsfeeds 'new newsfeeds'" afterwards)
The file /usr/spool/news/lib/tally will contain an entry for each article
received, together with its size in bytes. It grows quite quickly!

The following shell script, by Mark Moraes, can be used to analyse the
'tally' data file. You could set up a crontab job to run it, but you'll
need to take care to zeroise the tally file after each run. My crontab job
pauses the server before running the script, so that the file is inactive
during the run, and go's the server again afterwards.

================================ CUT HERE ============================
#! /bin/sh
# Analyses the output of tally to produce total volume by hierarchy.
# -0 produces the analysis by group, -1 goes one level down into the
# hierarchies, -2 goes 2 levels down, -3 goes three levels down.
# -r rounds to the next highest kilobyte rather than using exact byte counts.
# Mark Moraes, University of Toronto
spool=/usr/spool/news
prefix=
#prefix="$spool/"	# for B News and old C news systems.
sedcmd="s,\([^/]*\).*/[0-9]*,\1,"
roundit=0
while :
do
	case "$1" in
	-r)	roundit=1023; shift;;
	-1)	shift;;
	-0)	sedcmd="s,\(.*\)/[0-9]*,\1,"; shift;;
	-2)	sedcmd="s,\([^/]*/[^/]*\).*/[0-9]*,\1,
			s,\([^/]*\).*/[0-9][0-9]*,\1,"; shift;;
	-3)	sedcmd="s,\([^/]*/[^/]*/[^/]*\).*/[0-9]*,\1,
			s,\([^/]*/[^/]*\).*/[0-9][0-9]*,\1,
			s,\([^/]*\).*/[0-9][0-9]*,\1,"; shift;;
	*)	break;;
	esac
done
sed "$sedcmd" $@ |
	tr / . |
	awk 'BEGIN {
		roundit = '"$roundit"';
	}
	{
		hc[$1]++;
		nc++;
		x = ($2 + roundit) / 1024;
		h[$1] += x;
		n += x;
	}
	END {
		print "cat << \\EOF";
		printf "%40.40s %8s %8s %8s %8s\n\n", "Hierarchy", "Kbytes", "# arts.", "Kb/art", "Percent"
		printf "%40.40s %8d %8d %8.3f %8.2f \n\n", "Total", n, nc, n / nc, 100;
		print "EOF"
		print "sort -nr +1 << \\EOF"
		for (i in h)
			printf "%40.40s %8d %8d %8.3f %8.2f\n", i, h[i], hc[i], h[i]/hc[i], (h[i]/n)*100;
		print "EOF"
	}' |
	sh
exit	
case "$1" in
-0)	cat <<- EOF
	s,\(.*\)/$end,\1,
	EOF
	shift;;
-1)	shift;;
-2)	cat << - EOF
	s,pat='[^/]*/[^[/]*'; shift;;
-3)	pat='[^/]*/[^[/]*/[^[/]*'; shift;;
-4)	pat='[^/]*/[^[/]*/[^[/]*/[^[/]*'; shift;;
esac
================================ CUT HERE ============================


-- 
Andy Clews, Computing Service, University of Sussex, Brighton BN1 9QJ,  UK
			Email:   A.Clews@sussex.ac.uk


Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads