🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #1566

Re: Any good monitoring scripts out there?

#1566
From: Brian Sakach
Date: Thu, 22 Oct 1992 12:09
97 lines
4130 bytes
In article <Bw6owI.4Ao@avalon.nwc.navy.mil> dejesus@archimedes.nwc.navy.mil (Francisco X DeJesus) writes:
>Hello. I run C-news on a Sun4 using nntp. I run most of the scripts that
>came with C-news under the suggested crontab format, and have found them
>to be quite good at giving me valuable information on how the system is
>performing. However, there are a couple of things I'd like to get regular
>reports on, if possible. Anyone have some good scripts that scan the
>logfiles and give stats such as how many total articles came in, how many
>in some specific groups, how many read (nntp) connections have been made,
>which sites have been accessing the news server... that kind of thing.

If you're on C News you can use an entry in the sys file to gather the
statistics you need.  Once a day, you'll roll the file over and run a
script against the previous day.  It's rather easy.  Here's the steps:

1. Add a dummyfeed entry to your sys file to capture every article's name
   and size into a file.

   stats:all/all:f:/usr/lib/news/stats

2. Modify your batchparms if you currently use the /default/ entry to batch
   all sites.  Otherwise, the batcher will trash your file.  Have an entry
   for every site but "stats".

3. Add a crontab entry to roll it over every day.

   0 8 * * * /usr/lib/newsbin/local/stats.sh

4. To get the article count per category for the previous day:

   cut -d/ -f1 stats.old | sort | uniq -c

   The output, for instance, would be:

        3748 comp
         160 control
           1 gnu
           1 ieee
          38 junk
         731 misc
          24 ncr
          85 news
           2 oh
           9 psi
        5126 rec
         705 sci
        1535 soc
         834 talk

5. And using awk, total the second field by category:
   (Assuming your `togo' file is using later format of pathnames 
   relative to $NEWSART.  Adjust sed substitution otherwise.)

   sed 's/\/.* / /' /usr/lib/news/stats.old |
   sort |
   awk -F" " '
     $1 == LastCategory { sum += $2 }
     $1 != LastCategory {
   	if ( LastCategory != "" ) printf "%8d %8s\n", sum, LastCategory
   	LastCategory = $1
   	sum = $2 } 
     END { printf "%8d %-8s\n", sum, LastCategory } '


   The output, for instance, would be:

     8441680 comp
       91843 control
        1092 gnu
         640 ieee
       90173 junk
     1629201 misc
      157881 ncr
      280540 news
        4013 oh
        4953 psi
     9701647 rec
     1780886 sci
     3355730 soc
     2387973 talk


An additional benefit in the past has been resending news to my downfeed
sites that temporarily lost their news.  They provided me with the last 
successfully transmitted Message-ID from their log file which I associated 
with an article in my old stats file.  I appended every article past that
point to their current togo file.  It was easy since they were getting an
unfiltered feed.

I also used the stats file recently to inform a downfeed site as what to
expect daily in the way of comp.sys.* and comp.os.* traffic.  I modified
the awk script to match on two fields instead of three and passed the
report to him.  He identified easy cuts in his feed and has been pleased
since.

-- 
Brian.Sakach@DaytonOH.NCR.COM               "Irrelevant!"   -Ross Perot
Technical Details
Message-ID: <1992Oct22.120936.28655@wnas.DaytonOH.NCR.COM>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.admin.misc.mbox.zip!sparky!uunet!tcsi.com!iat.holonet.net!psinntp!psinntp!ncrlnk!wnas!bsakach
References: <Bw6owI.4Ao@avalon.nwc.navy.mil>

Show Full Headers
Complete Article Headers
Message-ID: <1992Oct22.120936.28655@wnas.DaytonOH.NCR.COM>
Subject: Re: Any good monitoring scripts out there?
Date: Thu, 22 Oct 1992 12:09:36 +0000
From: bsakach@wnas.DaytonOH.NCR.COM (Brian Sakach)
References: <Bw6owI.4Ao@avalon.nwc.navy.mil>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.admin.misc.mbox.zip!sparky!uunet!tcsi.com!iat.holonet.net!psinntp!psinntp!ncrlnk!wnas!bsakach
Newsgroups: news.software.b,news.software.nntp,news.admin.misc
Reply-To: bsakach@wnas.UUCP (Brian Sakach)
Organization: NCR Corporation - Worldwide Network Appl. Services - Dayton, OH
Lines: 96