| Hi,
I had the same problem for TCP graph reports list on topics 3587,
3877, and entered as QAR 3372.
Finally yesterday, having some time, I was able to make it works.
What I did is only to solve the syntax error inside the DCL command
files and the DTR procedures. I didn't check if there are also
"logical" error, I mean I didn't check the algorithms, I presume
that the reports produce what they say.
I'm not a programmer and the last time that I used DTR was 4 years
ago, so it's possible that I miss something.
The errors for DAILY and HOURLY graph reports was the same so I
include only the DAILY reports, correct the same errors on the
HOURLY.
A little description, these reports are composed in two parts, the
first one is some DTR commands write inside the DCL procedure that
read the RDB relation and produce a temporary file that's contains
the records that match the selection made (SNMP, interface, date ),
the second part run a DTR procedure thats read the temporary file
and produce a GRL file for DECGRAPH.
There is a syntax error on the first part (the DCL procedure) and
another two on the second (the DTR procedure), I'll include these
files, I'll put a sign like "<<<<" near the corrections.
The DCL procedure MCC_RPTS_TCPIP_INT_DAILY_GRAPH_DTR.COM:
=========================================================
$!MCC_RPTS_TCPIP_INT_DAILY_GRAPH_DTR.COM
$!************************************************************
$! Copyright (c) Digital Equipment Corporation, 1990
$! All Rights Reserved. Unpublished rights reserved
$! under the copyright laws of the United States.
$!
$! The software contained on this media is proprietary
$! to and embodies the confidential technology of
$! Digital Equipment Corporation. Possession, use,
$! duplication or dissemination of the software and
$! media is authorized only pursuant to a valid written
$! license from Digital Equipment Corporation.
$!
$! RESTRICTED RIGHTS LEGEND Use, duplication, or
$! disclosure by the U.S. Government is subject to
$! restrictions as set forth in Subparagraph (c)(1)(ii)
$! of DFARS 252.227-7013, or in FAR 52.227-19, as
$! applicable.
$!************************************************************
$!***************************************************************************
$! This procedure is submitted by MCC_RPTS_TCPIP_INT_DAILY_GRAPH.COM
$!***************************************************************************
$ THIS_PROCESS = ""
$ PID = F$PID(THIS_PROCESS)
$ show sym p1
$ show sym p2
$ show sym p3
$ show sym p4
$! show sym PID
$ TIME = F$TIME()
$ DAY = F$CVTIME(TIME,,"DAY")
$ MONTH= F$CVTIME(TIME,,"MONTH")
$ YEAR = F$CVTIME(TIME,,"YEAR")
$ HOUR = F$CVTIME(TIME,,"HOUR")
$ MIN = F$CVTIME(TIME,,"Minute")
$ SEC = F$CVTIME(TIME,,"second")
$ HUNDREDTH = F$CVTIME(TIME,,"HUNDREDTH")
$ space1 = " "
$
$ define interface_id_file int_id_tmp.d'PID''DAY''HOUR''min''hundreth'
$ define int_graph_temp1 int_graph.d'PID''DAY''HOUR''min''hundreth'
$ create NODE_HOLD_d'PID''DAY''HOUR''min''hundreth'.grm
$!* The following line is intentionally kept blank.
$ define mcc$node1 "''p1'"
$ define mcc$INTERFACE_ID1 "''p2'"
$ define mcc$date1 "''p3'"
$ define mcc$date2 "''p4'"
$ define mcc$report_file "''p5'"
$!
$!
$! Enter datatrieve and store data and interfaces.
$!
$ datatrieve/interface=character_cell
set verify
!
! Ready database.
!
Ready MCC_EXPORT shared read
DECLARE NODE_HOLD PIC X(255).
DECLARE INTERFACE_ID_HOLD PIC X(16).
DECLARE DATE1_HOLD USAGE DATE.
DECLARE DATE2_HOLD USAGE DATE.
!*******************************************************************
! DECLARE NODE_HOLD1 COMPUTED BY FN$UPCASE(snmp) <<<
! on the original procedure miss the ".", on DTR all the DECLARE command
! MUST terminate with a ".", so the correct one is:
DECLARE NODE_HOLD1 COMPUTED BY FN$UPCASE(snmp) .
!*******************************************************************
NODE_HOLD = FN$TRANS_LOG("MCC$NODE1")
INTERFACE_ID_HOLD = FN$TRANS_LOG("MCC$INTERFACE_ID1")
DATE1_HOLD = FN$DATE(FN$TRANS_LOG("MCC$DATE1"))
DATE2_HOLD = FN$DATE(FN$TRANS_LOG("MCC$DATE2"))
!
! Find data
!
Find MCC_SNMP_INTERFACE with NODE_HOLD1 CONTAINING NODE_HOLD
if INTERFACE_ID_HOLD NE "999" THEN Find current with INTERFACE = INTERFACE_ID_HOLD
Find current with time_STAMP between DATE1_HOLD and DATE2_HOLD
Find current with exp_cvr_statistics = 1
!
! Define file to hold data.
!
define file for int_graph_temp
ready int_graph_temp write
int_graph_temp = current
!
! Write interfaces we are reporting on to a file.
!
reduce current to interface
on interface_id_file
for a in current
print a.interface (-)
!
! Done. Exit DTR
!
EXIT
$
$open/read/error=file_open_error infile int_id_tmp.d'PID''DAY''HOUR''min''hundreth'
$ read/end_of_file=normal_exit infile interface_id_rec
$ count_hold = 0
$ loop_read_process_int_id:
$ count_hold = count_hold + 1
$ interface = F$EDIT(interface_id_rec,"COLLAPSE")
$ define hold$interface 'interface'
$ Define MCC$INT_GRAPH_FILE int_id_d'PID''DAY''HOUR''min''hundreth'.grl
$ datatrieve/interface=character_cell
:TCPIP_INT_DAILY_GRAPH_RPT
EXIT
$!
$! Do the graph.
$!
$ graph/load/nointeractive/monochrome=int_id_d'PID''DAY''HOUR''min''hundreth' int_id_d'PID''DAY''HOUR''min''hundreth' mcc_reports_files:mcc_rpts_lgraph
$ append int_id_d'PID''DAY''HOUR''min''hundreth'.grm node_hold_d'PID''DAY''HOUR''min''hundreth'.grm
$ delete/nocon int_id_d'PID''DAY''HOUR''min''hundreth'.grl.*
$ delete/nocon int_id_d'PID''DAY''HOUR''min''hundreth'.grm.*
$ delete/nocon int_id_d'PID''DAY''HOUR''min''hundreth'.grd.*
$ delete/nocon int_id_d'PID''DAY''HOUR''min''hundreth'.gri.*
$ read/end_of_file=normal_exit infile interface_id_rec
$ goto loop_read_process_int_id
$ normal_exit:
$!
$ rename node_hold_d'PID''DAY''HOUR''min''hundreth'.grm 'P5'
$ delete/nocon int_id_tmp.d'PID''DAY''HOUR''min''hundreth'.*
$ delete/nocon int_graph.d'PID''DAY''HOUR''min''hundreth'.*
$ exit
$file_open_error:
$ write sys$output "Error opening file for circuit_id_tmp"
$ EXIT
The DTR procedure TCPIP_INT_DAILY_GRAPH_RPT.DTR :
=================================================
DELETE TCPIP_INT_DAILY_GRAPH_RPT;
REDEFINE PROCEDURE TCPIP_INT_DAILY_GRAPH_RPT
!
DECLARE HOLD_DAY PIC XX.
DECLARE DATE1_HOLD USAGE DATE.
DECLARE DATE2_HOLD USAGE DATE.
DECLARE START_DATE USAGE DATE.
DECLARE END_DATE USAGE DATE.
DECLARE TODAY_HOLD USAGE DATE DEFAULT "TODAY".
DECLARE AVE_UTILIZATION USAGE DOUBLE.
DECLARE IN_UTILIZATION USAGE DOUBLE.
DECLARE OUT_UTILIZATION USAGE DOUBLE.
DECLARE NODE_HOLD PIC X(255).
DECLARE INT_ID_HOLD USAGE QUAD.
!
! Translate Logical Names.
!
NODE_HOLD = FN$TRANS_LOG("MCC$NODE1")
INT_ID_HOLD = FN$TRANS_LOG("HOLD$INTERFACE")
DATE1_HOLD = FN$DATE(FN$TRANS_LOG("MCC$DATE1"))
DATE2_HOLD = FN$DATE(FN$TRANS_LOG("MCC$DATE2"))
!
! Initialize
!
HOLD_DAY = "**"
!
! Ready databases
!
READY INT_GRAPH_TEMP SHARED READ
!
! Find data
!**********************************************************************
!FIND INT_GRAPH_TEMP WITH SNMP = NODE_HOLD <<<
! Here DTR open the temporary file, try to produce a collection of records that
! match the SNMP name, BUT if the name on the field is in lowercase you have no
! match..so no records selected and no reports
! If you substitute the "SNMP = NODE_HOLD" with "SNMP cont NODE_HOLD" doesn't
! check if it's in up or lower case.
!
! BTW I don't understand why the programmer that write this procedure want make
! another selection, I mean this DTR procedure is called only after that on the
! DCL procedure with DTR command has already selected on the RDB relation the
! records we're interested on, and write it on a temporary file.
!
! In my opinion it is enough only the selection based on the interface
!
! Anyway using the "cont" relational operator instead of "=" it's work, so:
!**********************************************************************
FIND INT_GRAPH_TEMP WITH SNMP cont NODE_HOLD
FIND CURRENT WITH INTERFACE = INT_ID_HOLD
FIND CURRENT WITH TIME_STAMP BETWEEN DATE1_HOLD AND DATE2_HOLD SORTED BY TIME_STAMP
!
! Get actual start and end dates.
!
SELECT FIRST
START_DATE = TIME_STAMP
SELECT LAST
END_DATE = TIME_STAMP
!
! Write data to file.
!
ON MCC$INT_GRAPH_FILE
BEGIN
PRINT "TITLE Host:", NODE_HOLD(-) USING X(7), " - ", "Interface id:", INT_ID_HOLD (-) USING Z(4)9
PRINT "SUBTITLE", START_DATE (-) USING X(12), "-", END_DATE (-) USING X(12)
PRINT "HORIZONTAL_LABEL DAY"
PRINT "VERTICAL_LABEL UTILIZATION"
PRINT "X_DATA_TYPE TEXT"
PRINT "Y_LEGEND IN_UTIL"
PRINT "Y_LEGEND OUT_UTIL"
PRINT "Y_LEGEND AVE_UTIL"
FOR A IN CURRENT SORTED BY TIME_STAMP
BEGIN
IF HOLD_DAY = "**" THEN
BEGIN
HOLD_DAY = A.DAY1
AVE_UTILIZATION = A.TOTAL_UTILIZATION
!****************************************************************************
! IN_UTILIZATION = A.INBOUND_UTILIZATION <<<
! OUT_UTILIZATION = A.OUTBOUND_UTILIZATION <<<
! Another syntax error, on the temporary file doesn't exist the
! INBOUND_UTILIZATION and OUTBOUND_UTILIZATION fields, but the
! IN_UTILIZATION and OUT_UTILIZATION, so you've to substitute all this
! fields.
!****************************************************************************
IN_UTILIZATION = A.IN_UTILIZATION
OUT_UTILIZATION = A.OUT_UTILIZATION
END ELSE
BEGIN
IF HOLD_DAY NOT EQ A.DAY1 THEN
BEGIN
PRINT '"', HOLD_DAY(-) USING Z9, '"', " ",
IN_UTILIZATION(-) USING Z9.99, " ",
OUT_UTILIZATION(-) USING Z9.99, " ",
AVE_UTILIZATION(-) USING Z9.99
AVE_UTILIZATION = A.TOTAL_UTILIZATION
IN_UTILIZATION = A.IN_UTILIZATION
OUT_UTILIZATION = A.OUT_UTILIZATION
HOLD_DAY = A.DAY1
END ELSE
BEGIN
AVE_UTILIZATION = (AVE_UTILIZATION + A.TOTAL_UTILIZATION)/2
IN_UTILIZATION = (IN_UTILIZATION + A.TOTAL_UTILIZATION)/2
OUT_UTILIZATION = (OUT_UTILIZATION + A.TOTAL_UTILIZATION)/2
END
END
END
!
! Print last record
!
IF HOLD_DAY NE "**" THEN
PRINT '"', HOLD_DAY(-) USING Z9, '"', " ",
IN_UTILIZATION(-) USING Z9.99, " ",
OUT_UTILIZATION(-) USING Z9.99, " ",
AVE_UTILIZATION(-) USING Z9.99
END
FINISH ALL
END_PROCEDURE
|
| Hi,
I've another look to the procedures to have the SNMP's interfaces
utilization (option 9 and 10 on SNMP reports).
With the sintax correction that I suggested last time I was able
at least to produce the graphs, but I felt uneasy on this resulting
graphs.
First of all I wasn't confident with the algorithm used to calculate
the average of Inbound, Outbound and Average utilization for the
daily basis.
Actually the DTR procedure to calculate the daily average's Inbound
Utilization, for example, read one record and if the date isn't
different, sum the 2 Inbound utilization and divide by 2.
To better explain imagine a Inbound utilization of 2% for 23 hours,
the 24th hour you have an utilization of 100%, actually the DTR
procedure sum (2%+2%)/2 for the first 23 hours, at this point you
have a 2% Inbound utilization. Adding the value of the 24th hour
you've (2+100)/2 = 51% Inbound utilization.
This is incorrect for me, I think that the correct algorithm is:
The sum of all the utilization divided by the number of daily records,
in this case you obtain for the above example (2*23+100)/24 for a
6.083% Inbound utilization.
So I modified the DTR procedure to use this algorithm, but as I
said I'm not a programmer, so could a DTR guru check the procedure
that I include ???
The second thing is that the graph that I tried to produce show
only the Average utilization line, the Inbound and Outbound lines
was always with zeroes values.
This is due to the differences between the fields on the record of
the temporary files and the fields on the relation MCC_SNMP_INTERFACE,
on one exist the IN_UTILIZATION and OUT_UTILIZATION fields. on the RDB
relation INBOUND_UTILIZATION and OUTBOUND_UTILIZATION.
So when the first DTR procedure use the command
"DTR>reduce current to interface" to produce the temporary file it's
unable to write the Inbound and Outbound utilization. The REDUCE
command in DTR "transport" only the fields that has the same name.
Now I include the corrections that I make (only for the daily graph,
for the hourly make the same corrections), but I think that should
be better if a real DTR and network programmer check all these stuffs.
Hope this help someone,
Ciao Luciano Barilaro
P.S.: I'm hoping to make it clear, but I've some doubts, my english
isn't the best one....
FIRST MODIFY THE INTERFACE_GRAPH_REC:
-------------------------------------
DELETE INTERFACE_GRAPH_REC;
REDEFINE RECORD INTERFACE_GRAPH_REC
USING
01 INTERFACE_GRAPH_RECORD.
05 SNMP PIC X(255).
05 INTERFACE USAGE QUAD.
05 TIME_STAMP USAGE DATE EDIT_STRING IS X(23).
05 TOTAL_UTILIZATION USAGE DOUBLE.
!!!!!!!!!!!!!!
! 05 IN_UTILIZATION USAGE DOUBLE. <<
! 05 OUT_UTILIZATION USAGE DOUBLE. <<
! Substitute these fields with:
!
05 INBOUND_UTILIZATION USAGE DOUBLE.
05 OUTBOUND_UTILIZATION USAGE DOUBLE.
!
!!!!!!!!!!!!!!
05 HOUR1 COMPUTED BY FN$HOUR(TIME_STAMP).
05 DAY1 COMPUTED BY FN$DAY(TIME_STAMP).
;
SECOND MODIFY THE DTR PROCEDURE TCPIP_INT_DAILY_GRAPH_RPT :
------------------------------------------------------------
DELETE TCPIP_INT_DAILY_GRAPH_RPT;
REDEFINE PROCEDURE TCPIP_INT_DAILY_GRAPH_RPT
!
DECLARE COUNTER PIC XX. !<< ADDED TO COUNT THE NUMBER OF RECORD FOR THE SAME DAY
!
DECLARE HOLD_DAY PIC XX.
DECLARE DATE1_HOLD USAGE DATE.
DECLARE DATE2_HOLD USAGE DATE.
DECLARE START_DATE USAGE DATE.
DECLARE END_DATE USAGE DATE.
DECLARE TODAY_HOLD USAGE DATE DEFAULT "TODAY".
DECLARE AVE_UTILIZATION USAGE DOUBLE.
DECLARE IN_UTILIZATION USAGE DOUBLE.
DECLARE OUT_UTILIZATION USAGE DOUBLE.
DECLARE NODE_HOLD PIC X(255).
DECLARE INT_ID_HOLD USAGE QUAD.
!
! Translate Logical Names.
!
NODE_HOLD = FN$TRANS_LOG("MCC$NODE1")
INT_ID_HOLD = FN$TRANS_LOG("HOLD$INTERFACE")
DATE1_HOLD = FN$DATE(FN$TRANS_LOG("MCC$DATE1"))
DATE2_HOLD = FN$DATE(FN$TRANS_LOG("MCC$DATE2"))
!
! Initialize
!
COUNTER = 0
HOLD_DAY = "**"
!
! Ready databases
!
READY INT_GRAPH_TEMP SHARED READ
!
! Find data
!
!FIND INT_GRAPH_TEMP WITH SNMP CONT NODE_HOLD
FIND INT_GRAPH_TEMP
FIND CURRENT WITH INTERFACE = INT_ID_HOLD
FIND CURRENT WITH TIME_STAMP BETWEEN DATE1_HOLD AND DATE2_HOLD SORTED BY TIME_STAMP
!
! Get actual start and end dates.
!
SELECT FIRST
START_DATE = TIME_STAMP
SELECT LAST
END_DATE = TIME_STAMP
!
! Write data to file.
!
ON MCC$INT_GRAPH_FILE
BEGIN
PRINT "TITLE Host:", NODE_HOLD(-) USING X(7), " - ", "Interface id:", INT_ID_HOLD (-) USING Z(4)9
PRINT "SUBTITLE", START_DATE (-) USING X(12), "-", END_DATE (-) USING X(12)
PRINT "HORIZONTAL_LABEL DAY"
PRINT "VERTICAL_LABEL UTILIZATION"
PRINT "X_DATA_TYPE TEXT"
PRINT "Y_LEGEND IN_UTIL"
PRINT "Y_LEGEND OUT_UTIL"
PRINT "Y_LEGEND AVE_UTIL"
FOR A IN CURRENT SORTED BY TIME_STAMP
BEGIN
IF HOLD_DAY = "**" THEN
BEGIN
HOLD_DAY = A.DAY1
AVE_UTILIZATION = A.TOTAL_UTILIZATION
IN_UTILIZATION = A.INBOUND_UTILIZATION
OUT_UTILIZATION = A.OUTBOUND_UTILIZATION
END ELSE
BEGIN
IF HOLD_DAY NOT EQ A.DAY1 THEN
BEGIN
!<<<
! WHEN THE DAY CHANGE I DIVIDE THE SUM OF THE UTILIZATION FOR THE DAY FOR THE
! NUMBER OF RECORDS FOUND FOR THAT DAY
!
AVE_UTILIZATION = (AVE_UTILIZATION/COUNTER)
IN_UTILIZATION = (IN_UTILIZATION/COUNTER)
OUT_UTILIZATION = (OUT_UTILIZATION/COUNTER)
!<<<<
! Every new day I zero the counter
!
COUNTER = 0
PRINT '"', HOLD_DAY(-) USING Z9, '"', " ",
IN_UTILIZATION(-)USING Z9.99, " ",
OUT_UTILIZATION(-) USING Z9.99, " ",
AVE_UTILIZATION(-) USING Z9.99
AVE_UTILIZATION = A.TOTAL_UTILIZATION
IN_UTILIZATION = A.INBOUND_UTILIZATION
OUT_UTILIZATION = A.OUTBOUND_UTILIZATION
HOLD_DAY = A.DAY1
END ELSE
BEGIN
!<<<<
! THE ORIGINAL COMMAND WAS:
! AVE_UTILIZATION = (AVE_UTILIZATION + A.TOTAL_UTILIZATION)/2
! IN_UTILIZATION = (IN_UTILIZATION + A.TOTAL_UTILIZATION)/2
! OUT_UTILIZATION = (OUT_UTILIZATION + A.TOTAL_UTILIZATION)/2
!
! From my point of view there are 2 mistakes, why to calculate the Inbound
! Utilization i've to sum the Total utilization ? The second as I described
! above it's the division by 2 .
! So I correct this part to have only the daily's sum of Inbound, Outbound,
! Total utilization and a counter with the number of the records for that day.
! I use this info one time that the day change to have the average.
!
COUNTER = COUNTER + 1
AVE_UTILIZATION = (AVE_UTILIZATION + A.TOTAL_UTILIZATION)
IN_UTILIZATION = (IN_UTILIZATION + A.INBOUND_UTILIZATION)
OUT_UTILIZATION = (OUT_UTILIZATION + A.OUTBOUND_UTILIZATION)
END
END
END
!
! Print last record
!
IF HOLD_DAY NE "**" THEN
PRINT '"', HOLD_DAY(-) USING Z9, '"', " ",
IN_UTILIZATION(-) USING Z9.99, " ",
OUT_UTILIZATION(-) USING Z9.99, " ",
AVE_UTILIZATION(-) USING Z9.99
END
FINISH ALL
END_PROCEDURE
|
| RE: .6
Hi Richard,
I'm not sure I could help you, but I think happened the same thing
to me.
I couldn't explain why, but one time I encountered this situation:
I ran the daily graph procedure selecting a TCP gateway, the first
part of the procedure (the DTR procedure inside the
MCC_RPTS_TCPIP_INT_DAILY_GRAPH_DTR.COM that select the records
matching the node name, interfaces and time selection, and produce
the temporary file) works correctly.
The second part (the DTR procedure that read the temporary file and
has to produce the GRL files) I don't know why was unable to make
the first FIND command, the one that select the records of the
temporary file that match the node name. I don't really don't
know why, this FIND command is equivalent to the FIND command
of the first part, but in my case didn't work and if I remember
well the errors that I receive was the ones you mentioned.
Workaround: In my opinion for this FIND it's unecessary select
another time the records that match the node name, this was
already made by the first part, the temporary file contain
only records for this node, so I modified the DTR procedure
TCPIP_INT_DAILY_GRAPH_RPT in that way:
EXTRACT FROM THIS PROCEDURE (THE PART THAT SELECT THE RECORDS):
!
! Find data
!
!FIND INT_GRAPH_TEMP WITH SNMP CONT NODE_HOLD
FIND INT_GRAPH_TEMP !<<< a general collection that contain all records
FIND CURRENT WITH INTERFACE = INT_ID_HOLD
FIND CURRENT WITH TIME_STAMP BETWEEN DATE1_HOLD AND DATE2_HOLD SORTED
BY TIME_S
Hope this could help you,
Ciao Luciano
|