Discovery Schedules not working after upgrading to Orlando with "Too Many IPs Excluded" error


We see "Too Many IPs Excluded: XXXX" in the discovery logs and the discovery gets cancelled.


Please see the script snippet below from Script Include ‘DiscoverySchedule’

// Throw any error for checks that failed in _errorsInSchedule()
scheduleValidator: function() {
if (this.exclusionRangeTooLarge) {
throw {
message: 'Too Many IPs Excluded: ' + this.excluded_ip_size,
excluded_ip_size: this.excluded_ip_size

// This function serves as a place to check for anything related to schedules
// that should get addressed before the schedule is used as expected.
_errorsInSchedule: function() {
if (this._excludeIPLimitTest())
return true;

_excludeIPLimitTest: function() {
var excluded_ip_size = 0;
var includedGr = new GlideRecord('discovery_range_item');
includedGr.addQuery('schedule', this.sysID);
while ( {
included_sys_id = includedGr.getValue('sys_id');
var excludedGr = new GlideRecord('discovery_range_item_exclude');
excludedGr.addQuery('parent', included_sys_id);
while ( {
type = excludedGr.getValue('type');
if (type == 'IP Network')
excluded_ip_size += IPNetworkSize(parseInt(excludedGr.getValue('netmask')));
else if (type == 'IP Address Range')
excluded_ip_size += parseInt(IPAddressRangeSize(excludedGr.getValue('summary')));
else if (type == 'IP Address List')
excluded_ip_size += parseInt(IPAddressListSize(excludedGr.getValue('sys_id')));

if (excluded_ip_size >= 500000) {
this.exclusionRangeTooLarge = true;
this.excluded_ip_size = excluded_ip_size;
return true;

We see here that if it fails this check then the schedule will not run. This is implemented because it causes great inefficiency during the shazzam phase.

We should see in the schedule(s) that they have a very large range with a lot of excludes.

This code was introduced after Madrid to avoid shazzam issues with IP ranges, which is the reason Discovery Schedules are not working after upgrading to Orlando.


1. The better practice is to have ranges on the schedule that are smaller and not have as many excludes.

2. The other option is to modify the above script include to not cause this issue. However, this is not recommended for the following reasons:
      a) causes great inefficiency during shazzam phase
      b) the script will be customized from OOTB