12: Scripts
EMG™ Edge Management Gateway User Guide
278
Tcl Custom Script - EMG CLI Session
An example of a Tcl Custom Script that interacts with a CLI session:
#! tcl
# Script to get the current internal temperature of the EMG
# Accepts one optional command line parameter for location
set emgTemp "unknown"
set location ""
# Are there any command line parameters?
if {$argc > 0} {
set location [lindex $argv 0]
}
set now [clock seconds]
set date [clock format $now -format {%D %R}]
if {$argc > 0} {
puts "Internal temperature of the $location EMG at $date"
} else {
puts "Internal temperature of the EMG at $date"
}
set io [open "| clisession -U sysadmin" r+]
set loggedIn false
while {! $loggedIn} {
set len [gets $io line]
if {[string first "Invalid local user" $line] != -1} {
puts "Invalid local user passed to clisession"
break
}
if {[string first "For a list of commands" $line] != -1} {
puts $io "\n"
flush $io
}
if {[string first ">" $line] != -1} {
set loggedIn true
}
}
if {! $loggedIn} {
exit 1
}
puts $io "show temp"
flush $io
set gotTemp false
while {! $gotTemp} {
set len [gets $io line]
if {[string first "Current Internal Temperature" $line] != -1} {
set emgTemp [string range $line [expr {[string first ":" $line] +
1}] end]
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 ...