%externalroutine fepmon(%string (255) s) %dynamicroutinespec fepgraphs(%string (255) s) %externalroutinespec define(%string (255) s) %string (255) t, u, uu, title, uuu %recordformat ff( %c %integer tim, users,sta,cpu,pkts,sbr,byt,rjeo,rjei) %integer i, diff, k, l, us, cp, kb, pk, rj, who, who1, who2 %owninteger users, sta, cpu, pkts, sbr, byt, rjeo, tim, rjei %owninteger points, fep no = -1 %constintegerarray cpu f(0:6) = %c 235(3), 197, 550(3) %conststring (9) %array fep name(0:5) = %c "2980(0) ", "2980(1) ", "2980(2) ", "2972(4) ", "2972(1) ", "2972(2) " %record (ff) f !! !! !! %routine rd(%integername n) read(n) %if n< 0 %then n = n+32768*2 %end !! !! %routine do reply %integer k %routine out(%integer n) spaces(3); write(n, 5) %end %integerfn calc(%integer new, %integername old, %integer x) %integer n, p, k %if old>new %then old = old-32768*2 n = new-old %if n < 0 %then n = -n n = n//diff; p = n %if x = -1 %start p =100-((n*100)//cpu f(fep no)) out(p) %finishelsestart %if x = -2 %start; ! bytes spaces(3) %if 3 <= fep no <= 4 %then n = n//4; ! actual on ring n = n+2*pk; ! allow for rounding (see sbr) %if n < 256 %then spaces(2) %and out(n*4) %else %c %start k = n//256 n = (n-(k*256))*4 write(k, 3); printstring("k+") write(n, 4) %finish %finishelsestart p = n*x; out(p) %finish %finish old = new %result = p %end !! ! diff = f_tim-tim ! diff = 1 %if diff<=0 diff = 1; ! multi-polling tim = f_tim write(tim//2, 4); spaces(3) sta = f_sta %if sta = 0 %then printstring(" down") %c %else printstring(" up ") out(f_users) cp = calc(f_cpu, cpu, -1); printsymbol('%') i = calc(f_pkts, pkts, 1) pk = i k = calc(f_rjeo, rjeo, 1) l = calc(f_sbr, sbr, 1) out(i-k-l) rj = calc(f_rjei, rjei, 1) kb = calc(f_byt, byt, -2) print((kb*16)/15000, 5, 1); printstring(" kb/s ") select output(3) %if cp < -2 %or cp > 110 %start printstring(" 0 0 0 0 0 0 0 0 ") %finishelsestart write((kb*16)//750, 1); write(cp, 1) write(f_users, 1); write(i, 1) write(k, 1); write(l, 1); write(i-k-l, 1) write(rj, 1); ! dummy for rjei for now %finish points = points+1 newline; select output(2) %end %unless s -> t.("/").u %start printstring("parameters a/b! ") %return %finish %unless u -> u.(":").uuu %then uuu="" %unless u -> u.(",").uu %then uu = "mon#tmp" %if length(uuu) = 2 %start fep no = charno(uuu, 2)-'0' %finish define("1,".t); define("2,".u); define("3,".uu) select input(1); select output(2) newlines(5) printstring("monitoring file:") printstring(t); newlines(4) printstring("Title:") title = "" %if fepno >= 0 %start title = fep name(fepno) %finish %cycle readsymbol(i); printsymbol(i) %exit %if i = nl title = title.tostring(i) %repeat newlines(3) printstring(" mins state users cpu pkts:-") printstring( %c " (rje sbr other) rje(in) byt kb/s ") %cycle rd(who) %exit %if who > 32000 %if (who # fep no %and fep no # -1) %or fep no > 5 %start %cycle readsymbol(who1) %exit %if who1 = nl %repeat %continue %finish rd(f_tim) %exit %if points>270*4 %or f_tim > 32000 f_tim = f_tim//6 rd(f_users); rd(f_sta) %if f_users>32766 %then f_users = -1 %if f_users > 80 %then f_users=80 rd(f_cpu); rd(f_pkts); rd(f_sbr) rd(f_byt); rd(f_rjeo) rd(f_rjei) do reply %repeat select output(3) printstring("-1 ") select output(0); select input(0); close stream(1) close stream(3) %unless uuu="" %then fepgraphs(uu.",".title) %end %endoffile