tim_broberg
ServiceNow Employee
ServiceNow Employee

Here's a tool I wrote to help me figure out why my discoveries canceled.

It takes the number of a discovery as an argument and searches through all the ecc_queue records looking for output records that have no corresponding inputs.

You can then get a list of the sys_ids of the orphaned outputs, or you can get a CSV with selected fields.

There is also a UI action for the Discovery Status form to collect the list and display them on the ecc_queue.

Now, when a discovery cancels, I just go to the status page, run the orphan finder, and I can quickly find a list of the problematic probes.

// Search through the ecc_queue records for a discovery.

// Usage to get sys_id's:
var finder = new FindDiscoveryOrphans('DIS0010005');
var sysIDs = finder.find();
gs.print('' + sysIDs);

// Simple CSV:
var finder = new FindDiscoveryOrphans('DIS0010005');
var csvOut = finder.findCSV();
gs.print('' + csvOut);

// CSV with custom separator, field list:
var finder = new FindDiscoveryOrphans('DIS0010005',   '/', ['sys_id', 'sys_created_on', 'agent', 'topic', 'name']);
var csvOut = finder.findCSV();
gs.print('' + csvOut);
Comments
Dave Ainsworth
ServiceNow Employee
ServiceNow Employee

Nice work. I imagine it will be very useful for finding long running SNMP queries which are often linked to specific devices.

Version history
Last update:
‎05-09-2018 02:55 PM
Updated by: