bittergourd
Technical User
Hi, I am writing a simple script that logs into a machine one after another to collect logs. Each machine has an IP address and a associated machine name (eg. 100.2.33.4, Machine1). The script written so far allows me to perform the login action, but I would like to automatically name each captured file with the machine name. Please advise on how I can modify the script. See below for what I have done so far. For simplicity, only 2 machines are shown below.
proc main
integer counter
string IPaddArray[2]
IPaddArray[0]= "100.3.95.5"
IPaddArray[1]= "100.3.95.9"
for counter = 0 upto 1
capture on
transmit "telnet "
transmit IPaddArray[counter]
waitfor "Login:"
transmit "myloginID"
waitfor "Password:"
transmit "mypassword"
waitfor "->"
transmit "logdump^M"
waitfor "->"
transmit "logout"
capture off
endfor
endproc
Also, what would be the best way to do it if I intend to use a separate file for the connection directory (of IPadds and names) and have this script call for it?
Thanks in advance for your help!
proc main
integer counter
string IPaddArray[2]
IPaddArray[0]= "100.3.95.5"
IPaddArray[1]= "100.3.95.9"
for counter = 0 upto 1
capture on
transmit "telnet "
transmit IPaddArray[counter]
waitfor "Login:"
transmit "myloginID"
waitfor "Password:"
transmit "mypassword"
waitfor "->"
transmit "logdump^M"
waitfor "->"
transmit "logout"
capture off
endfor
endproc
Also, what would be the best way to do it if I intend to use a separate file for the connection directory (of IPadds and names) and have this script call for it?
Thanks in advance for your help!