cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1880
Views
0
Helpful
3
Replies

Help Creating Syslog Message that Uses Router Hostname

Paul Wishart
Level 1
Level 1

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 ..."

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

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"

View solution in original post

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

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"

Joe, thanks so much for your reply.  I will try this and get back to you.

Hell yeah!  It worked!  Thanks Joe!

Review Cisco Networking for a $25 gift card