Discovery Rule - Customisation

Discovery Rule - Customisation

 

What’s Changed?  

Previously, the logic to determine the product type of an asset was static and hard-coded. With this new enhancement, we can now configure flexible rules to determine the product type of assets based on conditions like operating system, hardware details, or any other known property of the asset.

NOTE : How to create a new custom discovery rule is explained after the table's definition.

DATA MODEL

DISCOVERYRULE:

This Table is the base table of the feature. This table contains a list of possible conditions based on which a product type of an asset is determined. The columns' functions are,

  1. DISCOVERYRULEID -> Primary Key of the table

  2. COMPONENTTYPEID -> ID of the Product type which is referred to EntityDefinition

  3. DISCOVERYFORMULAID -> ID of the formula we want the rule to follow (explained below)

  4. PRIORITY -> a numeric value to decide the performing order of the rules for same product

 

DISCOVERYFORMULA :

This Table contains the list of possible discovery criteria combinations for each discovery rule. The columns' functions are,

  1. DISCOVERYFORMULAID : Primary Key of the table

  2. DISCOVERYCRITERIAID1 : ID of the criteria for the left operant of the formula.

  3. DISCOVERYCRITERIAID2 : ID of the criteria for the right operant of the formula.

  4. OPERATOR : Operation to be performed on the left and right criteria, such as AND / OR

  5. DISCOVERYFORMULAID2 : Child formula ID, (i.e, ID of the same table where the next formula appended to the checks.)

 

DISCOVERYCRITERIA :

This Table contains the definition of each criteria mentioned in the DISCOVERY Formula Table.

  1. DISCOVERYCRITERIAID : Primary Key of the table.

  2. PROPERTYFORM : Table name from where the field needs to be checked in present. (can be undefined if the data is from backend instead of table)

  3. PROPERTYNAME : name of the column or the property from the Property Form

  4. PROPERTYRULE : Comparison Operator such as EQUALS , NOTEQUALS, GREATERTHAN ans so on.

  5. PROPERTYVALUE : value that needs to be checked.

 

How It Works (Conceptually)  

1. Discovery Rules  

These are the main rules that define what kind of product an asset should be classified as — for example, a "Server" or a "Workstation". Each rule includes:

  • What product type it applies to (e.g., Server).

  • What condition or formula it should follow to identify that product type.

  • Its priority (i.e., in what order it should be checked if multiple rules apply).

2. Formulas  

A formula combines multiple checks (called criteria) into a logical condition. For example:

  • “OS name contains Windows Server” OR “OS name contains VMWare”.

You can nest formulas to create complex combinations (e.g., (A OR B) OR (C OR D)).

3. Criteria  

Each criteria is a basic building block — a simple check like:

  • “OS name contains ‘Windows Server’”

  • “OS name is not equal to ‘Linux’”

  • “RAM size is greater than 8GB”

 

Current Discovery Rules and Priorities

1. Server:

Assets are classified as Server if the OS Name contains any of the following keywords:

  • "Windows(R) Server"

  • "Windows Server"

  • "VMWare"

  • "Solaris"

 

2. (Based on Chassis Type):

Assets are classified into specific workstation sub types based on their chassistypeid:

  • 2-in-1 Tablets:

            chassistypeid is 11 or 30

  • Laptop:

            chassistypeid is one of: 31, 21, 18, 14, 12, 10, 8, 9

  • Desktop:

            chassistypeid is one of: 28, 23, 17, 16, 15, 13, 7, 6, 5, 3, 4

  • Workstation:

             chassistypeid is one of: 36, 35, 34, 33, 32, 29, 27, 26, 25, 24, 22, 20, 19, 1, 2

 

 

HOW TO CONFIGURE A CUSTOM DISCOVERY RULE :
Example: Custom Product Type – VM Host and Virtual Machines

  1. Constructing DiscoveryCriteria :

    1. Create two custom custom product type as VM Host and Virtual Machines then construct discovery criteria using below query.

       

 

query:
INSERT INTO DiscoveryCriteria (

  discoverycriteriaid,

  propertyname,

  propertyrule,

  propertyvalue

) VALUES

('68','ISVM','EQUALS','true'),

('69','ISESXI','EQUALS','true'),

('70','ISHYPERV','EQUALS','true'),

('71','ISHYPERVVMSALLOWED','EQUALS','true'),

('72','ISVMHOST','EQUALS','true');

 

  1. Now we have created a DiscoveryCriteria . We have to Create DiscoveryFormula for these criteria

query:
INSERT INTO discoveryformula  (

  discoveryformulaid,

  discoverycriteriaid1,

  operator,

  discoverycriteriaid2,

  discoveryformulaid2

) VALUES

('79', '70', 'AND',NULL,'3'),

  ('80', '70', 'AND','71', NULL),

  ('81', '68', NULL, NULL, NULL),

('82', '69', NULL, NULL, NULL);

 

Note : we should always use discoveryformulaid instead of discoverycriteriaid2 unless it is a last criteria to append. this should be done to ensure the more than two checks

 

 

  1. Then we have to create a DiscoveryRule for the product type Server under our base formula 3.

       

  • here 302 and 303 is a product type id for Virtual Host and Virtual machine respectively which is referred from EntityDefinition table.

 

Query:
insert into discoveryrule (

DISCOVERYRULEID,

COMPONENTTYPEID,

DISCOVERYFORMULAID,

PRIORITY

) values

('12', '302', '79', '200'),

  ('13', '302', '80', '200'),

  ('14', '302', '82', '200'),

('15', '303', '81', '100');

 

 

 

 

                  New to ADSelfService Plus?