I'm trying to use SNMP GET interception with 'istable yes'. Ideally, I would like to pass the entire OID to a Tcl script that will then use the table index as an input to alter its behavior in generating the output, which will then be passed as a variable to the snmp-object-value action.
Here's the sample config used with my test:
event manager applet getTest
event snmp-object oid 1.9.9.9.9 type int sync yes istable yes
action 10 syslog msg "OID: $_snmp_oid"
action 20 snmp-object-value event-id _event_id int 1234 next-oid 1.9.9.9.10
action 30 exit 1
!
Here's the response, including the value of _snmp_oid:
R2(tcl)#snmp_getone private 1.9.9.9.9.3.2.1
{<obj oid='iso.9.9.9.9' val='1234'/>}
R2(tcl)#
*Jan 18 13:11:49.155: [fh_fd_snmp_object_get_callback]
*Jan 18 13:11:49.155: [fh_fd_snmp_object_match_event]
*Jan 18 13:11:49.159: fh_fd_snmp_object_match_event: oid=1.9.9.9.9, spec_oid=1.9.9.9.9
*Jan 18 13:11:49.159: fh_fd_snmp_object_event_match: oid = 1.9.9.9.9, sync = 1, get_tty = 1, tty_buf = 0
*Jan 18 13:11:49.159: snmp_object_conn_tm_alloc: ptp=0x683AA58C
*Jan 18 13:11:49.159: fh_fd_snmp_object_event_match: publish_timer=0x66ABBB5C, ptp=0x683AA58C, max_delay=30000
*Jan 18 13:11:49.159: snmp_object_conn_tm_add: re=0x683A97CC, ptp=0x683AA58C
*Jan 18 13:11:49.167: fh_fd_snmp_object_event_match: re=0x683A97CC, ptp=0x683AA58C, oid=1.9.9.9.9
*Jan 18 13:11:49.171: fh_send_snmp_object_fd_msg: msg_type=64
*Jan 18 13:11:49.171: fh_send_snmp_object_fd_msg: sval=0
*Jan 18 13:11:49.215: %HA_EM-6-LOG: getTest: OID: 1.9.9.9.9
*Jan 18 13:11:49.215: fh_fd_snmp_object_value: event_id=7, next_oid=1.9.9.9.10, re=683A97CC
*Jan 18 13:11:49.215: fh_send_snmp_object_fd_msg: msg_type=18
R2(tcl)#
*Jan 18 13:11:49.215: [fh_fd_snmp_object_publish_done]
*Jan 18 13:11:49.215: fh_fd_snmp_object_publish_done: rc=1, re=683A97CC
*Jan 18 13:11:49.215: fh_fd_snmp_object_publish_done: rc=1, publish_expired=0
*Jan 18 13:11:49.215: sid=7, ptp=0x683AA58C, connp=0x6838B230
*Jan 18 13:11:49.215: fh_fd_snmp_object_publish_done: num_sync_msgs=0, response_code=6
*Jan 18 13:11:49.215: snmp_object_conn_tm_remove: re=0x683A97CC, ptp=0x683AA58C
*Jan 18 13:11:49.215: snmp_object_conn_tm_free: ptp=0x683AA58C
*Jan 18 13:11:49.215: fh_send_snmp_object_fd_msg: sval=0
*Jan 18 13:11:49.219: [fh_fd_snmp_object_get_callback] response_code=6, re=683A97CC
*Jan 18 13:11:49.219: fh_fd_snmp_object_get_callback: int=1234
R2(tcl)#
'show event manager detector snmp-object detailed' only shows that it uses the following variables:
Applet Built-in Environment Variables:
$_event_id
$_event_type
$_event_type_string
$_event_pub_time
$_event_pub_sec
$_event_pub_msec
$_event_severity
$_snmp_oid
$_snmp_request
$_snmp_request_type
$_snmp_value