Thread View: news.software.nntp
3 messages
3 total messages
Started by Erik Schorr
Wed, 02 Feb 2000 00:00
need source a/o algorithm for freenix 'inpaths' path stats program, for use with DIABLO
Author: Erik Schorr
Date: Wed, 02 Feb 2000 00:00
Date: Wed, 02 Feb 2000 00:00
45 lines
2890 bytes
2890 bytes
I've seen and tried the conventional 'inpaths' program floating around, which essentially goes through the news spool files article-by-article and extracts Path: headers, and compiles the data into statistics for the freenix top1000 list... problem is, it's not compatible with diablo's setup (multiple articles per file, no file/group hierarchy, binary header info in spool files) What I'd like to do, is write a program that listens on a local socket (ie port 1019/tcp, bound only to the localhost address), for diablo to send a header-only feed to. This program will keep tallies on Path: elements, as the article headers are fed into it, instead of having to read through existing spool files occasionally. This should save a LOT of disk usage. Unfortunately, I'm missing the algorithm that the original inpaths program used to tally up the path elements. Someone told me the value of each element is weighted, depending on its position in the Path: header, so I can't just increment a value of an associative array using the path element as the key. The old (1980's/early 90's) inpaths.c source is convoluted to the point where the way it weights by position in the path line isn't apparent. In addition, the program doesn't compile cleanly without modifications. The two 'inpaths' like programs that come with diablo source only "egrep" through the spool files and extract the Path: headers. they DO NOT actually compile the path statistics in any form that freenix's stats system uses. I suppose it would help as well if I could see the exact file that inpaths produces, which the freenix stats (pathsurvey@...) requires for input, as an example of what my program should generate. If you have something like this already, something I can use to extract path stats via diablo, or examples of what freenix expects, drop me an email at the address below ps. news peering requests are welcome. I'd love to swap non-binaries with just about anyone, pref UK, CA, or AU. Thanks, Erik Schorr erik-news(at)arpa.org Communications World Network -- Posted via nooz.net - is this thing working? --
Re: need source a/o algorithm for freenix 'inpaths' path stats program, for use with DIABLO
Author: William H
Date: Wed, 02 Feb 2000 00:00
Date: Wed, 02 Feb 2000 00:00
189 lines
5615 bytes
5615 bytes
In article <38982884$1@news.cwnet.com>, "Erik Schorr" says...
> What I'd like to do, is write a program that listens on a local socket
> (ie port 1019/tcp, bound only to the localhost address), for diablo to
> send a header-only feed to. This program will keep tallies on Path:
> elements, as the article headers are fed into it, instead of having to
> read through existing spool files occasionally. This should save a LOT
> of disk usage. Unfortunately, I'm missing the algorithm that the original
> inpaths program used to tally up the path elements. Someone told me the
> value of each element is weighted, depending on its position in the Path:
> header, so I can't just increment a value of an associative array using
> the path element as the key. The old (1980's/early 90's) inpaths.c source
> is convoluted to the point where the way it weights by position in the
> path line isn't apparent. In addition, the program doesn't compile
> cleanly without modifications.
I have a set of programs that works sort of like that. It has two parts:
The first part runs out of inetd and accepts a header feed from diablo,
storing the paths in gzipped files. I run it on the 5 minute queue
schedule on another lightly loaded box so that it doesn't affect the news
server's performance. The second part runs once monthly, piping the
previously stored files into the standard inpaths program. You will have
to set the server name values to settings appropriate for your server.
#!/usr/bin/perl
# Receive a diablo header feed on stdin and parse out the Path: headers
# for later processing by inpaths. For use as a daemon run out of inetd.
#
# v0.1 1999/10/17 William Herrin herrin@crosslink.net
setpriority PRIO_PROCESS, $$, 20;
$| = 1;
$now = time();
$pathdir = "/home/herrin/src/usenet/paths";
$localpath = "nntp.newsfirst.net";
open PATH, "|/bin/gzip --stdout - >>$pathdir/$now.$$.gz";
print STDOUT "200 shade.corp.crosslink.net News server InPathFeed 0.1
ready\r\n";
while ($line = <STDIN>) {
$line =~ s/[\r\n]//g;
$command = $line;
$command =~ s/ .*$//;
lc $command;
$line =~ s/^[^ ]* //;
if ($command eq "takethis") {
article($line);
print "239 article transferred ok $line\r\n";
next;
}
if ($command eq "check") {
print "238 no such article found, please send it to me $line\r\n";
next;
}
if (($command eq "mode")&&($line eq "headfeed")) {
print "250 Mode Command OK.\r\n";
next;
}
if (($command eq "mode")&&($line eq "stream")) {
print "203 StreamOK.\r\n";
next;
}
if ($command eq "quit") {
print "205 See ya later.\r\n";
close HEADERS;
exit 0;
}
print "500 Syntax Error: $command\r\n";
}
close HEADERS;
exit 0;
sub article {
my ($msgid) = @_;
my $line;
while ($line = <STDIN>) {
$line =~ s/[\r\n]//g;
return if $line eq ".";
$header = $line;
$header =~ s/ .*$//;
lc $header;
$line =~ s/^[^ ]* //;
if ($header eq "Path:") {
$line =~ s/$localpath!//;
print PATH "$line\n";
}
}
}
The second part is a simple shell script:
#!/bin/sh
DIR="${1}"
if [ "${DIR}" = "" ] ;then
DIR="paths"
fi
nice -20 zcat ${DIR}/* | sed '
s/^/Path: shade.corp.crosslink.net!nntp.newsfirst.net!/
' | nice -20 inpaths/inpaths -p shade.corp.crosslink.net \
> inpaths.${DIR}
And, since I'm posting happy fun usenet scripts, here's a short hack that
compiles an eight month Freenix history:
#!/usr/bin/perl
@files = ( "199912-top1000.txt", "199911-top1000.txt",
"199910-top1000.txt",
"199909-top1000.txt", "199908-top1000.txt", "199907-top1000.txt",
"199906-top1000.txt", "199905-top1000.txt");
$fn = $files[0];
open F, "<$fn";
$count = 1;
$line=<F>;
$line=<F>;
@servers = ();
%ranks = ();
while ($line = <F>) {
chop $line;
$line =~ s/ */ /g;
$line =~ s/^ //;
($rank, $percent, $server) = split / /, $line;
$servers[$count] = sprintf "%-31s%5d", $server, $rank;
$ranks{"$server"} = $count;
$count ++;
}
close F;
for ($count=1; $count<=$#files; $count++) {
@month=();
open F, "<$files[$count]";
while ($line = <F>) {
chop $line;
$line =~ s/ */ /g;
$line =~ s/^ //;
($rank, $percent, $server) = split / /, $line;
$whichone = $ranks{$server};
$month[$whichone] = sprintf "%5d", $rank if $whichone;
}
close F;
for ($i=1; $i<=$#servers; $i++) {
if ($month[$i]) {
$servers[$i] .= " " . $month[$i];
} else {
$servers[$i] .= " -";
}
}
}
print "Server 1999 Dec Nov Oct Sep Aug Jul
Jun May\n";
print "------------------------------+-----------------------------------
------------\n";
for ($i=1; $i<=$#servers; $i++) {
print "$servers[$i]\n";
}
-Bill Herrin
Re: need source a/o algorithm for freenix 'inpaths' path stats program, for use with DIABLO
Author: William Herrin
Date: Thu, 03 Feb 2000 00:00
Date: Thu, 03 Feb 2000 00:00
25 lines
1798 bytes
1798 bytes
In article <3898c85f$1@news.cwnet.com>, "Erik Schorr" says... > It's this version of inpaths that I'm looking for, which takes the -p > argument. (I'm assuming to tell it to expect path headers on STDIN) > None of the inpath versions i've found take the -p option. > Everything else you've described is very similar to what I already have > going here, so GETTING the data isn't the problem. I'm stuck at getting > the program that actually generates the stats from the Path: headers. > I'm mainly interested in the version of inpaths that supports the -p > option, or getting the algorithm to write an inpaths-clone myself. The one I'm using is from: http://www.freenix.org/reseau/top1000/inpaths-noll.tar.gz which is available off the http://www.freenix.org/top1000/ page. -Bill -- William D. Herrin CrossLink Internet Services Director of Network Operations 5537 C Hempstead Way, herrin@crosslink.net Springfield, VA 22151 http://www.crosslink.net/ (703) 642-1120
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