Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script for DACS Titan 5500 pulling alarms

Status
Not open for further replies.

ricksepulveda

Programmer
Oct 10, 2005
1
US
This is a script I wrote for pulling alarms on a titan 5500 DACS and check for cross connects then builds a report.


;***********************************************************
;* Note: Written by RMSepulveda May. 03, 2005 *
;* DACS utilities to give you a report on T1's *
;* in alarm and if and what they are cross connect to *
;***********************************************************



integer count,x,z,y,len,linecount
integer cross = 1
string Linein[600]
string DataIn, szSDF, szTMP, Cmd, szCross, szTmpCross, DateString, TimeString, TD
string szType, szAlm, szTmpSDF, szFacType
integer Pos = 0
string alarmarray[600]
string alarmfile = "c:\Program Files\Symantec\Procomm Plus\Aspect\Alarms_5500.txt"
string testfile = "c:\Program Files\Symantec\Procomm Plus\Aspect\testAlarms_5500.txt"


proc main
call check_carrier
x = 0
z = 0
y = 0
len = 0
TD = ""
ltimestrs $LTIME DateString TimeString
strcat TD DateString
strcat TD "_"
strcat TD TimeString
delfile alarmfile
call ClearLinein
call Clearalarmarray
call query_alarms
termwrites " Done"
Cmd = "notepad.exe "
strcat Cmd alarmfile
DOS Cmd HIDDEN
endproc


proc query_alarms
clear
termwrites "The script is now rtrv alarms for T1's and building you a report`r`n"
termwrites "Please Wait "
transmit "rtrv-alm-t1:::r;"
call getdata
call check_t1
endproc



proc check_t1
call Clearalarmarray
for z = 0 upto x
alarmarray[z] = Linein[z]
endfor
linecount = x
if fopen 0 alarmfile append
fputs 0 "This is a Tellabs 5500 T1's in alarm and there cross connects`r`n"
fputs 0 TD
fputs 0 "`r`n"
fputs 0 "`r`n"
for y = 1 upto linecount
if strfind alarmarray[y] ",T1"
strextract szTmpSDF alarmarray[y] "," 0

if strfind szTmpSDF "`""
strreplace szTmpSDF "`"" ""
strreplace szTmpSDF "`n" ""
strextract szType alarmarray[y] "," 1
strextract szAlm alarmarray[y] "," 2
szSDF = szType
strcat szSDF " "
strcat szSDF szFacType
strcat szSDF " "
strcat szSDF szAlm
strcat szSDF " - "
strcat szSDF szTmpSDF
call rtrv_crs
strcat szSDF " X "
strcat szSDF szCross
strcat szSDF "`r`n"
fputs 0 szSDF
endif
endif
endfor

fclose 0
endif
endproc


proc rtrv_crs
szTMP = ""
szTMP = "rtrv-crs-t1::"
strcat szTMP szTmpSDF
strcat szTMP ":irvmso;^m"
call ClearLinein
transmit szTMP
call getdata
for z = 0 upto x
;errormsg "SDF=%s Linein=%s" , szSDF, LineIn[z]
if strfind LineIn[z] "CCT=2WAY"

;errormsg LineIn[z]
strextract szTmpCross LineIn[z] ":" 0
strextract szCross szTmpCross "," 1
exitfor
goto outofhere
endif
if x <= 4
szCross = "No CrossConnect"
exitfor
goto outofhere
endif
endfor


szTMP = ""
szTMP = "rtrv-t1::"
strcat szTMP szTmpSDF
strcat szTMP ":irvmso;^m"
call ClearLinein
transmit szTMP
call getdata
for z = 0 upto x
;errormsg "SDF=%s Linein=%s" , szSDF, LineIn[z]
if strfind LineIn[z] "CST"

szFacType = "CST"
exitfor
goto outofhere
endif
if strfind LineIn[z] "DGR"

szFacType = "DGR"
exitfor
goto outofhere
endif
endfor
szTMP = ""
szTMP = "rtrv-t1::"
strcat szTMP szTmpSDF
strcat szTMP ":irvmso;^m"
call ClearLinein
transmit szTMP
call getdata
for z = 0 upto x
;errormsg "SDF=%s Linein=%s" , szSDF, LineIn[z]
if strfind LineIn[z] "CST"

szFacType = "CST"
exitfor
goto outofhere
endif
if strfind LineIn[z] "DGR"

szFacType = "DGR"
exitfor
goto outofhere
endif
endfor
outofhere:
endproc

;**************** clear array *********************
proc Clearalarmarray
for count = 0 upto 599 ; Set up a loop
alarmarray[count] = "" ; Stick nothing in each array element
endfor

endproc

;**************** clear array *********************
proc ClearLinein
for count = 0 upto 599 ; Set up a loop
linein[count] = "" ; Stick nothing in each array element
endfor

endproc

;**************** READ COMPORT (get data) ******************
PROC GETDATA
set aspect RXDATA ON
x = 0
pause 3
waitdata:
while $RXDATA
comread DataIn 1
strcat linein[x] DataIn
if strcmp DataIn "`r"
;termwrites LineIn[x]
++x
if x > 599
termwrites "`r`n USER INFO: Overflow in ARRAY LineIn`r`n"
x = 100
endif
endif
endwhile
if x == 0
goto waitdata
endif
if NOT strcmp datain ";"
goto waitdata
endif
set aspect RXDATA OFF
termwrites "."
endproc

proc check_carrier
if $CARRIER == 0
usermsg "You need to be Logged into the DACS to use this Script."
exit
endif
endproc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top