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
Summary of Contents for EMG 7500
Page 100: ...7 Networking EMG Edge Management Gateway User Guide 100 Figure 7 5 Network Wireless Settings ...
Page 353: ...15 Maintenance EMG Edge Management Gateway User Guide 353 Figure 15 12 About EMG ...
Page 474: ...EMG Edge Management Gateway User Guide 474 Figure E 3 EU Declaration of Conformity ...
Page 475: ...EMG Edge Management Gateway User Guide 475 Figure E 4 EU Declaration of Conformity continued ...