ā07-03-2013 11:19 AM
Hello I very need help.
I need configure multiple event for syslog. If massage was attached to mail, was perfect.
Now in email not contain syslog message, this -> $syslog_msg contain nothing.
Script
::cisco::eem::event_register_syslog tag 1 pattern ".*LINK-3-UPDOWN.*FastEthernet1/15.*" occurs 1
::cisco::eem::event_register_syslog tag 2 pattern ".*%SYS-5-CONFIG_I: Configured from console.*" occurs 1
::cisco::eem::event_register_syslog tag
3 pattern ".*LINK-3-UPDOWN.*FastEthernet1/13.*" occurs 1::cisco::eem::trigger {
::cisco::eem::correlate event 1 or event 2
or event 3::cisco::eem::attribute tag 1 occurs 1
::cisco::eem::attribute tag 2 occurs 1
::cisco::eem::attribute tag
3 occurs 1}
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
array set arr_einfo [event_reqinfo]
set syslog_msg $arr_einfo(msg)
ć
action_syslog msg "Sending email to ServiceDesk"
set mail_pre "Mailservername:
user@userdomen:pass@smtp.server.com\n"append mail_pre "From:
user@userdomen\n"append mail_pre "To:
Servicedesk@domain\n"append mail_pre "Cc: \n"
append mail_pre "Subject:Router \n\n"
append mail_pre "
$syslog_msg\n\n"set mail_msg [uplevel #0 [list subst -nobackslashes -nocommands $mail_pre]]
if [catch {smtp_send_email $mail_msg} result] {
error $result $errorInfo
}
action_syslog msg "Email sent"
Solved! Go to Solution.
ā07-03-2013 10:04 PM
You need to use event_reqinfo_multi with multiple events:
array set marr_einfo [event_reqinfo_multi]
array set arr_einfo [list]
if { [info exists marr_einfo(1)] } {
array set arr_einfo $marr_einfo(1)
} elseif { [info exists marr_einfo(2)] } {
array set arr_einfo $marr_einfo(2)
} else {
array set arr_einfo $marr_einfo(3)
}
set syslog_msg $arr_einfo(msg)
ā07-03-2013 10:04 PM
You need to use event_reqinfo_multi with multiple events:
array set marr_einfo [event_reqinfo_multi]
array set arr_einfo [list]
if { [info exists marr_einfo(1)] } {
array set arr_einfo $marr_einfo(1)
} elseif { [info exists marr_einfo(2)] } {
array set arr_einfo $marr_einfo(2)
} else {
array set arr_einfo $marr_einfo(3)
}
set syslog_msg $arr_einfo(msg)
ā07-04-2013 01:03 AM
Hello Joseph. Thank you it is work.
ā11-08-2018 10:10 AM
Hello Joe, how can i call script from IOS?
I use:
event manager directory user policy "flash:/"
event manager policy script.tcl
In my case script have empty data for $arr_einfo(msg).
Best regards.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide