# $language = "VBScript"
# $interface = "1.0"
function Include(vbsFile)
set fs=createobject("scripting.filesystemobject")
set f=fs.opentextfile(vbsFile,1,false)
ExecuteGlobal f.ReadAll:f.close
end function
Function TelnetNeNcpaByDCN(NeIp,MasterNcpa)
sendcli "end "
sendcli "conf t "
sendcli "pmconfig "
sendcli "remoteushell disable "
sendcli "remoteushell enable "
sendcli "end "
sendcli "telnet "&NeIp&" 10001 dcn "
sendcli "zte"
sendcli "zte"
crt.sleep 1000
sendcli "login 1,"&MasterNcpa&",0,2"
crt.sleep 1000
crt.screen.send "zte"&vbCR
crt.sleep 1000
crt.screen.send "zte"&vbCR
end Function
Function TelnetNeBoardByDCN(NeIp,board)
sendcli "end "
sendcli "conf t "
sendcli "pmconfig "
sendcli "remoteushell disable "
sendcli "remoteushell enable "
sendcli "end "
sendcli "telnet "&NeIp&" 10001 dcn "
sendcli "zte"
sendcli "zte"
crt.sleep 1000
sendcli "login 1,"&board&",0,1"
crt.sleep 1000
crt.screen.send "zte"&vbCR
crt.sleep 1000
crt.screen.send "zte"&vbCR
end Function
Sub Main
Dim period,WTR,protectType
period=10
WTR=1
protectType=" 1:1 bidirectional receiving both"
Include "D:\myvb\zjcvb\Func_FL.vbs"
Include "D:\myvb\commonFunc-R1B14-以后不修改.vbs"
Include "D:\myvb\l3vpn my\upgrade\versiondate.vbs"
Include "D:\myvb\l3vpn my\test3.0 l3vpn - 100g\vbcrt\l3vpn\cliarray.vbs"
logfile1="suspen"
'-----------------------
'找到boardip
Dim DicObject
Set DicObject = CreateObject("Scripting.Dictionary")
Set DicObjectM = CreateObject("Scripting.Dictionary")
crt.screen.send "show processor | include -1/"&vbcr
temp1=crt.Screen.ReadString("!</","--More--","#", 20)
splitALL=split(temp1,VBcrlf,-1,1)
set fso = createObject("Scripting.FileSystemObject")
set resultFile = fso.opentextfile("E:\temp\Dadd"&crt.GetScriptTab.Caption&"cpu"&".txt",8,true)
i=0
date1=Now()
resultFile.write "第一次 记录"&date1&vbcrlf
for Each SplitCell in splitALL
REM j=0
if i<>0 and i<>ubound(splitALL) then
REM msgbox "SplitCell "&SplitCell
SplitCell = Replace(SplitCell, " ", " ")
SplitCell = Replace(SplitCell, " ", " ")
SplitCell = Replace(SplitCell, " ", " ")
REM msgbox "SplitCell "&SplitCell
SplitCellArray=split(SplitCell," ",-1,1)
REM for Each SplitCellValue in SplitCellArray
REM msgbox "SplitCellValue "&SplitCellValue
REM j=j+1
REM next
REM msgbox "j "&j
cnp =RegExpTest("\d{1,3}",SplitCellArray(2))
cnp=split(cnp,",",-1,1)
SplitCellArray(2)=cnp(0)
DicObject.Add SplitCellArray(0),SplitCellArray(2)
REM msgbox "I "&i
DicObjectM.Add SplitCellArray(0),SplitCellArray(7)
resultFile.write cli&" the "& SplitCellArray(0)&"cpu is "&SplitCellArray(2) &vbcrlf
resultFile.write cli&" the "& SplitCellArray(0)&"memory is "&SplitCellArray(7) &vbcrlf
REM msgbox "zi dian "&DicObject.item(SplitCellArray(0))
REM msgbox "memrory "&DicObjectM.item(SplitCellArray(0))
end if
i=i+1
REM msgbox "I "&i&"ubound(splitALL)-1 "&ubound(splitALL)-1
next
while true
Set DicObjectCT = CreateObject("Scripting.Dictionary")
Set DicObjectMT = CreateObject("Scripting.Dictionary")
crt.screen.send "show processor | include -1/"&vbcr
temp1=crt.Screen.ReadString("!</","--More--","#", 20)
splitALL=split(temp1,VBcrlf,-1,1)
i=0
for Each SplitCell in splitALL
REM j=0
if i<>0 and i<>ubound(splitALL) then
REM msgbox "SplitCell "&SplitCell
SplitCell = Replace(SplitCell, " ", " ")
SplitCell = Replace(SplitCell, " ", " ")
SplitCell = Replace(SplitCell, " ", " ")
REM msgbox "SplitCell "&SplitCell
SplitCellArray=split(SplitCell," ",-1,1)
REM for Each SplitCellValue in SplitCellArray
REM msgbox "SplitCellValue "&SplitCellValue
REM j=j+1
REM next
REM msgbox "j "&j
cnp =RegExpTest("\d{1,3}",SplitCellArray(2))
cnp=split(cnp,",",-1,1)
SplitCellArray(2)=cnp(0)
DicObjectCT.Add SplitCellArray(0),SplitCellArray(2)
REM msgbox "I "&i
DicObjectMT.Add SplitCellArray(0),SplitCellArray(7)
REM msgbox "zi dian "&DicObjectCT.item(SplitCellArray(0))
REM msgbox "memrory "&DicObjectMT.item(SplitCellArray(0))
if DicObjectCT.item(SplitCellArray(0)) >80 or DicObjectCT.item(SplitCellArray(0)) =100 then
date1=Now()
resultFile.write date1&vbcrlf
resultFile.write SplitCellArray(0)&" cpu is high"&vbcrlf
resultFile.write cli&" the "& SplitCellArray(0)&"cpu is "&SplitCellArray(2) &vbcrlf
end if
if DicObjectCT.item(SplitCellArray(0))-DicObject.item(SplitCellArray(0)) >15 then
resultFile.write date1&vbcrlf
resultFile.write SplitCellArray(0)&" cpu add to more"&DicObjectCT.item(SplitCellArray(0))-DicObject.item(SplitCellArray(0)) &vbcrlf
resultFile.write cli&" the "& SplitCellArray(0)&"cpu is "&SplitCellArray(2) &vbcrlf
end if
if DicObjectM.item(SplitCellArray(0))-DicObjectMT.item(SplitCellArray(0)) >0 then
resultFile.write date1&vbcrlf
resultFile.write SplitCellArray(0)&" MEMORY IS XIELOU "&DicObjectM.item(SplitCellArray(0))-DicObjectMT.item(SplitCellArray(0))&vbcrlf
resultFile.write cli&" the "& SplitCellArray(0)&"memory is "&SplitCellArray(7) &vbcrlf
end if
end if
i=i+1
REM msgbox "I "&i&"ubound(splitALL)-1 "&ubound(splitALL)-1
next
crt.sleep 10000
wend
REM temp1=RegExpTest("\/\d{1,3}\/",temp1)
REM temp1=RegExpTest("\d{1,3}",temp1)
REM msgbox "hebing"&temp1
REM cnp=split(temp,",",-1,1)
REM '-----------------------
REM '-----------------------
REM '找到dcnip
REM crt.screen.send "show dcnbaseinfo "&vbcr
REM temp=crt.screen.readstring("#",1000)
REM temp=RegExpTest("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}",temp)
REM cnp=split(temp,",",-1,1)
REM '-----------------------
REM '-----------------------
REM Message="输入单板"
REM Title = "input"
REM Default=temp1
REM board = InputBox(Message, Title, Default)
REM '-----------------------
REM NeIp=cnp(1)
REM call TelnetNeBoardByDCN(NeIp,board)
resultFile.close
end sub