【資料名稱】:HIT 跑告警的MARCO
【資料作者】:menghen
【資料日期】:2012-10-23
【資料語言】:中文
【資料格式】:DOC
【資料目錄和簡介】:
/*
============================================================================
Name : ALARMSTATISTICS for NOKIA BSC
Date : Mar 25 2010
Author: Hanqifang
Email:
hanqifang@ha.chinamobile.com
Copyright: Your copyright notice
============================================================================
*/
integer table,table0,table1,table2,table3,table4;
integer cell=2,row=2,hang=2,i,j,a,c,rownb;
string line,date,PCTime,ne_name;
string line0,con_nb_aa,con_nb_a[]={""},con_nb_c[]={""},nr_number,alarmtime,canceltime[]={""},
alarmclass,state,unit,alarmnumber,message;
string con_nba,con_nbc;
string bcf,bts,type,con_nb,btsname,message0="",message1="",message2="";
function main()
integer x[],n=3;
strings[];
table0=ddeconnect("excel","[告警統(tǒng)計.xls]網(wǎng)元列表");
table=ddeconnect("excel","[告警統(tǒng)計.xls]BSC感知類歷史告警");
table1=ddeconnect("excel","[告警統(tǒng)計.xls]BSC感知類告警統(tǒng)計");
table2=ddeconnect("excel","[告警統(tǒng)計.xls]BTS當(dāng)前告警");
table3=ddeconnect("excel","[告警統(tǒng)計.xls]BTS歷史告警");
table4=ddeconnect("excel","[告警統(tǒng)計.xls]BTS歷史告警統(tǒng)計");
if(table==0 OR table0==0 OR table1==0 OR table2==0 OR table3==0 OR table4==0 )
pause(30,"請打開告警統(tǒng)計列表.xls!");
endif
deviceopen("ZZBSC");
x[1]=0; x[2]=0; x[3]=1; x[4]=0;
s[1]="提取BSC感知類歷史告警";
s[2]="提取BTS指定歷史告警";
s[3]="提取BTS當(dāng)前所有告警";
if(askselection(s,x,n,RADIO,SINGLE,"請選擇您需要的操作:")==CANCEL)
abort(messagebox("取消操作,程序退出!"));
endif
if(x[3]==1) ZEOL(); endif
endfunction
string function getname(integer table_inf,integer x,integer y)
string str1,str2;
str1=dderequest(table_inf,strprint("R%dC%d",x,y));
strscan(str1,"%s",str2);
return str2;
endfunction
function connect_ne(string ne_name)
question(1,"telnetd>");
answer(1,strprint("%s\r",ne_name));
tx("ZZZZ;");
endfunction
/****************提取BTS當(dāng)前告警*******************/
function ZEOL()
PCTime = getpctime(1);
ddedata(table2,strprint("R1C1",row),"NE NAME");
ddedata(table2,strprint("R1C2",row),"CLS");
ddedata(table2,strprint("R1C3",row),"STATE");
ddedata(table2,strprint("R1C4",row),"CON NUM");
ddedata(table2,strprint("R1C5",row),"NR");
ddedata(table2,strprint("R1C6",row),"TYPE");
ddedata(table2,strprint("R1C7",row),"BCF");
ddedata(table2,strprint("R1C8",row),"BTS");
ddedata(table2,strprint("R1C9",row),"BTSNAME");
ddedata(table2,strprint("R1C10",row),"UNIT");
ddedata(table2,strprint("R1C11",row),"ALARMTIME");
ddedata(table2,strprint("R1C12",row),"MESSAGE0");
ddedata(table2,strprint("R1C13",row),"MESSAGE1");
ddedata(table2,strprint("R1C14",row),"MESSAGE2");
ne_name=getname(table0,cell,1);
while(ne_name<>"END")
connect_ne(ne_name);
hang=2;
nr_number=getname(table0,hang,2);
ZEOL:;
while(getline(line,"'BSC':14-16"))
strfetch(line,"25-32,35-42,45-53,56-80",bcf,bts,type,alarmtime);
type=strtrim(type,TRIM_LEADING_SPACE);
alarmtime=strtrim(alarmtime,TRIM_LEADING_SPACE);
getline(line,"'ALARM':5-9");
strfetch(line,"1-3,5-10,12-19,35-50",alarmclass,state,unit,btsname);
getline(line,"')':10-10");
strscan(line,"%s %s %*s",con_nb,alarmnumber);
con_nb=strreplace(con_nb, "(", "");
con_nb=strreplace(con_nb, ")", "");
strfetch(line,"12-80",message0);
message0=strtrim(message0,TRIM_TRAILING_SPACE);
getline(line);
message1=strtrim(line,TRIM_LEADING_SPACE);
getline(line);
message2=strtrim(line,TRIM_LEADING_SPACE);
ddedata(table2,strprint("R%dC1",row),ne_name);
ddedata(table2,strprint("R%dC2",row),alarmclass);
ddedata(table2,strprint("R%dC3",row),state);
ddedata(table2,strprint("R%dC4",row),con_nb);
ddedata(table2,strprint("R%dC5",row),alarmnumber);
ddedata(table2,strprint("R%dC6",row),type);
ddedata(table2,strprint("R%dC7",row),bcf);
ddedata(table2,strprint("R%dC8",row),bts);
ddedata(table2,strprint("R%dC9",row),btsname);
ddedata(table2,strprint("R%dC10",row),unit);
ddedata(table2,strprint("R%dC11",row),alarmtime);
ddedata(table2,strprint("R%dC12",row),message0);
ddedata(table2,strprint("R%dC13",row),message1);
ddedata(table2,strprint("R%dC14",row),message2);
row++;
endwhile
cell=cell+1;
ne_name=getname(table0,cell,1);
endwhile
endfunction
/**************************************************/