08-02-2013 09:50 AM
Hello I need some help with my problem.
My Cisco device comunicate over SNMP, I need sens spetial data over SMS, and see way but try do it more good.
Switch_1 (Send $data over TCL and SNMP)
if [catch {action_snmp_trap intdata1 "424242" strdata "$data"} result] {
error $result $errorInfo
} else {
action_syslog msg "SNMP sent"}
Switch_2 (recieve SNMP message and must send it to Cellular int.)
event manager applet SNMP
event snmp-notification oid 1.3.6.1.4.1.9.10.91.1.2.3.1.9. oid-val "424242" op eq src-ip-address xxx.xxx.xxx.xxx
action 10 cellular 0/0/1 gsm sms send 8xxxxxxxxxx "$data"
I try know can EEM get strdada from SNMP, and put it to next action command? Than you.
Solved! Go to Solution.
08-02-2013 05:17 PM
I think what you're asking is what the variable name is to get strdata? If that is the case, this is very difficult to do with applets. However, if you look at https://supportforums.cisco.com/docs/DOC-11745 you'll find instructions on sending a purely customized trap using EEM. If you use those steps, you can build your own varbind such as 1.3.6.1.4.1.33333.1.2.0 with your custom data. Then, in your receiving applet, you can do:
action 1.0 set data $_1_3_6_1_4_1_33333_1_2_0
action 2.0 cli command "cellular ..."
08-03-2013 11:47 AM
You will still need a varbind with a predictable value on which to match. So add another varbind like 1.3.6.1.4.1.33333.1.0 with a number value that doesn't change. Then match on that in your event detector line.
08-02-2013 05:17 PM
I think what you're asking is what the variable name is to get strdata? If that is the case, this is very difficult to do with applets. However, if you look at https://supportforums.cisco.com/docs/DOC-11745 you'll find instructions on sending a purely customized trap using EEM. If you use those steps, you can build your own varbind such as 1.3.6.1.4.1.33333.1.2.0 with your custom data. Then, in your receiving applet, you can do:
action 1.0 set data $_1_3_6_1_4_1_33333_1_2_0
action 2.0 cli command "cellular ..."
08-03-2013 03:37 AM
hello Joseph, thank you for you time. I have some dificulties with reciever config (on custom trap)
SW1:
event manager applet sw1
event syslog pattern "%SYS-5-CONFIG_I: Configured from console"
action 1.0 info type snmp var "vbinds" oid 1.3.6.1.4.1.33333.2.0 string "$data"
action 3.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.9.33333.1.0.1 trap-var "vbinds"
action 4.0 syslog msg "Triggered from Trap!"
SW2:
event manager applet sw2
event snmp-notification oid 1.3.6.1.4.1.33333.1 oid-val "*" op eq src-ip-address 192.168.xx.xx
action 2.0 syslog msg "$_1_3_6_1_4_1_33333_2_0"
08-03-2013 11:47 AM
You will still need a varbind with a predictable value on which to match. So add another varbind like 1.3.6.1.4.1.33333.1.0 with a number value that doesn't change. Then match on that in your event detector line.
08-03-2013 12:52 PM
Thenk you Joseph, it work as need.
08-04-2013 03:11 AM
Hello Joseph, can posable overwrite one OID in one script?
If I try do it, sw get error:
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: Duplicate oid: 1.3.6.1.4.1.33333.2.0
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: while executing
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: "sys_reqinfo_snmp_trapvar var vbinds oid 1.3.6.1.4.1.33333.2.0 string $line "
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: invoked from within
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: "$slave eval $Contents"
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: (procedure "eval_script" line 7)
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: invoked from within
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: "eval_script slave $scriptname"
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: invoked from within
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: "if {$security_level == 1} { #untrusted script
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: interp create -safe slave
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: interp share {} stdin slave
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: interp share {} stdout slave
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: ..."
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: (file "tmpsys:/lib/tcl/base.tcl" line 50)
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: Tcl policy execute failed:
Aug 4 14:08:01: %HA_EM-6-LOG: sw.tcl: Duplicate oid: 1.3.6.1.4.1.33333.2.0
08-04-2013 03:41 AM
No, this is not possible. You should only set your varbind value when you're sure that's what you want. If you need another value, you'll have to create a new varbind variable name.
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