Find Discovery Orphans
Import
·
May 09, 2018
·
article
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);
View original source
https://www.servicenow.com/community/itom-articles/find-discovery-orphans/ta-p/2326462