Setting a 'Probe Parameter' value in a Connector Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2023 02:07 PM - edited 01-28-2023 02:58 PM
Hi
Ive just written a Connector Definition to connect to Cisco SDWAN / vManage and built it using ideas from other Connector scripts (ie SolarWinds).
The API that i have returns events for a fixed period (ie the last 30 mins), so when i run this every 5 mins i see up to 6 occurrences of the same event in the event table. Whilst this strictly speaking is not a problem for Event processing, we don't want to see multiples. So I borrowed the idea of leveraging the 'last_event' time Parameter in order to cut out duplicate events.
The script uses the updateLastSignatureFunction (), which updates and returns a 'retVal' object containing a 'last_event' value , and the 'retVal' object is then passed back to the execute() function, and returned by that.
updateLastSignature: function(events, retVal) {
// the last signature is either on the first or the last event
var firstEventSignature = events[0].getField('entry_time');
var lastEventSignature = events[events.length-1].getField('entry_time');
this.debug('updateLastSignature: firstEventSignature: ' +firstEventSignature);
this.debug('updateLastSignature: lastEventSignature: ' +lastEventSignature);
if (parseInt(firstEventSignature) >= parseInt(lastEventSignature))
retVal['last_event'] = firstEventSignature;
else
retVal['last_event'] = lastEventSignature;
},
I can see the value is successfully set, and when run again it is retrieved using
....... = this.probe.getParameter("last_event");
This works a dream, however especially during development i want the ability to reset the 'last_event' value. For example I have tried adding
retVal['last_event'] = '';
to the end of the testConnection() function but that doesn't seem to work.
Any suggestions on where this parameter value is stored, and how i can reset this value on demand please?
Many Thanks
David
- Labels:
-
Event Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2025 11:37 PM
I guess you found it but for future reference it is in the Connector Instance (em_connector_instance) variable: <last_event_signature>2025-02-07T06:23:19.744Z</last_event_signature>