EasyManua.ls Logo

Lantronix EMG Series

Lantronix EMG Series
482 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
12: Scripts
EMG™ Edge Management Gateway User Guide 261
Example Scripts
Interface Script—Monitor Port on page 261
Batch Script—EMG CLI on page 264
Expect Custom Script - EMG CLI Session on page 266
Expect Custom Script - EMG Device Port Session on page 268
Expect Custom Script - EMG Device Port Session on page 270
Python Custom Script - EMG CLI Session on page 272
Python Custom Script - EMG CLI Session on page 274
Tcl Custom Script - EMG CLI Session on page 278
Interface Script—Monitor Port
The Monitor Port (Monport) script connects directly to a device port by logging into the EMG
port,
gets the device hostname, loops a couple of times to get port interface statistics, and logs out. The
following is the script:
set monPort 7
set monTime 5
set sleepTime 2
set prompt ">"
set login "sysadmin"
set pwd "PASS"
#Send CR to echo prompt
send "\r"
sleep $sleepTime
#Log in or check for Command Prompt
expect {
#Did not capture "login" or Command Prompt
timeout { send_user "Time out login......\r\n"; return }
#Got login prompt
"login" {
send_user "Logging in....\r\n"
send "$login\r"
expect {
timeout { send_user "Time out waiting for pwd
prompt......\r\n"; return }
#Got password prompt
"password" {
#Send Password
send "$pwd\r"
expect {
timeout { send_user "Time out waiting for prompt......\r\n";
return }
$prompt {}
}
}
}
}
#Already Logged in got Command Prompt

Table of Contents

Other manuals for Lantronix EMG Series

Related product manuals