uusub for HDB uucp
Jonathan Bayer
jbayer at ispi.UUCP
Tue Nov 22 01:18:21 AEST 1988
In article <219 at mrklund.UUCP>, gary at mrklund.UUCP (Gary W. Marklund ) writes:
>
> I called SCO about this and they said it was under development.
> They put me on a list to receive it when it is available. They also
> said the 2.2.3 version would work in the meantime(?).
SCO told me that it was unavailable. They did not say that the 2.2.3 version
will work. However, I have received a message from John Gayman which I
reproduced below which will do most of what I want.
Jonathan Bayer
Intelligent Software Products, Inc.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>From uunet!wa3wbu!john Mon Nov 21 04:14:33 1988
Received: from wa3wbu.UUCP by uunet.UU.NET (5.59/1.14) with UUCP
id AA21751; Sun, 20 Nov 88 14:52:02 EST
Received: by wa3wbu.UUCP (smail2.5)
id AA06057; 20 Nov 88 09:28:01 EST (Sun)
To: ispi.UUCP!jbayer
Subject: Re: uusub for HDB uucp
In-Reply-To: your article <269 at ispi.UUCP>
News-Path: uunet!ispi!jbayer
Message-Id: <8811200928.AA06057 at wa3wbu.UUCP>
Date: 20 Nov 88 09:28:01 EST (Sun)
From: uunet!wa3wbu!john (John Gayman)
I use the following scripts to generate a weekly totals report of data
sent to each system I communicate with. It could just as easily be run
more often for the same information. I have created a script called
"statlog". It has the following contents:
awk -f /usr/local/syslog_awk /usr/spool/uucp/.Admin/xferstats
It looks at the xferstats file of HDB and runs it against the syslog_awk
file. The syslog_awk looks like this:
# USAGE: awk -f syslog_awk /usr/spool/uucp/SYSLOG
# An awk script for printing a pretty report of UUCP activities from the
# UUCP SYSLOG - Erik E. Fair October 2, 1984
#
# v7 UUCP
$4 == "received" {
sysname[$2] = $2;
by_rec[$2] += $6;
sec_rec[$2] += $8;
sys_xf[$2] ++;
}
#
# 4.2 BSD UUCP
$5 == "received" {
sysname[$2] = $2;
by_rec[$2] += $7;
sec_rec[$2] += $9;
sys_xf[$2] ++;
}
#
# System V UUCP
$6 == "<-" {
$1 = substr($1, 1, (index($1, "!") - 1));
sysname[$1] = $1;
by_rec[$1] += $7;
sec_rec[$1] += $9;
sys_xf[$1] ++;
}
#
# v7 UUCP
$4 == "sent" {
sysname[$2] = $2;
by_xmt[$2] += $6;
sec_xmt[$2] += $8;
sys_xf[$2] ++;
}
#
# 4.2 BSD UUCP
$5 == "sent" {
sysname[$2] = $2;
by_xmt[$2] += $7;
sec_xmt[$2] += $9;
sys_xf[$2] ++;
}
#
# System V UUCP
$6 == "->" {
$1 = substr($1, 1, (index($1, "!") - 1));
sysname[$1] = $1;
by_xmt[$1] += $7;
sec_xmt[$1] += $9;
sys_xf[$1] ++;
}
END {
#
# print a report header
printf("System Xfers Bytes rec Bytes xmt Connect Avg Xf Avg rec Avg xmt\n")
for(i in sysname) {
#
# sort report by most connect time (selection sort)
first = 0;
for(j in sysname) {
if (sys_xf[j] > 0) {
tmp1 = sec_xmt[j];
tmp2 = sec_rec[j];
# Stupid AWK bug - needs a simple expression
time = (tmp1 + tmp2);
if (time > first) {
first = time;
sys = sysname[j];
}
}
}
#
# 4.2 BSD awk seems to have problems. This check should not be necessary.
# Oddly enough, this problem also shows up in System V. WHY???
if (sys_xf[sys] != 0) {
#
# time for some bean counting
tmp1 = sec_xmt[sys];
tmp2 = sec_rec[sys];
# Stupid AWK bug - needs a simple expression
time = (tmp1 + tmp2);
hours = time / 3600;
sec = time % 3600;
min = sec / 60;
sec %= 60;
tot_xf += sys_xf[sys];
tot_by_rec += by_rec[sys];
tot_by_xmt += by_xmt[sys];
tot_time += time;
#
# protect myself against mathematical crime (divide by zero)
if (sec_rec[sys] == 0)
sec_rec[sys] = 1;
if (sec_xmt[sys] == 0)
sec_xmt[sys] = 1;
#
# print a pretty system report (god what an awful printf format...)
printf("%-8s%8d%11d%11d%4d:%.2d:%.2d%8d%9d%9d\n", \
sysname[sys], sys_xf[sys], by_rec[sys], by_xmt[sys], hours, min, sec, \
((by_rec[sys] + by_xmt[sys]) / sys_xf[sys]), \
(by_rec[sys] / sec_rec[sys]), \
(by_xmt[sys] / sec_xmt[sys]));
#
# make certain we will not see this system again... (selection sort)
sys_xf[sys] = 0;
}
}
#
# calculate time split for total time (and print totals [*shudder*])
hours = tot_time / 3600;
sec = tot_time % 3600;
min = sec / 60;
sec %= 60;
printf("\n%-8s%8d%11d%11d%4d:%.2d:%.2d\n", \
"TOTALS", tot_xf, tot_by_rec, tot_by_xmt, hours, min, sec);
}
--------------end------------------end------------------end----------------
This works very well for me and I hope you find it useful.
John
---
John Gayman, WA3WBU | UUCP: uunet!wa3wbu!john
1869 Valley Rd. | ARPA: john at wa3wbu.uu.net
Marysville, PA 17053 | Packet: WA3WBU @ AK3P
More information about the Comp.unix.wizards
mailing list