Exclude CI's from Insertion During Discovery

tiguin2798
Tera Guru

Good Afternoon,

 

I am attempting to exclude CI's from being imported into our CMDB when the discovery schedules run. We want to filter this based on conditions such as "name contains ___" or "Manufacturer is ____". We attempted this with a before insert business rule but it is causing errors on our JAMF and SCCM imports when the discovery schedules run. Can anyone suggest to me how this can be achieved? We recently upgraded our instance to Xanadu.

3 REPLIES 3

Selva Arun
Mega Sage
Mega Sage

Hi @tiguin2798 ,

 

Here’s an overview of how this can be done:

1. Using Global Exclusion List for Discovery

Adding the IP addresses or CIDR blocks to the Global Exclusion List will prevent the discovery process from interacting with certain IP ranges or CIs associated with those IPs. However, this method is more related to IP-based exclusions rather than filtering based on CI attributes such as name or manufacturer.

Steps to Use the Global Exclusion List:

  1. Navigate to Discovery > Discovery Configuration > Global Exclusion List in your ServiceNow instance.
  2. Add the specific IP ranges or hosts (via IP addresses) you want to exclude from discovery.

While this is useful for excluding devices by IP, it doesn't provide the flexibility to filter based on conditions like name contains ___ or Manufacturer is ___ directly.

 

2. Use a "Before Insert" Business Rule with Conditions (Correct Approach)

If you prefer to continue using a Before Insert Business Rule, it's important to refine the logic and ensure it doesn’t interfere with your JAMF and SCCM imports. A Before Insert Business Rule is a valid way to exclude CIs, but you need to make sure you're applying the rule selectively and safely to avoid causing errors during imports.

Here’s how you can structure the business rule:

  1. Go to System Definition > Business Rules and create a new Before Insert Business Rule.
  2. Set your conditions in the Conditions tab. For example, use:
    • Condition 1: name CONTAINS 'Test Device'
    • Condition 2: Manufacturer IS 'Apple'
  3. Use the Script section to prevent the CI from being inserted into the CMDB. Here’s a basic script example:
    if (current.name.indexOf('Test Device') != -1 || current.manufacturer == 'Apple') {
        current.setAbortAction(true); // This prevents the CI from being inserted
    }
    
  4. Test the Business Rule thoroughly to ensure that it doesn't cause conflicts or errors with JAMF or SCCM imports. Make sure your rule only applies to the right records.

3. Ensure No Conflict with Import Sets

Make sure that any logic you apply to exclude CIs doesn’t interfere with Import Set transformations if you are importing data through integrations like JAMF or SCCM. You may need to adjust the data source or transformation logic to ensure exclusions are applied before data reaches the CMDB.

4. Check for Errors in JAMF and SCCM Imports

If you're facing errors when the discovery schedules run, check the logs for more detailed error messages. There might be some dependency or configuration issue that needs to be resolved in your JAMF or SCCM integration setups.

Summary:

  • Global Exclusion List: Best for IP or host-based exclusions, but doesn’t directly handle attribute-based filtering.
  • Before Insert Business Rule: Can work, but ensure it’s properly tested and doesn’t conflict with your imports.

If you believe the solution provided has adequately addressed your query, could you please **mark it as 'Helpful'** and **'Accept it as a Solution'**? This will help other community members who might have the same question find the answer more easily.

 

Thank you for your consideration.


Selva Arun

Slava Savitsky
Giga Sage

Where did you find that global exclusion list for Discovery? Could you please provide a reference to the source of this information?

Pratiksha
Mega Sage
Mega Sage

in your script add discovery source condition.