02-12-2016 09:28 AM
I'm encountering an issue with using EEM to generate SNMP traps from a syslog event. I want to include the syslog message as a varbind in the trap, but the $_syslog_msg variable will not resolve, rather the variable is a string with the literal value "$_syslog_msg".
Here is an example:
event manager applet test-syslog
event syslog pattern "SYS-5-CONFIG"
action 1.0 info type snmp var "testvar1" oid 1.3.6.1.4.1.33333.1.1.0 string "$_syslog_msg"
action 2.0 info type snmp trap enterprise-oid 1.3.6.1.4.1.33333.1 generic-trapnum 6 specific-trapnum 1 trap-oid 1.3.6.1.4.1.33333.1.0.1 trap-var "testvar1"
!
The resulting SNMP trap has the variable as: "$_syslog_msg" rather than what the syslog msg variable is.
As a sanity check I also added
action 3.0 puts "test $_syslog_msg"
It correctly displays the syslog message to the tty.
Am I missing something? Any suggestions?
Thanks
Solved! Go to Solution.
02-13-2016 07:28 AM
This is a known issue. You'll need to use Tcl to get variable expansion in your varbinds. You can use the tool at http://www.marcuscom.com/convert_applet to convert your applet to an EEM Tcl policy.
02-13-2016 07:28 AM
This is a known issue. You'll need to use Tcl to get variable expansion in your varbinds. You can use the tool at http://www.marcuscom.com/convert_applet to convert your applet to an EEM Tcl policy.
02-16-2016 07:15 AM
That worked well, although I should point out that the applet<>TCL converter did not properly substitute underscores for hyphens.
e.g.
enterprise-oid should convert to enterprise_oid
Thanks!
02-17-2016 11:58 PM
Thanks for the report. It has been fixed.
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