Cisco IOS EEM: Monitor ISDN Layer 2 Status

Posted by
Facebooktwitterredditpinterestlinkedintumblr

Here are the steps on how to set it up.

1. Configure the recipient’s email address. Replace this value [recipient’s email address] with valid email address.

event manager environment _email_to [recipient’s email address]

2. Configure the email server IP address. Replace this value [email server IP address] with valid email server IP address.

event manager environment _email_server [email server IP address]

3. Configure the sender’s email address. Replace this value [sender’s email address] with valid email address.

event manager environment _email_from [sender’s email address]

4. Configure an account for EEM. Replace these values [username that has admin privilege], [username] and [password] with valid ones.

username [username] privilege 15 password [password]
event manager session cli username [username that has admin privilege]

5. Configure an EEM applet. Replace this value [applet name] with any name you like.

event manager applet [applet name]

6. Configure a pattern to match for the EEM applet to be triggered. Replace this value [Syslog pattern[ with any pattern you like to match.

event syslog pattern [Syslog pattern]

7. Configure an action based on step 6. Replace these values [put any subject you like] and [put any information under the body of the email] with informative details.

action 1.0 mail server “$_email_server” to “$_email_to” from “$_email_from” subject [put any subject you like] body [put any information under the body of the email]

Example of EEM configuration that monitors ISDN PRI

event manager environment _email_to [email protected]
!
event manager environment _email_server 142.100.64.11
!
event manager environment _email_from [email protected]
!
Username rejohn privilege 15 password rejohn
event manager session cli username “rejohn”
!
event manager applet ISDN_L2_Down
event syslog pattern “%ISDN-6-LAYER2DOWN: Layer 2 for Interface”
action 1.0 mail server “$_email_server” to “$_email_to” from “$_email_from” subject “ISDN E1 PRI Down” body “Auto generated message from the router. Syslog message: $_syslog_msg”
exit
!

EEM in action using the above configuration

1. Check the ISDN PRI status.

HQ#show isdn status
Global ISDN Switchtype = primary-ni

%Q.931 is backhauled to CCM MANAGER 0x0003 on DSL 0. Layer 3 output may not apply

ISDN Serial0/0/0:23 interface
dsl 0, interface ISDN Switchtype = primary-ni
L2 Protocol = Q.921 0x0000 L3 Protocol(s) = CCM MANAGER 0x0003
Layer 1 Status:
ACTIVE
Layer 2 Status:
TEI = 0, Ces = 1, SAPI = 0, State = MULTIPLE_FRAME_ESTABLISHED
Layer 3 Status:
0 Active Layer 3 Call(s)
Active dsl 0 CCBs = 0
The Free Channel Mask: 0x807FFFFF
Number of L2 Discards = 0, L2 Session ID = 251
Total Allocated ISDN CCBs = 0
HQ#

2. Enable debug Event Manager Action.

HQ#debug event manager action mail
Debug EEM action mail debugging is on

3. To simulate an ISDN outage I shut down the ISDN interface on the other side of the network.

Sep 1 07:30:24.388: %ISDN-6-LAYER2DOWN: Layer 2 for Interface Se0/0/0:23, TEI 0 changed to down < - - EEM detects this SYSLOG event HQ# !!!!! Debug output says that the EEM is processing the email notification. Sep 1 07:30:24.396: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_connect_attempt: 1 Sep 1 07:30:24.404: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_read 220 alpha.rracuares.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Thu, 1 Sep 2011 17:30:24 +1000 Sep 1 07:30:24.404: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write HELO HQ.domain.com Sep 1 07:30:24.940: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_read 250 alpha.rracuares.com Hello [142.100.64.254] Sep 1 07:30:24.940: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write MAIL FROM:
HQ#
Sep 1 07:30:25.488: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_read 250 2.1.0 [email protected]….Sender OK

Sep 1 07:30:25.488: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write RCPT TO:
Sep 1 07:30:26.040: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_read 250 2.1.5
[email protected]
Sep 1 07:30:26.040: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write DATA
Sep 1 07:30:26.488: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_read 354 Start mail input; end with .
Sep 1 07:30:26.488: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write Date: Thu, 01 Sep 2011 00:30:26 -0700
Sep 1 07:30:26.492: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write Message-ID: <[email protected]>
Sep 1 07:30:26.492: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write From: [email protected]
Sep 1 07:30:26.492: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write To:
HQ# [email protected]
Sep 1 07:30:26.492: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write Subject: ISDN E1 PRI Down
Sep 1 07:30:26.492: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write
Sep 1 07:30:26.492: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write Auto generated message from the router. Syslog message:
Sep 1 07:30:26.492: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write Sep 1 07:30:24.388: %ISDN-6-LAYER2DOWN: Layer 2 for Interface Se0/0/0:23, TEI 0 changed to down
Sep 1 07:30:26.492: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write .
Sep 1 07:30:26.708: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_read 250 2.6.0 <[email protected]> Queued mail for delivery

Sep 1 07:30:26.708: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_write QUIT
Sep 1 07:30:27.364: %HA_EM-6-LOG: ISDN_L2_Down : DEBUG(smtp_lib) : smtp_read 221 2.0.0 alpha.rracuares.com
Service closing transmission channel

4. After few seconds I got the email notification.

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*