#!/bin/sh - # # narf log summary. # # $Header: /news/lib/bin/RCS/narfsum,v 1.17 1997/11/13 23:35:58 newsadm Exp $ # tmp=/tmp/nrf$$ trap 'rm -f ${tmp}* ; exit' 0 1 2 3 15 awk ' $1 == "+" { bc = $4 ; kb = ( 500 + bc ) / 1000 if ( $2 ~ /^ 0) pcrej = (rejc*100.0)/frej printf fmt, h, fok, okb, okc, (okc*100.0)/fok, frej, rejb, rejc, pcrej, pct } for ( h in rejfrom ) { if ( okfrom[h] != "" ) continue okb = 0 ; pct = 100.0 fok = 0 ; frej = 0 + rejfrom[h] trej += frej ; rejb = (500 + drop[h])/1000 ; trejb += rejb okc = 0 + okcs[h] ; rejc = 0 + rejcs[h] csok += okc ; csrej += rejc printf fmt, h, okb, okb, okb, 0.0, frej, rejb, rejc, (rejc*100.0)/frej, pct } print "-------- ----- ------ ----- ---- ----- ------ ----- ---- ----" tot = tok + trej ; pct = trej * 100.0 / tot pcok = 0.0 ; if (tok > 0) pcok = (csok*100.0)/tok pcrej = 0.0 ; if (trej > 0) pcrej = (csrej*100.0)/trej printf fmt, " Total:", tok, tokb, csok, pcok, trej, trejb, csrej, pcrej, pct tcspam = csok + csrej print "" print " # Traffic # Percent of total" print " Type # Accepted Rejected | Total # Accepted Rejected | Total " print " ==========#-------------------+---------#-------------------+---------" printf " authentic # %6d %6d | %6d # %4.1f %4.1f | %4.1f\n", tok - csok, trej - csrej, tot - tcspam, (tok - csok)*100.0/tot, (trej - csrej)*100.0/tot, (tot-tcspam)*100.0/tot printf " cyberspam # %6d %6d | %6d # %4.1f %4.1f | %4.1f\n", csok, csrej, tcspam, (csok*100.0)/tot, (csrej*100.0)/tot, (tcspam*100.0)/tot print " ==========#-------------------+---------#-------------------+---------" printf " Total # %6d %6d | %6d # %4.1f %4.1f |\n", tok, trej, tot, (tok*100.0)/tot, (trej*100.0)/tot print "" print " Rejections " print " Count (%) KBytes (%) Reason" print " ===== ==== ====== ==== ======" for ( s in rejwhy ) printf "%6d %4.1f %7d %4.1f %s\n", rejwhy[s], rejwhy[s]*100.0/trej, (rejnum[s]+500)/1000, rejnum[s]*0.1/trejb, s >>out }' out=$tmp sort -nr $tmp