LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   TeraTerm (https://www.linuxquestions.org/questions/linux-newbie-8/teraterm-4175608378/)

mokan 06-22-2017 03:47 AM

TeraTerm
 
Hi there to any teraterm users im an intern and very new to his software. I need to get the file size of the log through command?? Any guidance and between does anyone have any idea when my macro run for router the logs collected are not complete and differ length from few testings. Mind a sharing if why this happens?

pan64 06-22-2017 04:04 AM

I don't really understand what do you really need. How is it related to TeraTerm at all?
can you please give us more details, examples....

mokan 06-22-2017 04:08 AM

Macro
 
Quote:

; ***Macro Template to collect Router log****************

; Get current directory
getdir curdir
groupmatchstr1=curdir
groupmatchstr2="\Logs"
strjoin strvar "" 2
changedir strvar
setdir strvar

CommandPrompt = '#'
inputbox 'Please enter ZoneID:' 'Zone ID'
ZoneID = inputstr
;inputbox 'Please enter SiteID:' 'Site ID'
;SiteID = inputstr
SiteID = ''
inputbox 'Please enter Router name with Router ID:' 'Router Name'
RouterName = inputstr
toupper RouterName RouterName

groupmatchstr1=ZoneID
groupmatchstr2=SiteID
groupmatchstr3=RouterName
groupmatchstr4=".log"
strjoin logfile "" 4
;logfile=strvar

groupmatchstr1= logfile
groupmatchstr2= ".tmp"
strjoin tmp_file "" 2
;tmp_file = strvar

;start logging
logopen logfile 0 0
gettime curtime "------------------------------------%Y-%m-%d %H:%M:%S----------------------------------"
logwrite curtime

;setsync 0

sendln

wait CommandPrompt
sendln 'set terminal length 0'

wait CommandPrompt
sendln 'set sl=n'

wait CommandPrompt
flushrecv
sendln 'sh date'

wait CommandPrompt
flushrecv
sendln 'sh timezone'

wait CommandPrompt
flushrecv
sendln 'sh ' 'sysinfo'

wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'ip allroute'

mpause 500
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'ntp status'

wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'sys sm'

mpause 500
wait CommandPrompt
flushrecv
sendln 'sh version'

wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'sys soft a:/primary/boot.ppc'

wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'sys soft a:/secondar/boot.ppc'

wait CommandPrompt
flushrecv
sendln 'sf 9'

wait 'Press Y to clear boot statistics (any other key to cancel) :'
flushrecv
sendln ''

; to add cat partial dump and audit log

; Go to Audit log folder
wait CommandPrompt
flushrecv
sendln 'cd ' "a:/audlog"

; List to see audit log file name
wait CommandPrompt
flushrecv
sendln 'df'
pause 1

; parse audit log file name
strdim aud_tmp 999
i=0
filecopy logfile tmp_file
fileopen fhandle tmp_file 0
while 1
filereadln fhandle line
if result=1 then
break
endif
;messagebox line 'temp.log'
strscan line 'AUD'
if result > 0 then
strcopy line 1 6 aud_tmp[i]
;messagebox aud_tmp[i] 'audlog'
i=i+1
result=0
endif
endwhile
fileclose fhandle
filedelete tmp_file

; Cat audit log
groupmatchstr1="cat "
groupmatchstr3=".log"
j=0
strdim aud 999
if i>0 then
for j 0 i-1
groupmatchstr2=aud_tmp[j]
strjoin aud[j] "" 3
sendln aud[j]
pause 1
next
endif

wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'audit locallog'

pause 1
wait CommandPrompt
flushrecv
sendln 'cd a:/'

; Cat Partial Dump 1
wait CommandPrompt
flushrecv
sendln 'cat ' 'partial1.dmp'

; Cat Partial Dump 2
pause 2
wait CommandPrompt
flushrecv
sendln 'cat ' 'partial2.dmp'

; Cat Partial Dump 3
pause 2
wait CommandPrompt
flushrecv
sendln 'cat ' 'partial3.dmp'

pause 2
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'ip netaddr'

pause 5
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'ip addr'

pause 10
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'sys stat ' '-' 'port'

mpause 500
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'sys stat ' '-' 'path'

mpause 500
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'path config'

mpause 500
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'po conf'

mpause 500
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'po queuepri'

mpause 500
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'po QueueStatistics'

mpause 500
wait CommandPrompt
flushrecv
sendln 'su ' 'mu'

mpause 500
wait CommandPrompt
flushrecv
sendln 'su ' 'drt'

mpause 500
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'pa ma'

mpause 500
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'ccgw conf'

mpause 500
wait CommandPrompt
flushrecv
sendln 'cd ' 'a:/primary'

wait CommandPrompt
sendln 'cat config.log'

pause 5
wait CommandPrompt
flushrecv
sendln 'cat capture.cfg'

pause 5
wait CommandPrompt
flushrecv
sendln 'cat boot.cfg'

pause 5
wait CommandPrompt
flushrecv
sendln 'cat staticrp.cfg'

mpause 300
wait CommandPrompt
flushrecv
sendln 'cat xgsn.cfg'

wait CommandPrompt
flushrecv
sendln 'cd ' 'a:/secondar'

wait CommandPrompt
flushrecv
sendln 'cat config.log'

pause 5
wait CommandPrompt
flushrecv
sendln 'cat capture.cfg'

pause 5
wait CommandPrompt
flushrecv
sendln 'cat boot.cfg'

pause 5
wait CommandPrompt
flushrecv
sendln 'cat staticrp.cfg'

mpause 300
wait CommandPrompt
flushrecv
sendln 'cat xgsn.cfg'

mpause 300
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'vrrp conf'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'NAT conf'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'NAT sessions'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'pim conf'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'pim mcastgrouplim'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'pim mcastgrouplimrp'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'pim rps'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'pim rt'

pause 2
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'pim rt long'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'pim staticrp'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'pim staticrp summary'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'pim neigh'

mpause 500
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'mip igmp'

mpause 500
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'mip fc'

pause 2
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'mip vrrp'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'mip rpf 10.1.253.9'

mpause 300
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'mip rpf 10.1.253.17'

mpause 300
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'fr dlcistat'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'ospf ns'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'pa connst'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'fr mfrdispstat'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'fr QueueStatistics'

mpause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'cwr status'

mpause 300
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'cwr conf'

mpause 300
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'pa WanCounters'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'pa conncounters'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'fr MfrAvcQueS'

pause 1
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'fr VcQueStats 16'

pause 5
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'fr VcQueStats 17'

pause 5
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'sys stat ' '-' 'fr'

pause 5
wait CommandPrompt
flushrecv
sendln 'sh lmi'

mpause 5
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'ip bfds'

mpause 5
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'SCH bfdevent'

pause 5
wait CommandPrompt
flushrecv
sendln 'sh ' '-' 'ipdv STAT

pause 5
wait CommandPrompt
sendln 'exit'

logclose
Above is the macro i run to collect logs from router through tera term. When i check through the logs is not complete it stops halfway.


All times are GMT -5. The time now is 07:18 PM.