05-19-2010 02:50 PM
Hello
I have a script that reboots router if a ping (IP SLA) ha failed and the only issue with this is that if the site that I am pinging goes down, or the service provider goes down, the router will get cought in "reboot loop". Is there a way to add a condition saying that if the router has been up for X number if hours do not reboot or process the script.
Here is my script below.
Many thanks in advance
Jeff
ip sla 100
icmp-echo 192.168.1.25 source-interface Loopback0
timeout 500
frequency 10
ip sla schedule 100 life forever start-time now
!
event manager applet PingHasFailed
event track 100 state down
action 1.0 syslog msg "Ping has failed, reloading the router"
action 2.0 reload
解決済! 解決策の投稿を見る。
05-19-2010 04:10 PM
Sure, you can add such a condition, but I'm not sure how checking for hours of uptime will prevent the loop. That is, if the router reloads (for any reason), and when it comes back, the host in question is not reachable, then the router will still continue to reload. What you might want instead is this to use nesting. For example:
event manager environment quote "
!
event manager applet track-up
event track 100 state up
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "event manager applet track-down"
action 4.0 cli command "event track 100 state down"
action 5.0 cli command "action 1.0 syslog msg $quote Ping has failed, reloading the router$quote"
action 6.0 cli command "action 2.0 reload"
action 7.0 cli command "end"
!
event manager applet remove-track-down
event syslog pattern "SYS-5-RESTART"
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "no event manager applet track-down"
action 4.0 cli command "end"
Using these policies, you will only see the reload if the track had been up. On a reload, the track-down applet (if it still exists) will be removed.
05-19-2010 03:57 PM
What version of IOS are you running?
05-19-2010 04:00 PM
Version 15.1(1)T
05-19-2010 04:10 PM
Sure, you can add such a condition, but I'm not sure how checking for hours of uptime will prevent the loop. That is, if the router reloads (for any reason), and when it comes back, the host in question is not reachable, then the router will still continue to reload. What you might want instead is this to use nesting. For example:
event manager environment quote "
!
event manager applet track-up
event track 100 state up
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "event manager applet track-down"
action 4.0 cli command "event track 100 state down"
action 5.0 cli command "action 1.0 syslog msg $quote Ping has failed, reloading the router$quote"
action 6.0 cli command "action 2.0 reload"
action 7.0 cli command "end"
!
event manager applet remove-track-down
event syslog pattern "SYS-5-RESTART"
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "no event manager applet track-down"
action 4.0 cli command "end"
Using these policies, you will only see the reload if the track had been up. On a reload, the track-down applet (if it still exists) will be removed.
エキスパートの回答、ステップバイステップガイド、最新のトピックなどお気に入りのアイデアを見つけたら、あとで参照できるように保存しましょう。
コミュニティは初めてですか?これらのヒントを活用してスタートしましょう。 コミュニティの活用方法 新メンバーガイド