From:	CSBVAX::MRGATE!info-vax-request@kl.sri.com@SMTP 24-FEB-1988 15:42
To:	ARISIA::EVERHART
Subj:	DEC RBMS / LAN-100 / Summary program


Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Fri 19 Feb 88 09:39:29-PST
Received: by ucbvax.Berkeley.EDU (5.58/1.26)
	id AA21655; Fri, 19 Feb 88 08:48:03 PST
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 19 Feb 88 15:42:49 GMT
From: dogie!vms3.macc.wisc.edu!dorl@csd1.milw.wisc.edu  (Michael (NMI) Dorl)
Organization: UW-Madison Academic Computer Center
Subject: DEC RBMS / LAN-100 / Summary program
Message-Id: <37@dogie.edu>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

I recently needed something to summarize the output from the RBMS
program.  Here is the result.

Does anyone else have any similar tools to make RBMS more usefull?

dorl@vms.macc.wsic.edu
dorl@wiscmacc.bitnet

**** LOGIN.COM
$ Set Command Summary				! define summary command
$ RBMS :== $NMS_RBMS$BCP			! define rbms command
**** SUMMARY.COM
$RBMS
use active bridges
show known lines counters to "line.stats"
$Summary
**** SUMMARY.CLD
Define Verb Summary
Image "Dsk$user3:[Comm_Fac.RBMS]Summary.Exe"
Qualifier All
Qualifier Record
Qualifier History
**** SUMMARY.FOR
C Program Summary
C
C Command Syntax
C
C   Summary[/All][/[No[Record]]
C
C   Default is /Record
C
C Description
C
C   Program to grunge through the LINE.STATS file created by
C   the following RBMS commands:
C
C     USE ACTIVE BRIDGES
C     SHOW KNOWN LINES COUNTERS TO "LINE.STATS"
C
C   Produces a report summarizing LAN Bridge 100 traffic and 
C   errors.  Information printed includes the following for each 
C   interface on the LAN-100.
C
C     Receive		Frames received
C     F/S		Frames received per second
C     % Filtered	% of received frames not forwarded
C     % Bad		% frames received bad
C   
C   A single letter is printed after the % Bad column if any
C   of the following conditions are present:
C
C     L			Life time exceeded
C     P			Invalid protocol
C     C			Collision SQE error
C     F			No forwarding entry
C     E			% Bad > 0.05
C
C   If the /ALL qualifier is present, the report includes
C   the total counts from the LAN 100, otherwise the report
C   includes counts from the LAN-100 minus counts from the
C   HISTORY.STATS file.
C
C   HISTORY.STATS is updated unless the /NORECORD qualifier 
C   is specified.
C
C Author
C
C   Michael Dorl
C   MACC
C   University of Wisconsin
C   1210 W. Dayton St.
C   Madison, WI 53706
C   dorl@vms.macc.wisc.edu
C   dorl@wiscmacc.bitnet
C
C Revision History
C
C   10 Feb 1987 Original 
C

	Implicit None

C External definitions

	Integer CLI$Present

	External CLI$_Negated

C Structure definitions

	Structure /Bridge_Def/
	 Union
	  Map
	    Character	*20	Name
	    Integer	*4	Seconds(2)
	    Integer	*4	Invalid_Protocol(2)
	    Integer	*4	Filtered_Frames(2)
	    Integer	*4	Bad_Frames(2)
	    Integer	*4	Life_Time_Exceeded(2)
	    Integer	*4	No_Forwarding(2)
	    Integer	*4	Forwarding_Transitions(2)
	    Integer	*4	Collision_SQE_Error(2)
	    Integer	*4      Frames_Transmitted(2)
	    Integer	*4	Frames_Received(2)
	    Integer	*4	Bridge_Received(2)
	    Integer	*4	Bridge_Transmitted(2)
	    Integer	*4      Frames_Transmitted_Lost(2)
	    Integer	*4	Frames_Received_Lost(2)
	  EndMap
	  Map
	    Character   *132	All
	  EndMap
	 EndUnion
	End Structure ! Bridge_Def

C Local variables

	Record	/Bridge_Def/ 	Bridge(100), H_Bridge

        Integer		*4	I
	Character	*132	Image
	Integer		*4	Line
	Character	*1	Line_Err(2)
	Real		*4	PC_Bad_Frames(2)
	Real		*4	PC_Filtered(2)
        Integer		*4	PPS_Received(2)
	Logical			Qual_All
	Logical			Qual_Record
	Integer		*4	Status
	Integer		*4	X
        Integer		*4	Z

C Begin Summary

C Get command line and parse

	If (CLI$Present('RECORD') .ne. %Loc(CLI$_Negated)) Then
          Qual_Record = .true.
	Else
	  Qual_Record = .false.
	EndIf

	If (CLI$Present('ALL')) Then
	  Qual_All = .true.
	Else
	  Qual_All = .false.
	EndIf

C Open file LINE.STATS

	Open 
     $	  (Unit =		10,
     $	   File = 		'LINE.STATS',
     $	   Status = 		'OLD'
     $	  )

C Open History file

	Open 
     $    (Unit =		11,
     $     File	= 		'HISTORY.STATS',
     $	   Status = 		'OLD',
     $	   Organization = 	'Indexed',
     $     Form	= 		'Formatted',
     $	   CarriageControl = 	'None',
     $     Access = 		'Keyed',
     $     IOStat = 		Status
     $    )

	If (Status .ne. 0) Then
	  Open 
     $      (Unit =		11,
     $	     File = 		'History.Stats',
     $	     Status = 		'New',
     $	     Organization = 	'Indexed',
     $	     Recl = 		132,
     $	     Access =	 	'Keyed',
     $	     Key = 		(1:20:Character),
     $       Form = 		'Formatted',
     $	     CarriageControl = 	'None',
     $	     IOStat = 		Status
     $	    )
	  If (Status .ne. 0) Then
	    Print '(A,I)', 
     $	      ' Error creating file History.Stats, Status = ', Status
	    Stop
	  EndIf
	EndIf

C No bridges so far

	X = 0

C Read through the RBMS output file

	Status = 0
	Do While (Status .eq. 0)
	  Read (10,'(A)',IOStat = Status) Image
	  If (Status .eq. 0) Then
	    If      (Image(1:9) .eq. 'Line coun') Then
	      Read (Image(24:24),'(I1)') Line
	    Else If (Image(1:9) .eq. 'Bridge   ') Then
	      If (Line .eq. 1) Then
	        X = X + 1
	        Read (Image,'(9x,A19)') Bridge(X).Name
	        Z = Index (Bridge(X).Name,',')
	        If (Z .ne. 0) Then
	          Bridge(X).Name(Z:20) = ' '
	        EndIf
	      EndIf
	    Else
	      If (X .ne. 0) Then
	        If     (Image(1:9) .eq. 'Bridge se') Then
		  Read (Image,'(40x,I12)')
     $		    Bridge(X).Seconds(Line)
	        Else If (Image(1:9) .eq. 'Invalid p') Then
		  Read (Image,'(40x,I12)')
     $		    Bridge(X).Invalid_Protocol(Line)
	        Else If (Image(1:9) .eq. 'Filtered ') Then
		  Read (Image,'(40x,I12)') 
     $		    Bridge(X).Filtered_Frames(Line)
	        Else If (Image(1:9) .eq. 'Bad frame') Then
		  Read (Image,'(40x,I12)')
     $		    Bridge(X).Bad_Frames(Line)
	        Else If (Image(1:9) .eq. 'Lifetime ') Then
		  Read (Image,'(40x,I12)')
     $		    Bridge(X).Life_Time_Exceeded(Line)
	        Else If (Image(1:9) .eq. 'No forwar') Then
		  Read (Image,'(40x,I12)')
     $		    Bridge(X).No_Forwarding(Line)
	        Else If (Image(1:9) .eq. 'Forwardin') Then
		  Read (Image,'(40x,I12)') 
     $		    Bridge(X).Forwarding_Transitions(Line)
	        Else If (Image(1:9) .eq. 'Collision') Then
		  Read (Image,'(40x,I12)') 
     $              Bridge(X).Collision_SQE_Error(Line)
	        Else If (Image(1:9) .eq. 'Frames:  ') Then
		  Read (Image,'(14x,I25,7x,I25)') 
     $		    Bridge(X).Frames_Transmitted(Line),
     $		    Bridge(X).Frames_Received(Line)
	        Else If (Image(1:9) .eq. 'Bridge fr') Then
		  Read (Image,'(14x,I25,7x,I25)') 
     $		    Bridge(X).Bridge_Transmitted(Line),
     $		    Bridge(X).Bridge_Received(Line)
	        Else If (Image(1:9) .eq. 'Frames lo') Then
		  Read (Image,'(14x,I25,7x,I25)') 
     $		    Bridge(X).Frames_Transmitted_Lost(Line),
     $		    Bridge(X).Frames_Received_Lost(Line)
	        EndIf
	      EndIf ! (X .ne. 0)
            EndIf ! (Image(1:9) .eq. 'Line coun') Then
	  End If ! (Status)
	End Do

C Now produce report

C Print Headings

	Print '(19x,A,2x,A)',
     $    '---- Line 1 --> Line 2 ---- ',
     $    '---- Line 2 --> Line 1 ---- '

	Print '(31x,A,A,16x,A,A)',
     $    '      %',
     $    '      %',
     $    '      %',
     $    '      %'

	Print '(x,20A)',
     $    'Bridge         ',
     $    '   Receive',
     $    '  F/S',
     $    ' Filter',
     $    '    Bad',
     $    ' ',
     $    '   Receive',
     $    '  F/S',
     $    ' Filter',
     $    '    Bad'

	Print '(x)'

C Produce report for each bridge

	Do Z = 1,X

C Read the history entry for the bridge

	  Read (11,'(A)',IOStat = Status, KeyEq = Bridge(Z).Name)
     $	    H_Bridge.All
	  If (Qual_All .or. (Status .ne. 0)) Then
	    Do I = 1,132
	      H_Bridge.All(I:I) = Char(0)
	    End Do
	  EndIf

C Calculate stats to be be printed for this bridge

	  Do I = 1,2

	    PC_Filtered(I) = 
     $        100.0 * (Bridge(Z).Filtered_Frames(I) - 
     $                 H_Bridge.Filtered_Frames(I))
     $        /
     $        (Bridge(Z).Frames_Received(I) - 
     $         H_Bridge.Frames_Received(I))

	    PC_Bad_Frames(I) = 
     $	      100.0 * (Bridge(Z).Bad_Frames(I) -
     $		       H_Bridge.Bad_Frames(I))
     $        /
     $        (Bridge(Z).Frames_Received(I) -
     $	       H_Bridge.Frames_Received(I))

	    PPS_Received(I) = 
     $        (Bridge(Z).Frames_Received(I) -
     $         H_Bridge.Frames_Received(I))
     $        / 
     $        (Bridge(Z).Seconds(I) -
     $	       H_Bridge.Seconds(I))

	    Line_Err(I) = ' '
	    If ((Bridge(Z).Life_Time_Exceeded(I) -
     $		 H_Bridge.Life_Time_Exceeded(I)
     $          ) .ne. 0) Then
	      Line_Err(I) = 'L'
	    Else If ((Bridge(Z).Invalid_Protocol(I) -
     $		 H_Bridge.Invalid_Protocol(I)
     $          ) .ne. 0) Then
	      Line_Err(I) = 'P'
	    Else If ((Bridge(Z).Collision_SQE_Error(I) -
     $		 H_Bridge.Collision_SQE_Error(I)
     $          ) .ne. 0) Then
	      Line_Err(I) = 'C'
	    Else If ((Bridge(Z).No_Forwarding(I) -
     $		 H_Bridge.No_Forwarding(I)
     $          ) .ne. 0) Then
	      Line_Err(I) = 'F'
	    Else If (PC_Bad_Frames(I) .gt. 0.05) Then
	      Line_Err(I) = 'E'
	    EndIf
	  EndDo

	  Print '(x,A,2(i10,i5,f7.2,F7.2,A))',
     $	    Bridge(Z).Name(1:15), 
     $        (Bridge(Z).Frames_Received(I) - 
     $           H_Bridge.Frames_Received(I) ,
     $         PPS_Received(I),
     $         PC_Filtered(I),
     $         PC_Bad_Frames(I),
     $         Line_Err(I),
     $         I = 1,2
     $        )

	  If (Qual_Record) Then
	    If (Status .eq. 0) Then
	      ReWrite (11,'(A)',IOStat = Status) Bridge(Z).All
	    Else
	      Write (11,'(A)',IOStat = Status) Bridge(Z).All
	    EndIf
	  EndIf

	  If (Status .ne. 0) Then
	    Print '(A,I)', ' Error updating History.Stats, Status = ',
     $	      Status
	  EndIf

	End Do

	End ! Summary
