dcox@ssd.kodak.com (Don Cox (253-7121)) (12/06/90)
machinetype: Sun4/260, SunOS4.0.3 Cnews running nntp Is there any way that I can have nntpd alert me to the fact that another machine is accessing news from my news server? I can do a ps aux | grep nntp, but that just gives me a "snapshot". I would like to somehow have this done continually (or whenever I desire). Thanks. -- Don Cox Phone (716) 253-7121 KMX (716) 253-7998 INTERNET dcox@ssd.kodak.com When an eel bites your leg, and the pain makes you beg, that's a moray!
kaul@icarus.eng.ohio-state.edu (Rich Kaul) (12/06/90)
In article <1990Dec5.182742.18081@ssd.kodak.com> dcox@ssd.kodak.com (Don Cox (253-7121)) writes: Is there any way that I can have nntpd alert me to the fact that another machine is accessing news from my news server? Recompile nntp with LOG defined in common/conf.h. I prefer to use the FAKESYSLOG option to send the nntp output to its own file. I then use the following perl script to reduce the information in the file and print a report on the machines connecting, the number of connections, the amount of CPU, system and wall time consumed by the connections, the machines refused connections and what groups were read. This makes it easier to determine which groups get fast expire times ... A comment on the perl style: there is none. What do you want from a quick hack while I was just beginning to learn perl? At least it runs well enough ;-) #!/usr/bin/perl # # A perl script to summarize nntp usage for our news host. # The report generated lists the number of connections and times of # the news reading sessions, rejected connections and groups. # # Author: Rich Kaul # Date: Nov. 2, 1990 $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\tSummary of News Usage for $date\n"; print "\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}; } print "\n\t\t\tRefused Connections\n"; foreach $key (sort(keys refused)) { printf "%27s %5d\n", $key, $refused{$key}; } print"\n\t\t\tGroups Read\n"; print "\t\t Group name\t Conn.\n"; foreach $key (sort(keys group_count)) { printf "%27s\t%5d\n", $key, $group_count{$key}; } -- Rich Kaul | It wouldn't be research if we kaul@icarus.eng.ohio-state.edu | knew what we were doing.