[news.software.nntp] Diffs to nntp_awk script to support nntplink output

stealth@caen.engin.umich.edu (Mike Pelletier) (08/16/90)

The following is a context diff for the "nntp_awk" script (which reads
through the nntp logging output to generate a statistics report) to make
it handle the nntplink logging output, specifically, the offer and
accept per minute statistic, such as:

"sol.ctr.columbia.edu xfer offer/min 2.36 accept/min 2.22"

If it sees any of these lines in the input stream, it will assume that
nntplink is being used exclusively for outgoing articles, and will
change the table to show Average offer and accepts per minute for each
host, rather than the connect time, CPU time, and percentage.
If you have a combination of nntpxfer and nntplink connections, the
script will work, but the numbers won't quite be right.

Respectfully submitted,

--
Michael V. Pelletier            | "We live our lives with our hands on the
 CAEN UseNet News Administrator |  rear-view mirror, striving to get a better
 Systems Group Programmer       |  view of the road behind us.  Imagine what's
                                |  possible if we look ahead and steer..."
------------------>8 cut here >8----------------------------------------------
*** nntp_awk.old	Fri Jul 20 17:04:56 1990
--- nntp_awk	Tue Aug 14 13:56:03 1990
***************
*** 30,35 ****
--- 30,39 ----
  # Fixed bug in explorers couting - November 7, 1989
  # Stan Barber <sob@bcm.tmc.edu>
  #
+ # Added facilities to deal with an all-nntplink host - Aug 13, 1990
+ # Mike Pelletier <stealth@caen.engin.umich.edu>
+ #
+ 
  BEGIN{
  	readers = 0;
  	transmit = 0;
***************
*** 129,134 ****
--- 133,145 ----
  	xmt_failed[host] += $14;
  	next;
  }
+ # The following is for NNTPlink statistics - stealth@caen.engin.umich.edu
+ $8 == "offer/min" {
+ 	nntplink = 1;
+ 	xmt_offmin[host] += $9
+ 	xmt_accmin[host] += $11
+ 	next;
+ }
  #
  #	For the Nth time, I wish awk had two dimensional associative
  #	arrays. I assume that the last request is the same as all the
***************
*** 291,324 ****
  ###############################################################################
  	if (transmit) {
  		printf("Article Transmission (we contact them)\n");
! 		printf("System                    Offrd  Took  Toss  Fail  Pct   Elapsed       CPU  Pct\n");
  		for(s in xmt) {
  			we_offered = xmt[s];
  			if (we_offered == 0) we_offered = 1;
  			they_toss = (xmt_refuse[s] / we_offered) * 100 + 0.5;
  
! 			e_hours = xmt_ela[s] / 3600;
! 			e_sec   = xmt_ela[s] % 3600;
! 			e_min   = e_sec / 60;
! 			e_sec   %= 60;
  
! 			c_hours = xmt_cpu[s] / 3600;
! 			c_sec   = xmt_cpu[s] % 3600;
! 			c_min   = c_sec / 60;
! 			c_sec   %= 60;
  
! 			elapsed = xmt_ela[s];
! 			if (elapsed == 0) elapsed = 1;
! 			pct = ((xmt_cpu[s] / elapsed) * 100.0 + 0.5);
  
! 			printf("%-25s %5d %5d %5d %5d %3d%% %3d:%02d:%02d %3d:%02d:%02d %3d%%\n", s, xmt[s], xmt_accept[s], xmt_refuse[s], xmt_failed[s], they_toss, e_hours, e_min, e_sec, c_hours, c_min, c_sec, pct);
  
  			nxmt        += xmt[s];
  			nxmt_accept += xmt_accept[s];
  			nxmt_refuse += xmt_refuse[s];
  			nxmt_failed += xmt_failed[s];
- 			nxmt_ela    += xmt_ela[s];
- 			nxmt_cpu    += xmt_cpu[s];
  		}
  
  		we_offered = nxmt;
--- 302,352 ----
  ###############################################################################
  	if (transmit) {
  		printf("Article Transmission (we contact them)\n");
! 		if (nntplink) {
! 			printf("                                                          Average     Average\n");
! 			printf("System                    Offrd  Took  Toss  Fail  Pct   offer/min   accept/min\n");
! 		} else {
! 			printf("System                    Offrd  Took  Toss  Fail  Pct   Elapsed       CPU  Pct\n");
! 		}
  		for(s in xmt) {
  			we_offered = xmt[s];
  			if (we_offered == 0) we_offered = 1;
  			they_toss = (xmt_refuse[s] / we_offered) * 100 + 0.5;
  
! 			if (nntplink) {
! 				avg_offmin = xmt_offmin[s] / conn[s];
! 				avg_accmin = xmt_accmin[s] / conn[s];
  
! 				printf("%-25s %5d %5d %5d %5d %3d%% %9.2f %11.2f\n", s, xmt[s], xmt_accept[s], xmt_refuse[s], xmt_failed[s], they_toss, avg_offmin, avg_accmin);
  
! 				conn_tot    += conn[s];
! 				nxmt_offmin += xmt_offmin[s];
! 				nxmt_accmin += xmt_accmin[s];
! 			} else {
! 				e_hours = xmt_ela[s] / 3600;
! 				e_sec   = xmt_ela[s] % 3600;
! 				e_min   = e_sec / 60;
! 				e_sec   %= 60;
  
! 				c_hours = xmt_cpu[s] / 3600;
! 				c_sec   = xmt_cpu[s] % 3600;
! 				c_min   = c_sec / 60;
! 				c_sec   %= 60;
  
+ 				elapsed = xmt_ela[s];
+ 				if (elapsed == 0) elapsed = 1;
+ 				pct = ((xmt_cpu[s] / elapsed) * 100.0 + 0.5);
+ 
+ 				printf("%-25s %5d %5d %5d %5d %3d%% %3d:%02d:%02d %3d:%02d:%02d %3d%%\n", s, xmt[s], xmt_accept[s], xmt_refuse[s], xmt_failed[s], they_toss, e_hours, e_min, e_sec, c_hours, c_min, c_sec, pct);
+ 
+ 				nxmt_ela    += xmt_ela[s];
+ 				nxmt_cpu    += xmt_cpu[s];
+ 			}
+ 
  			nxmt        += xmt[s];
  			nxmt_accept += xmt_accept[s];
  			nxmt_refuse += xmt_refuse[s];
  			nxmt_failed += xmt_failed[s];
  		}
  
  		we_offered = nxmt;
***************
*** 325,344 ****
  		if (we_offered == 0) we_offered = 1;
  		they_toss = (nxmt_refuse / we_offered) * 100 + 0.5;
  
! 		e_hours = nxmt_ela / 3600;
! 		e_sec   = nxmt_ela % 3600;
! 		e_min   = e_sec / 60;
! 		e_sec   %= 60;
  
! 		c_hours = nxmt_cpu / 3600;
! 		c_sec   = nxmt_cpu % 3600;
! 		c_min   = c_sec / 60;
! 		c_sec   %= 60;
  
! 		if (nxmt_ela == 0) nxmt_ela = 1;
! 		pct = ((nxmt_cpu / nxmt_ela) * 100.0 + 0.5);
! 
! 		printf("\n%-25s %5d %5d %5d %5d %3d%% %3d:%02d:%02d %3d:%02d:%02d %3d%%\n\n", "TOTALS", nxmt, nxmt_accept, nxmt_refuse, nxmt_failed, they_toss, e_hours, e_min, e_sec, c_hours, c_min, c_sec, pct);
  
  		printf("Transmission Connection Attempts         ------errors-------\n");
  		printf("System                     Conn    OK    NS   Net   Rmt  Pct\n");
--- 353,378 ----
  		if (we_offered == 0) we_offered = 1;
  		they_toss = (nxmt_refuse / we_offered) * 100 + 0.5;
  
! 		if (nntplink) {
! 			overavg_offmin = nxmt_offmin / conn_tot;
! 			overavg_accmin = nxmt_accmin / conn_tot;
! 				printf("\n%-25s %5d %5d %5d %5d %3d%% %9.2f %11.2f\n\n", "TOTALS", nxmt, nxmt_accept, nxmt_refuse, nxmt_failed, they_toss, overavg_offmin, overavg_accmin);
! 		} else {
! 			e_hours = nxmt_ela / 3600;
! 			e_sec   = nxmt_ela % 3600;
! 			e_min   = e_sec / 60;
! 			e_sec   %= 60;
! 	
! 			c_hours = nxmt_cpu / 3600;
! 			c_sec   = nxmt_cpu % 3600;
! 			c_min   = c_sec / 60;
! 			c_sec   %= 60;
  
! 			if (nxmt_ela == 0) nxmt_ela = 1;
! 			pct = ((nxmt_cpu / nxmt_ela) * 100.0 + 0.5);
  
! 			printf("\n%-25s %5d %5d %5d %5d %3d%% %3d:%02d:%02d %3d:%02d:%02d %3d%%\n\n", "TOTALS", nxmt, nxmt_accept, nxmt_refuse, nxmt_failed, they_toss, e_hours, e_min, e_sec, c_hours, c_min, c_sec, pct);
! 		}
  
  		printf("Transmission Connection Attempts         ------errors-------\n");
  		printf("System                     Conn    OK    NS   Net   Rmt  Pct\n");
--
Michael V. Pelletier            | "We live our lives with our hands on the
 CAEN UseNet News Administrator |  rear-view mirror, striving to get a better
 Systems Group Programmer       |  view of the road behind us.  Imagine what's
                                |  possible if we look ahead and steer..."