cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1499
Views
0
Helpful
3
Replies

TCL multiple syslog event

peraocompany
Level 1
Level 1

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"

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

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)

View solution in original post

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

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)

Hello Joseph. Thank you it is work.

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.