04-05-2010 09:36 AM
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: support@mydomainhere.com
e-mail Subject: {hostname} DS0 Out Of Service, Busyout from Remote - Slot: 6, Port: 0
e-mail Body:
The output of the following commands:
Current system variables:
event manager policy sl_ip_sla_report.tcl
event manager environment _mail_smtp relay.mydomainhere.com
event manager environment _mail_rcpt support@mydomainhere.com
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
04-05-2010 10:12 PM
The ability for an EEM policy to process traps sent by the device itself is very new. What version of IOS are you running?
--
Please support CSC Helps Haiti
https://supportforums.cisco.com/docs/DOC-8895
https://supportforums.cisco.com
04-06-2010 06:39 AM
Hey Joe,
We are running 12.4(24)T2 software with the IP Plus feature set...
-Doug
04-06-2010 08:18 AM
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.
04-06-2010 08:45 AM
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
04-06-2010 09:14 AM
Yep. What is the specific syslog you will get?
04-07-2010 11:04 AM
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
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: