home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3.4.17 [SPARC, PA-RISC] / nextstep33_risc.iso / private / etc / uucp / UUAIDS / uucpsummary.monthly < prev    next >
Text File  |  1995-02-05  |  3KB  |  131 lines

  1. cat <<'E_O_F' >/tmp/$$a
  2. BEGIN {
  3.     printf("\n\t\t\t\tUUCP Traffic Summary\n\n")
  4.     printf("\t\t\t\tFor the previous 30 days\n\n")
  5.     printf("\t       Calls     Minutes      Files          Bytes      Effective Unused\n")
  6.     printf("Site          To/From    To/From     To/From      Sent/Received  Baudrate Bwidth\n")
  7. E_O_F
  8. awk '$1 !~ /#/ && $1 !~ /xxx/{print $1,$3}' /etc/uucp/L.sys | sort -u |
  9. sed 's/\(.*\) \(.*\)/    type["\1"] = "\2"/' >>/tmp/$$a
  10. cat <<'E_O_F' >>/tmp/$$a
  11. }
  12. {
  13.         how = type[$1]
  14.         tcallsto[how] += $2
  15.         tcallsfrom[how] += $3
  16.         tminto[how] += $4
  17.         tminfrom[how] += $5
  18.         tfilesto[how] += $6
  19.         tfilesfrom[how] += $7
  20.         tbytesto[how] += $8
  21.         tbytesfrom[how] += $9
  22.         tbaudrate[how] += $10
  23.         tpercent[how] += $11
  24.         tfailed[how] += $12
  25.         tretry[how] += $13
  26.         tn[how]++
  27. }
  28. name == $1 {
  29.     callsto += $2
  30.     callsfrom += $3
  31.     minto += $4
  32.     minfrom += $5
  33.     filesto += $6
  34.     filesfrom += $7
  35.     bytesto += $8
  36.     bytesfrom += $9
  37.     baudrate += $10
  38.     percent += $11
  39.     failed += $12
  40.     retry += $13
  41.     n++
  42. }
  43. name != $1 {
  44.     if (NR > 1) {
  45.         s = name
  46.         if (failed > 0) {
  47.             s = s "[" failed
  48.             if (retry > 0)
  49.                 s = s "/" retry "]"
  50.             else
  51.                 s = s "]"
  52.         } else {
  53.             if (retry > 0)
  54.                 s = s "[/" retry "]"
  55.         }
  56.         printf("%-12s %4d/%-4d %5d/%-5d %5d/%-5d %9d/%-9d %6d %5d%%\n", \
  57.         s, callsto, callsfrom, minto, minfrom, filesto, \
  58.         filesfrom, bytesto, bytesfrom, baudrate/n, percent/n)
  59.     }
  60.  
  61.     callsto = $2
  62.     callsfrom = $3
  63.     minto = $4
  64.     minfrom = $5
  65.     filesto = $6
  66.     filesfrom = $7
  67.     bytesto = $8
  68.     bytesfrom = $9
  69.     baudrate = $10
  70.     percent = $11
  71.     failed = $12
  72.     retry = $13
  73.     n = 1
  74.     name = $1
  75. }
  76. END {
  77.     printf("%-12s %4d/%-4d %5d/%-5d %5d/%-5d %9d/%-9d %6d %5d%%\n", \
  78.         name, callsto, callsfrom, minto, minfrom, filesto, \
  79.         filesfrom, bytesto, bytesfrom, baudrate/n, percent/n)
  80.     printf("------------ ----/---- -----/----- -----/----- ---------/--------- ------  -----\n")
  81.     for (i in tn) {
  82.  
  83.         s = i
  84.         if (tfailed[i] > 0) {
  85.             s = s "[" tfailed[i]
  86.             if (tretry[i] > 0)
  87.                 s = s "/" tretry[i] "]"
  88.             else 
  89.                 s = s "]"
  90.         } else {
  91.             if (tretry[i] > 0)
  92.                 s = s "[/" tretry[i] "]"
  93.         }
  94.         printf("%-12s %4d/%-4d %5d/%-5d %5d/%-5d %10d/%-10d %6d %3d%%\n", \
  95.         s, tcallsto[i], tcallsfrom[i], tminto[i], tminfrom[i], \
  96.         tfilesto[i], tfilesfrom[i], tbytesto[i], tbytesfrom[i], \
  97.         tbaudrate[i]/tn[i], tpercent[i]/tn[i])
  98.         totcallsto += tcallsto[i]
  99.         totcallsfrom += tcallsfrom[i]
  100.         totminto += tminto[i]
  101.         totminfrom += tminfrom[i]
  102.         totfilesto += tfilesto[i]
  103.         totfilesfrom += tfilesfrom[i]
  104.         totbytesto += tbytesto[i]
  105.         totbytesfrom += tbytesfrom[i]
  106.         totbaudrate += tbaudrate[i]
  107.         totpercent += tpercent[i]
  108.         totfailed += tfailed[i]
  109.         totretry += tretry[i]
  110.         totn += tn[i]
  111.     }
  112.     printf("%-12s %4d/%-4d %5d/%-5d %5d/%-5d %10d/%-10d %6d %3d%%\n", \
  113.         "Total", totcallsto, totcallsfrom, totminto, \
  114.         totminfrom, totfilesto, totfilesfrom, totbytesto, \
  115.         totbytesfrom ,  totbaudrate/totn,  totpercen/totn)
  116. }
  117. E_O_F
  118. for i in `grep -l 'UUCP Summary' /usr/msgs/*`
  119. do
  120. sed '1,/^Site/d
  121. /^[ ]*$/,$d
  122. s;\[/;[0/;
  123. s;\[\([0-9]*\)\];[\1/0];
  124. /\[/s;\([^\[]*\)\[\(.*\)/\(.*\)\]\(.*\);\1 \4 \2 \3;
  125. s!/! !g
  126. s/  */ /g
  127. s/%//
  128. ' $i
  129. done | sort | awk -f /tmp/$$a
  130. rm -f /tmp/$$*
  131.