cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
415
Views
0
Helpful
1
Replies

Cisco EEM Applet Assistance

MB-Net
Level 1
Level 1

I am currently trying to write a manual applet that will get port information from the syslog msg and then interface into that port to do several commands.

When using even triggers, such as (event syslog pattern "xxxxx") it works fine. When I use the event none so that I can call it manually at anytime, I am not able to get the syntax right to look for the appropriate pattern.

My test applet that I am using to get the basics is as follows:

event manager applet test authorization bypass
 event none
 action 0010 regexp "(No Response from Client) on Interface ([A-Za-z0-9\/]+)" "$_syslog_msg" match dot1xport
 action 0020 if $_regexp_result eq "0"
 action 0030 puts "Port is $dot1xport"
 action 0040 end
exit

When I run it and look at the log, it states that it cant locate the syslog_msg variable. I believe thats because there is no syslog_msg variable to reference since that is only to be used via  trigger. So my question is, is there a way to reference this port pattern via the syslog via manual applet?

1 Reply 1

Hello,

the regexp runs against some earlier output, which is not referenced in the applet. Try the below (this assumes the "No response from Client' actually is a syslog entry:

event manager applet test authorization bypass
event none
action 1.0 cli command "enable"
action 2.0 cli command "show log | inc No response from Client"
action 3.0 regexp "(No Response from Client) on Interface ([A-Za-z0-9\/]+)" "$_syslog_msg" match dot1xport
action 4.0 if $_regexp_result eq "0"
action 5.0 puts "Port is $dot1xport"
action 6.0 end