02-03-2012 06:00 AM
Hi,
I am trying to change SNMPv2 community string on 6509 remotely, without using expect script. I tried EEM applet (we cannot use TCL scripts), but it does not work.
EEM command "action 10 info snmp oid 1.3.6.1.2.1.1.4 get-type exact" is supposed to store the result into an environment variable. It does not. Or at least not in the one that is documented. Is it a bug? We have IOS 12.2(17r)SX5. To get EEM version i ran "sh event manager version" and got "eem: (v240_throttle) 2.21.32". Does it mean i have EEM version 2.21?
Thanks,
Solved! Go to Solution.
02-05-2012 09:43 PM
You have EEM 2.4, but you're IOS version is definitely not 12.2(17r)SX5. That is your boot code version. The output of the action here will be in the variable $_info_snmp_value.
action 10 info snmp oid 1.3.6.1.2.1.1.4.0 get-type exact
action 20 syslog msg "Result is $_info_snmp_value"
02-05-2012 09:43 PM
You have EEM 2.4, but you're IOS version is definitely not 12.2(17r)SX5. That is your boot code version. The output of the action here will be in the variable $_info_snmp_value.
action 10 info snmp oid 1.3.6.1.2.1.1.4.0 get-type exact
action 20 syslog msg "Result is $_info_snmp_value"
02-06-2012 09:34 AM
Hi Joseph,
i was missing ".0" at the end of the OID. This works now.
Thanks a lot
03-21-2012 10:04 PM
Hi Joseph
What if we would like to get mutiple snmp information from the device,.. What shoud be the stored variable? Does it allow us to save multiple snmp values? Please advice. Thank you, Joseph.
03-22-2012 05:45 PM
Just continue to use the info snmp action. Each time through the result will be stored in the $_info_snmp_value variable. For example:
action 1.0 info snmp oid 1.3.6.1.2.1.1.4.0 get-type exact
action 2.0 syslog msg "Result is $_info_snmp_value"
action 3.0 info snmp oid 1.3.6.1.2.1.1.5.0 get-type exact
action 4.0 syslog msg "Result is $_info_snmp_value"
...
03-26-2012 11:57 PM
Joseph
Thank you for your reply.
The reason I asked about storing the variable (Ex. snmp) is that. I am trying to compare the snmp value between the previous triggered event and the current triggered event. I think I need to store a valiable to do it. Would you recommend any way to do so
03-27-2012 12:41 AM
You would need to save that data into a context. You will need EEM 3.0 or higher for this, but you could do something like:
action 1.0 info snmp oid 1.3.6.1.2.1.1.4.0 get-type exact
action 2.0 set snmp_res1 $_info_snmp_value
action 3.0 info snmp oid 1.3.6.1.2.1.1.5.0 get-type exact
action 4.0 set snmp_res2 $_info_snmp_value
action 5.0 context save key SNMPCTX variable snmp_res*
To retrieve the previously saved values, use:
action 1.0 handle-error type ignore
action 2.0 context retrieve key SNMPCTX
action 3.0 if $_error ne FH_EOK
action 4.0 set snmp_res1 0
action 5.0 set snmp_res2 0
action 6.0 end
action 7.0 handle-error type exit
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