This KB explains how Discovered Devices is calculated on Discovery Home, as showing in the screenshot below:

When clicking on Discovery > Home, the page is sending a request to REST API:  /api/now/discovery_result/homepage

> the REST API can be checked via: System Web Services > Scripted Web Services > Scripted REST APIs > Discovery Result > Get Homepage Stats

> can be tested via REST API Explorer

The API is doing below:

var manager = new DiscoveryResultManager();
var stats = manager.getHomepageStats();

From the script include DiscoveryResultManager, we can confirm below is how "Discovered Devices" is calculated:

 _getNumDiscoveredDevices: function() {
  var hardwareGr = new GlideRecord('cmdb_ci_hardware');
  hardwareGr.addQuery('last_discovered', '>=', gs.daysAgo(30));
  var srcQry = hardwareGr.addQuery('discovery_source', 'ServiceNow');
  srcQry.addOrCondition('discovery_source', 'CredentiallessDiscovery');

  return hardwareGr.getRowCount();

Please note, after clicking on the "Discovered Devices" box, a detailed report with CI classes is showing.

This report is not generated via REST API, but is an actual report. It can be checked via:

Reports > Administration > All > Discovered CIs

Article Information

Last Updated:2020-09-21 22:24:27