%EXTERNALROUTINE telan %alias "C#telan"(%STRING (255) s) %externalstring %fn %spec date %alias "S#date" %externalstringfnspec substring %alias "S#substring" %c (%string (*) %name s, %integer i,j) %EXTERNALROUTINESPEC prompt %ALIAS "S#PROMPT"(%STRING (255) s) %externalroutinespec EMAS3CONNECT %c (%stringname file, %integername mode, hole, prot, conad, %c type, start, end, flag) %ROUTINE define(%STRING (255) s) %EXTERNALROUTINESPEC emas3(%STRINGNAME command,params, %INTEGERNAME flag) %INTEGER flag emas3("DEFINE",s,flag) %END; ! Of %ROUTINE define. %STRING (255) t,u,v,s2,t2,padname,d2,s3,t3, mnth, curr, dst, yrs, mon name,mn %INTEGER i,j,k,n,x,crash, st,m1,m2,yr %owninteger thisf, lastf, thisrej, lastrej, reload, finh %owninteger mode, hole, prot, conad, type, start, end, flag, ptr %OWNINTEGER this day,hours,thours, bars %OWNINTEGER max= 0, days, fhours, hours up, fday = 2 %real x1, y1, x2, y2, bsize %REAL mtbf %RECORDFORMAT padf(%STRING (15) name, %INTEGER last crash,crash,lastt, maxu,first,last) %OWNRECORD (padf) %ARRAY pada(1:100) %OWNRECORD (padf) %NAME pad %STRING (255) %ARRAY res(1:12) %OWNINTEGER no of res %CONSTSTRING (3) %ARRAY day(1:7)= "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" %CONSTSTRING (12) %ARRAY month(1:12)= "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" %OWNINTEGERARRAY nodays(1:12)= 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30 %ONEVENT 9 %START ->finish %FINISH %integerfnspec stoi(%string (255) s) %routine readstring(%string (*) %name s) %integer i s = "" %cycle readsymbol(i); %return %if i = nl s = s.tostring(i) %repeat %end %INTEGERFN constr(%STRING (255) s) %INTEGER i,j,n %CYCLE; %EXITUNLESS charno(s,1)=' '; s -> (" ").s; %REPEAT %CYCLE; %EXITUNLESS charno(s,length(s))=' '; length(s) = length(s)-1 %REPEAT %RESULT = stoi(s) %END %integerfn stoi(%string (255) s) %integer i,j,n, sum sum = 0 %if length(s) = 0 %then %result = 0 j=0 %cycle i = 1, 1, length(s) n = charno(s, i)-'0' %if n = 32-'0' %then %continue %if n < 0 %or n > 9 %start %result = sum %finish sum = sum*10+n %repeat %result = sum %end %ROUTINE read line(%STRING (255) %NAME s) %INTEGER i,j s = ""; j = 0; bars = 0 %CYCLE i = byteinteger(ptr); ptr = ptr+1; %if ptr=end+conad %then %signal 9,0 %RETURNIF i=10 j = j+1 bars = bars+1 %if i = '|' s = s.tostring(i) %UNLESS j>130 %REPEAT %END %routine getdate(%integer n) %integer i,j,m,h, d,wkd j = intpt(n/24); ! no of days %cycle m = 1, 1, 12 %if nodays(m) >= j %then %exit %repeat m = m-1; ! went past m = 1 %if m = 0 d = j-nodays(m); ! residual days h = n-(j*24) j = j+fday wkd = j-(intpt(j/7)*7) %if wkd = 0 %then wkd = 7 space; printstring(day(wkd)); write(d, 3) space; printstring(month(m)); space write(h, 2) %end %CYCLE i = 2,1,12; nodays(i) = nodays(i)+nodays(i-1); %REPEAT curr = date dst = substring(curr, 1, 2) yrs = substring(curr, 7, 8) mn = substring(curr, 4, 5) finh = (nodays(stoi(mn))+stoi(dst)+(stoi(yrs)-86)*365)*24 curr = dst." ".month(stoi(mn))." ".yrs t = s s = "mail.telstats" st=0 prompt("Return, or m for monitoring:") readstring(padname) %if padname = "m" %then padname = "M" %if padname = "M" %then printstring("Monitoring ON ") define("2,".t) emas3connect(s,mode,hole,prot,conad,type,start,end,flag) ptr = conad+start select output(2) printstring(" {{label(5,25,.5,0,""TelePAC - Data Packets/Day"")}} {{label(10,.3, .3,0,""Day"")}} {{label(1,12,.3,90,""Packets"")}} {{label(.75,6,.25,0,""1m"");label(.75,11,.25,0,""2m"");label(.75,16,.25,0,""3m"")}} {{label(.75,21,.25,0,""4m"")}}") printstring(" {{label(1,.5,.25,0,""Oct '86"")}} {{box(2,1)(30,26);box(2,1)(30,21);box(2,1)(30,16)}} {{box(2,1)(30,11);box(2,1)(30,6)}} ") select output(0) %CYCLE readline(s) %if s = "" %then %exit %IF charno(s,1)='(' %THENEXIT %REPEAT %CYCLE readline(s) %if s="" %then %continue %IF charno(s,1)='(' %OR charno(s,1)='_' %THENCONTINUE %if s->t.("Data frames in/ ").t %then -> an frames %if s->t.("Rejects/ ").t %then -> count rejects %unless s->s.(" between ").t.(" ").u %then %continue %unless u->s.(" and ").t.(" ").u %then %continue d2 = u %CYCLE i = 1,1,7 %IF t=day(i) %START; ! got a date etc %UNLESS u->t.(" ").s %THENMONITOR %CYCLE j = 1,1,12 %IF t=month(j) %START; ! got a month %CYCLE; %EXITUNLESS charno(s,1)=' '; s -> (" ").s %REPEAT %UNLESS s->s2.(" ").t2 %THENMONITOR ! s2 is the day of the month ! t2 is 05:00:04 1996 %CYCLE; %EXITUNLESS s2->(" ").s2; %REPEAT this day = nodays(j)+stoi(s2) %unless t2 -> s3.(" ").t3 %then %monitor yr = stoi(t3)-1986 thours = hours hours = this day*24+yr*365*24 mnth = t %IF fhours=0 %start fhours = hours; ! base line bsize = (finh-fhours)/28; ! make pict 28+2 cm long %finish %if padname = "M" %start printstring(s2) space; printstring(t) %finish ->got date %FINISH %REPEAT %MONITOR %FINISH %REPEAT %continue count rejects: ! watch for reloads thisrej = stoi(t) %if thisrej < lastrej %start printstring("Reload by ".d2." ") lastf = 0 %finish lastrej = thisrej -> now do bar; ! reload (or not) detected, so output figs an frames: ! should be a pad name ! temp stuff - just data frames in (in t) %continue %unless t -> t.(" ").u thisf = stoi(t) %if lastf > thisf %then lastf = lastf-16777216 days = (hours-thours)//24 %continue; ! wait till rejects examined now do bar: %if days # 0 %start %if (thisf-lastf)/days > 6000000 %start printstring("Funny"); print((thisf-lastf)/days, 7, 0) printstring(" on:"); printstring(d2); newline lastf = -5000000*days+thisf; ! reload has occured %finish %unless hours <= thours %or fhours > thours %then %start select output(2) n = thours %while n < hours %cycle y1=(n-fhours)/bsize+2; y2 = (n+24-fhours)/bsize+2 x1=1; x2=((thisf-lastf)/days)/200000+1 printstring("{{box(") print(y1, 4, 2); printsymbol(','); print(x1, 4, 2) printstring(")(") print(y2, 4, 2); printsymbol(','); print(x2, 4, 2) printstring(")}} ") n = n+24 %repeat select output(0) %if padname = "M" %start write(thisf, 4); print((thisf-lastf)/(hours-thours)*24, 6, 0) newline %finish %finish %finish lastf = thisf %continue got date: %REPEAT finish: printstring("Last Pkt rate was ") write(thisf, 4); print((thisf-lastf)/(hours-thours)*24, 6, 0) newline select output(2) printstring(" {{label(25,.5,.25,0,""".curr.""")}} ") select output(0) printstring(" Base:"); write(fhours,5) space; getdate(fhours) printstring(" Current:") write(hours,5); space; getdate(hours) printstring(", Total Hours covered ="); write(hours-fhours,5) %END %endofprogram