Lantronix SLC 8000 Advanced Console Manager User Guide - Page 233
Example Scripts, Interface Script-Monitor Port
View all Lantronix SLC 8000 Advanced Console Manager manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 233 highlights
9: Device Ports Note: For CLI sessions, a local user name should be given For Device Port sessions, the $devicePort variable will be used by the SLC to connect the script to the appropriate Device Port. The -noecho flag may be passed to spawn command. Expect script - CLI session spawn clisession -U Expect script - Device Port session spawn portsession -p $devicePort Tcl script - CLI session set io [open "| clisession -U " r+] Tcl script - Device Port session set io [open "| portsession -p $devicePort" r+] Python script - CLI session subprocess.Popen(['clisession', '-U', ''], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) Python script - Device Port session subprocess.Popen(['portsession', '-p', devicePort], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 5. It is recommended that scripts that spawn clisession only be used with the set script runcli command (and not the connect script command), and that scripts that spawn portsession only be used with the connect script command (and not the set script runcli command). 6. The script cannot contain commands which spawn or fork other commands, read or write files on the SLC filesystem, or interrogate the SLC filesystem. The list of commands that are not allowed for Expect scripts includes "fork", "open", "exp_open", "exec", "system", "log_file", "pwd". 7. For scripts that return an exit code, the SLC will interpret an exit code of zero as a successful exit code, and any non-zero exit code as an error. Non-zero exit codes are displayed (at the CLI) or logged (for scripts that are run by the script scheduler). Example Scripts Interface Script-Monitor Port The Monitor Port (Monport) script connects directly to a device port by logging into the SLC 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 SLC™ 8000 Advanced Console Manager User Guide 233