cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
455
Views
0
Helpful
3
Replies
Highlighted
Beginner

EEM Monitor Port Status but exclude Certain ports

I am trying to write a script to monitor port states and give a bit of diagnostic info. However, I have found it necessary to exclude some ports that are regularly used. I need help determining how to filter the event log to ignore these ports. Any help will be much appreciated. 

 

event syslog pattern "%LINK-3-UPDOWN:" maxrun 60
action 1.0 regexp "GigabitEthernet([^,]+)" "$_syslog_msg" interface
action 1.1 cli command "enable"
action 1.2 wait 15
action 1.3 cli command "show int $interface status"
action 1.4 set _status "$_cli_result"
action 1.5 cli command "show mac address-table int $interface"
action 1.6 set _log1 "$_cli_result"
action 1.7 cli command "show logging | i %LINK-3-UPDOWN:"
action 1.8 set _log2 "$_cli_result"
action 1.9 cli command "show logging"
action 2.0 puts "$_cli_result"
action 2.1 set _body "$_status $_log1 $_log2 $_cli_result"
action 2.3 mail server "$_email_server" to "$_all_to_email" from "$_email_from" subject "$_hostname Port-State Change $interface" body "$_body" source-addr

 

#EEM #Scripting #automation

Everyone's tags (3)
3 REPLIES 3
Highlighted
VIP Mentor

Re: EEM Monitor Port Status but exclude Certain ports

What I understand your requirement here is, you looking to monitor the ports and send an email - not any action with EEM Script.

 

If you looking largescale, i would suggest sending all the logs sys logs server and filter based on the information you looking for.

 

if that is not the case give a buzz.

 

 

BB
*** Rate All Helpful Responses ***
Highlighted
Beginner

Re: EEM Monitor Port Status but exclude Certain ports


@balaji.bandi wrote:

What I understand your requirement here is, you looking to monitor the ports and send an email - not any action with EEM Script.

 

If you looking largescale, i would suggest sending all the logs sys logs server and filter based on the information you looking for.

 

if that is not the case give a buzz.

 

 


It is relatively small scale about 30 devices. I would love to filter/parse at the switch level without having the overhead of a logging server. The current script works great just can't filter so i am getting devices such as printers that loose connection when idle. So port-security takes care of those and is covered by a security script i have running. So no need to monitor them.

Highlighted
Hall of Fame Cisco Employee

Re: EEM Monitor Port Status but exclude Certain ports

Where do you want to do the filtering?  You're already going some here, so you can just extend that (i.e., the filter on GigabitEthernet).

CreatePlease to create content
Content for Community-Ad