Skip to content

Commit

Permalink
innreport: Collect and report innxbatch statistics
Browse files Browse the repository at this point in the history
Add two new sections in innreport to show articles and volume usage
of innxbatch.
The information logged by innxbatch in news.notice were otherwise
reported as unknown lines.
  • Loading branch information
Julien-Elie committed Nov 22, 2021
1 parent f9e5251 commit b319dd3
Show file tree
Hide file tree
Showing 5 changed files with 220 additions and 8 deletions.
17 changes: 13 additions & 4 deletions backends/innxbatch.c
Expand Up @@ -76,6 +76,9 @@ static unsigned long STATaccepted;
static unsigned long STAToffered;
static unsigned long STATrefused;
static unsigned long STATrejected;
static double STATacceptedsize;
static double STATrejectedsize;


/*
** Prototypes.
Expand Down Expand Up @@ -131,14 +134,18 @@ ExitWithStats(int x)
}

if (STATprint) {
printf("%s stats offered %lu accepted %lu refused %lu rejected %lu\n",
REMhost, STAToffered, STATaccepted, STATrefused, STATrejected);
printf("%s stats offered %lu accepted %lu refused %lu rejected %lu "
"accsize %.0f rejsize %.0f\n",
REMhost, STAToffered, STATaccepted, STATrefused, STATrejected,
STATacceptedsize, STATrejectedsize);
printf("%s times user %.3f system %.3f elapsed %.3f\n", REMhost,
usertime, systime, STATend - STATbegin);
}

notice("%s stats offered %lu accepted %lu refused %lu rejected %lu",
REMhost, STAToffered, STATaccepted, STATrefused, STATrejected);
notice("%s stats offered %lu accepted %lu refused %lu rejected %lu "
"accsize %.0f rejsize %.0f",
REMhost, STAToffered, STATaccepted, STATrefused, STATrejected,
STATacceptedsize, STATrejectedsize);
notice("%s times user %.3f system %.3f elapsed %.3f", REMhost, usertime,
systime, STATend - STATbegin);

Expand Down Expand Up @@ -271,11 +278,13 @@ REMsendxbatch(int fd, char *buf, int size)
case NNTP_FAIL_ACTION:
notice("%s xbatch failed %s", REMhost, buf);
STATrejected++;
STATrejectedsize += (double) size;
return false;
/* NOTREACHED */
break;
case NNTP_OK_XBATCH:
STATaccepted++;
STATacceptedsize += (double) size;
if (Debug)
fprintf(stderr, "will unlink(%s)\n", XBATCHname);
if (unlink(XBATCHname)) {
Expand Down
4 changes: 2 additions & 2 deletions doc/pod/innreport.pod
Expand Up @@ -19,8 +19,8 @@ HTML output and graphs. It is normally invoked by scanlogs(8) which includes
the output of B<innreport> in daily Usenet reports.

Supported programs are B<batcher>, B<cnfsstat>, B<controlchan>, B<innd>,
B<innfeed>, B<innxmit>, B<nnrpd>, B<nntplink> (an external program),
B<overchan>, B<perl-nocem> and B<rnews>.
B<innfeed>, B<innxbatch>, B<innxmit>, B<nnrpd>, B<nntplink> (an external
program), B<overchan>, B<perl-nocem> and B<rnews>.

B<innreport> also updates the count of newsgroups not locally carried
by the news server, and for which articles have been received, in the
Expand Down
5 changes: 5 additions & 0 deletions doc/pod/news.pod
Expand Up @@ -78,6 +78,11 @@ thus receiving each time the same error in response codes).

=item *

B<innreport> now collects statistics from B<innxbatch> and generates a
section for them in its reports.

=item *

B<rc.news>, used to start and stop INN daemons, now checks whether it is
run as the news user. It will exit if not the case, to ensure not to
tamper with the ownership of files INN manipulates.
Expand Down
164 changes: 162 additions & 2 deletions samples/innreport.conf.in
Expand Up @@ -75,10 +75,13 @@ section index {
title "Outgoing feeds";
name "Offered|Accepted|Volume";
value "total(%innfeed_offered) + total(%nntplink_offered) +
total(%innxmit_offered) | total(%innfeed_accepted) +
total(%nntplink_accepted) + total(%innxmit_accepted) |
total(%innxbatch_offered) + total(%innxmit_offered) |
total(%innfeed_accepted) + total(%nntplink_accepted) +
total(%innxbatch_accepted) + total(%innxmit_accepted) |
bytes(total(%innfeed_accepted_size) +
total(%innfeed_rejected_size) +
total(%innxbatch_accepted_size) +
total(%innxbatch_rejected_size) +
total(%innxmit_accepted_size) +
total(%innxmit_rejected_size))";
};
Expand Down Expand Up @@ -1606,6 +1609,163 @@ section nntplink_connect2 {
};
};

section innxbatch_connect {
title "Outgoing Feeds (innxbatch) by Articles:";
data "%innxbatch_offered";
sort "$innxbatch_accepted{$b} <=> $innxbatch_accepted{$a}";
numbering true;
column {
name "Server";
format "%-33.33s";
value "$key";
format_total "TOTAL: %-26.26s";
total "$num";
};
column {
name "Offered";
format_name "%7s";
format "%7d";
value "$innxbatch_offered{$key}";
total "total(%innxbatch_offered)";
};
column {
name "Taken";
format_name "%7s";
format "%7d";
value "$innxbatch_accepted{$key}";
total "total(%innxbatch_accepted)";
};
column {
name "Refused";
format_name "%7s";
format "%7d";
value "$innxbatch_refused{$key}";
total "total(%innxbatch_refused)";
};
column {
name "Reject";
format_name "%7s";
format "%7d";
value "$innxbatch_rejected{$key}";
total "total(%innxbatch_rejected)";
};
column {
name "%Acc";
format_name "%4s";
format "%3d%%";
value "$innxbatch_offered{$key} == 0 ? 0 :
$innxbatch_accepted{$key} /
$innxbatch_offered{$key} * 100";
total "total(%innxbatch_offered) == 0 ? 0 :
total(%innxbatch_accepted) /
total(%innxbatch_offered) * 100";
};
column {
name "Elapsed";
format "%8s";
value "time($innxbatch_times{$key})";
total "time(total(%innxbatch_times))";
};
graph {
title "Outgoing Feeds (innxbatch)";
type histo3d;
sort "%innxbatch_accepted";
data {
name "Art. accepted";
color "#0000FF";
value "%innxbatch_accepted";
};
data {
name "Art. refused";
color "#FFAF00";
value "%innxbatch_refused";
};
data {
name "Art. rejected";
color "#FF0000";
value "%innxbatch_rejected";
};
};
};

section innxbatch_volume {
title "Outgoing Feeds (innxbatch) by Volume:";
data "%innxbatch_offered";
sort "$innxbatch_accepted_size{$b} <=> $innxbatch_accepted_size{$a}";
numbering true;
column {
name "Server";
format "%-17.17s";
value "$key";
format_total "TOTAL: %-10.10s";
total "$num";
};
column {
name "AcceptVol";
format "%9s";
value "bytes($innxbatch_accepted_size{$key})";
total "bytes(total(%innxbatch_accepted_size))";
};
column {
name "RejectVol";
format "%9s";
value "bytes($innxbatch_rejected_size{$key})";
total "bytes(total(%innxbatch_rejected_size))";
};
column {
name "TotalVol";
format "%9s";
value "bytes($innxbatch_accepted_size{$key} +
$innxbatch_rejected_size{$key})";
total "bytes(total(%innxbatch_accepted_size) +
total(%innxbatch_rejected_size))";
};
column {
name "Volume/sec";
format_name "%11s";
format "%9s/s";
value "bytes(($innxbatch_accepted_size{$key} +
$innxbatch_rejected_size{$key}) /
$innxbatch_times{$key} / 1024)";
total "bytes((total(%innxbatch_accepted_size) +
total(%innxbatch_rejected_size)) /
total(%innxbatch_times) / 1024)";
};
column {
name "Vol/Art";
format "%9s";
value "bytes(($innxbatch_accepted_size{$key} +
$innxbatch_rejected_size{$key}) /
($innxbatch_accepted{$key} +
$innxbatch_rejected{$key}))";
total "bytes((total(%innxbatch_accepted_size) +
total(%innxbatch_rejected_size)) /
(total(%innxbatch_accepted) +
total(%innxbatch_rejected)))";
};
column {
name "Elapsed";
format "%9s";
value "time($innxbatch_times{$key})";
total "time(total(%innxbatch_times))";
};
graph {
title "Outgoing Feeds (innxbatch)";
type histo3d;
sort "%innxbatch_accepted_size";
data {
name "Articles accepted";
color "#0000FF";
value "%innxbatch_accepted_size";
};
data {
name "Articles rejected";
color "#FFAF00";
value "%innxbatch_rejected_size";
};
};
};

section innxmit_connect {
title "Outgoing Feeds (innxmit) by Articles:";
data "%innxmit_times";
Expand Down
38 changes: 38 additions & 0 deletions scripts/innreport_inn.pm
Expand Up @@ -173,6 +173,14 @@ our %inn_uw_dist_s;
our %inn_uw_ng;
our %inn_uw_ng_s;
our %inn_uw_site;
our %innxbatch_accepted;
our %innxbatch_accepted_size;
our %innxbatch_offered;
our %innxbatch_refused;
our %innxbatch_rejected;
our %innxbatch_rejected_size;
our %innxbatch_site;
our %innxbatch_times;
our %innxmit_accepted;
our %innxmit_accepted_size;
our %innxmit_afail_host;
Expand Down Expand Up @@ -865,6 +873,8 @@ sub collect($$$$$$) {
return 1 if $left =~ /CNFS(?:-sm)?: CNFSflushallheads: flushing /o;
# CNFS: metacycbuff rollover with SEQUENTIAL
return 1 if $left =~ /CNFS(?:-sm)?: metacycbuff \S+ cycbuff is moved to /o;
# From XBATCH
return 1 if $left =~ /\S+:\d+ accepted batch size \d+/o;
# Cleanfeed status reports
return 1 if $left =~ /^filter: status/o;
return 1 if $left =~ /^filter: Reloading bad files/o;
Expand Down Expand Up @@ -1070,6 +1080,34 @@ sub collect($$$$$$) {
# Finally, to avoid problems with strange error lines, ignore them.
#return 1 if ($left =~ /ME /);
}

#########
## innxbatch
if ($prog eq "innxbatch") {
# stats
if ($left =~
/(\S+) stats offered (\d+) accepted (\d+) refused (\d+) rejected (\d+) accsize (\d+) rejsize (\d+)$/o) {
my ($server, $offered, $accepted, $refused, $rejected, $accbytes, $rejbytes) =
($1, $2, $3, $4, $5, $6, $7);
$server = lc $server unless $CASE_SENSITIVE;
$innxbatch_offered{$server} += $offered;
$innxbatch_accepted{$server} += $accepted;
$innxbatch_refused{$server} += $refused;
$innxbatch_rejected{$server} += $rejected;
$innxbatch_accepted_size{$server} += $accbytes;
$innxbatch_rejected_size{$server} += $rejbytes;
$innxbatch_site{$server}++;
return 1;
}
# times
if ($left =~ /(\S+) times user (.+) system (\S+) elapsed (\S+)$/o) {
my ($server, $user, $system, $elapsed) = ($1, $2, $3, $4);
$server = lc $server unless $CASE_SENSITIVE;
$innxbatch_times{$server} += $elapsed;
return 1;
}
}

########
## innxmit
if ($prog eq "innxmit") {
Expand Down

0 comments on commit b319dd3

Please sign in to comment.