Created
April 26, 2015 07:01
-
-
Save hafthanhf/2122b3365ac84577dc71 to your computer and use it in GitHub Desktop.
display bandwidth information on a network port
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect | |
#!/bin/bash | |
## TomDV | |
## http://blog.penumbra.be/2010/02/expect-scripts-backup-cisco-config/ | |
# ---------------- configuration ---------------- # | |
#set ciscoHCM 10.255.0.222 | |
#set ciscoIPLC 10.255.0.251 | |
#set huaweiTKC 10.255.0.233 | |
#set ciscoHCM2 10.223.0.250 | |
#set cisco02 10.255.0.250 | |
set user digicom_noc | |
set pass "*********" | |
set hostname [lindex $argv 0] | |
set port [lindex $argv 1] | |
#set config | |
set timeout 60 | |
# -------------- do not edit below -------------- # | |
#get data from remote devices | |
spawn telnet $hostname | |
expect "Username:" | |
send "$user\n" | |
expect "Password:" | |
send "$pass\n" | |
expect "#" | |
send "show interface $port descr \n" | |
expect "#" | |
send "show interface $port | inc minute\n" | |
expect "#" | |
send "exit\n" | |
exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment