Want to Develop EEM/TcL e-mail notification for ISDN busy-out conditions

Unanswered Question
Apr 5th, 2010

Folks,

I currently have a TcL script that watches for IP SLA syslog messages, and sends out an e-mail when they occur.

I now want to watch for ISDN busyout SNMP messages, and send an e-mail when that issue occurs.  We are open to either expanding the current TcL script, or creating a new one based upon your recommendations.

Here is a partial output of the trap we would want to key on:

Summary : DS0 Out Of Service, Busyout from Remote  ( Slot: 6, Port: 0, Channel: 1 )

Event ID : SNMPTRAP-cisco-CISCO-POP-MGMT-MIB-cpmDS0BusyoutNotification

Whenever that specific Event ID occurs, we would like to send an e-mail, based upon the slot and port indicated in the SNMP Summary field:

e-mail Sender: {hostname}

e-mail Recipient: [email protected]

e-mail Subject: {hostname} DS0 Out Of Service, Busyout from Remote - Slot: 6, Port: 0

e-mail Body:

The output of the following commands:

  • show controllers t1 6/0
  • show isdn service serial 6/0:23

Current system variables:

event manager policy sl_ip_sla_report.tcl
event manager environment _mail_smtp relay.mydomainhere.com
event manager environment _mail_rcpt [email protected]

event manager environment _mail_domain mydomainhere.com
event manager environment _email_src_intf Loopback0
event manager directory user policy "flash:/policies"

Current TcL script:

::cisco::eem::event_register_syslog pattern "RTT-3-IPSLATHRESHOLD: IP SLA.*[0-9]+.* Threshold (Cleared|Occurred) for timeout"

namespace import ::cisco::eem::*
namespace import ::cisco::lib::*

array set _sinfo [sys_reqinfo_routername]
set _info_routername $_sinfo(routername)

if [catch {cli_open} result] {
    error $result $errorInfo
} else {
    array set cli1 $result
}

array set arr_einfo [event_reqinfo]
set msg $arr_einfo(msg)

if { ! [regexp {RTT-3-IPSLATHRESHOLD: IP SLA.*\(([0-9]+)\).* Threshold (Cleared|Occurred) for timeout} $msg -> collector type] } {
    action_syslog msg "Failed to find collector ID in syslog"
    exit 1
}

if [catch {cli_exec $cli1(fd) "show ip sla statistics $collector"} iplsa_stat] {
    error $ipsla_stat $errorInfo
}

set stat {is down}
if { $type == "Cleared" } {
    set stat {has been restored}
}

if { [catch {cli_exec $cli1(fd) "show ip sla conf $collector"} _cli_result] } {
    error $_cli_result $errorInfo
}

set other_server {Unknown}
if { [regexp {Target address: ([0-9\.]+)} $_cli_result -> target_ip] } {
    regsub -all {\.} $target_ip {_} varname
    if { [info exists hostname_${varname}] } {
        set other_server [expr "\$hostname_$varname"]
     } else {
         set other_server $target_ip
     }
}

set mail_pre "Mailservername: $_mail_smtp\n"
append mail_pre "From: $_info_routername@$_mail_domain\n"
append mail_pre "To: $_mail_rcpt\n"
append mail_pre
append mail_pre "Subject: IP SLA alert - $_info_routername connectivity to $other_server $stat\n\n"
append mail_pre "$ipsla_stat\n\n"
set mail_msg [uplevel #0 [list subst -nobackslashes -nocommands $mail_pre]]
if [catch {smtp_send_email $mail_msg} result] {
    error $result $errorInfo
}

if [catch {cli_exec $cli1(fd) "exit"} _cli_result] {
    error $_cli_result $errorInfo
}


# Close open cli before exit.
if [catch {cli_close $cli1(fd) $cli1(tty_id)} result] {
    error $result $errorInfo
}

Please let me know if you need any additional information.

Regards,

-Doug

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Doug Boreham Tue, 04/06/2010 - 06:39

Hey Joe,

We are running 12.4(24)T2 software with the IP Plus feature set...

-Doug

Joe Clarke Tue, 04/06/2010 - 08:18

The ability to intercept outgoing SNMP traps was not added until 15.0.  Is there some other way you can determine if a channel is busied out?  Perhaps a show command can be run periodically, and parsed to determine line state.

Doug Boreham Tue, 04/06/2010 - 08:45

Joe,

I can change my trap logging level from warnings to informational, which would create a syslog message in addition to the SNMP trap.

This would allow us to key off the syslog entry using the existing code, correct?

-Doug

Doug Boreham Wed, 04/07/2010 - 11:04

Joe,

We are now logging informational SNMP traps.  We will watch for the specific busyout messages and will post them once they have been identified.

Regards,

-Doug

Actions

This Discussion