06-27-2016 11:55 AM
We currently have an IP SLA tied to EEM scripts which work great for sending syslog messages for alerting purposes. However, I'd like for each router that sends a syslog to send its hostname using wildcards instead of the hostname specified. I am guessing some kind of pattern matching would do the trick, but I can't find any good documentation on it. This is what I currently have:
ip sla 1
icmp-echo 172.24.50.1 source-interface GigabitEthernet2
threshold 250
timeout 1000
frequency 5
ip sla schedule 1 life forever start-time now
!
event manager applet LAN_interface_Link_down
event syslog pattern "Interface GigabitEthernet2, changed state to down"
action 1 cli command "enable"
action 2 syslog priority informational msg " command LAN_interface_Link_down is running on C1-GrandView-PA-CSR1000-Recover ..."
action 3 wait 5
action 4 cli command "configure terminal"
action 5 cli command "interface range t3 -4"
action 6 cli command "shut"
action 7 cli command "end"
event manager applet LAN_interface_Link_up
event syslog pattern "Interface GigabitEthernet2, changed state to up"
action 1 cli command "enable"
action 2 cli command "configure terminal"
action 3 cli command "interface range t3 -4"
action 4 cli command "no shut"
action 5 cli command "end"
action 6 wait 15
action 7 syslog priority informational msg " command LAN_interface_Link_up is running on C1-GrandView-PA-CSR1000-Recover ..."
event manager applet Next_Hop_LAN_Unreachable
event track 10 state down maxrun 40
action 1 cli command "enable"
action 2 syslog priority informational msg " command Next_Hop_LAN_Unreachable is running on C1-GrandView-PA-CSR1000-Recover ..."
action 3 wait 5
action 4 cli command "configure terminal"
action 5 cli command "interface range t3 -4"
action 6 cli command "shut"
action 7 cli command "end"
event manager applet Next_Hop_LAN_Reachable
event track 10 state up maxrun 40
action 1 cli command "enable"
action 2 cli command "configure terminal"
action 3 cli command "interface range t3 -4"
action 4 cli command "no shut"
action 5 cli command "end"
action 6 wait 15
action 7 syslog priority informational msg " command Next_Hop_LAN_Reachable is running on C1-GrandView-PA-CSR1000-Recover ..."
Solved! Go to Solution.
07-01-2016 11:38 AM
You can use the info action to gather the hostname:
action 1.0 info type routername
action 2.0 syslog msg "My name is $_info_routername"
07-01-2016 11:38 AM
You can use the info action to gather the hostname:
action 1.0 info type routername
action 2.0 syslog msg "My name is $_info_routername"
07-08-2016 07:24 AM
Joe, thanks so much for your reply. I will try this and get back to you.
07-11-2016 08:32 AM
Hell yeah! It worked! Thanks Joe!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide