Cisco: EEM TCL
### Config # set script_version "0.2" set ip 10.10.10.33 # ### Einde config # Syslog bericht om aan te geven dat we zijn gestart set syslog [open "syslog: " w+] puts $syslog "DSL-STATE: Line is down, waiting for 3g backup connection" close $syslog set link 0 # Zolang de link plat is, blijven pingen while { $link == 0 } { # Wanneer we 3x een ! krijgen is de link betrouwbaar genoeg if { [regexp "(!!!)" [exec "ping $ip timeout 1" ]] } { set link 1 set syslog [open "syslog: " w+] puts $syslog "DSL-STATE: Backup connection established" close $syslog # Anders blijven we pingen en melden we de voortgang } else { set syslog [open "syslog: " w+] puts $syslog "DSL-STATE: Link is still down" close $syslog } } # Tenslotte melden we dat de backup verbinding in de lucht is set syslog [open "syslog: " w+] puts $syslog "DSL-STATE: DSL down, running on 3g backup (script v $script_version)" close $syslog
event manager applet track-dsl authorization bypass event track 12 state down action 1.0 cli command "enable" action 1.1 cli command "tclsh flash:/dsl-state.tcl"
TestRTR#conf t Enter configuration commands, one per line. End with CNTL/Z. TestRTR(config)#int lo99 TestRTR(config-if)#shut TestRTR(config-if)# *Apr 24 08:39:08.063: %TRACKING-5-STATE: 12 ip sla 12 state Up->Down *Apr 24 08:39:08.083: DSL-STATE: Line is down, waiting for 3g backup connection *Apr 24 08:39:08.091: %LINK-5-CHANGED: Interface Loopback99, changed state to administratively down *Apr 24 08:39:09.091: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback99, changed state to down *Apr 24 08:39:13.087: DSL-STATE: Link is still down *Apr 24 08:39:18.091: DSL-STATE: Link is still down TestRTR(config-if)#no shut TestRTR(config-if)# *Apr 24 08:39:23.095: DSL-STATE: Link is still down *Apr 24 08:39:25.675: %LINK-3-UPDOWN: Interface Loopback99, changed state to up *Apr 24 08:39:26.675: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback99, changed state to up *Apr 24 08:39:27.099: DSL-STATE: Link is still down *Apr 24 08:39:27.103: DSL-STATE: Backup connection established *Apr 24 08:39:27.107: DSL-STATE: DSL down, running on 3g backup (script v 0.2)