Stop Insert/Creation of CI based on Name (Discovery)

jeremyeperdue
Giga Expert

Farily straight forward question. What is the best / safest way to stop a CI from being created during discovery?

Example : We want to "not have" Windows servers in our CMDB if there name starts with "testserver".

Is there a way to prevent the insert such as an abort Business Rule? If yes, is that safe since that does not stop discovery. What other options are available to "block"?

If blocking isn't the safest way, what is the best option? A scheduled job to remove? If this is true, do I need to add anything after gr.deleteRecord ?

var gr = new GlideRecord('cmdb_ci_win_server');

gr.addEncodedQuery('u_active=true^nameSTARTSWITHtestserver');

gr.query();

if (gr.next()) {

        gr.deleteRecord();

}

1 ACCEPTED SOLUTION

doug_schulze
ServiceNow Employee
ServiceNow Employee

Jeremy,



If that name is truly the case then why not use a classification criteria on the windows classifiers that says hostname does not contain (or start with) 'testserver'



This way you cut it off a the proverbial pass so you don't have to trigger a bunch of unnecessary probes and sensors being processed just to be denied by a Business Rule.. This might be a better use of processing power



if you are looking for other attributes you can use to set your classification criteria take a look at the Windows Classify Sensor and you can see the values you can call..I even did a writeup using a linux host as an example of how those classification parts work...


View solution in original post

8 REPLIES 8

doug_schulze
ServiceNow Employee
ServiceNow Employee

Jeremy,



If that name is truly the case then why not use a classification criteria on the windows classifiers that says hostname does not contain (or start with) 'testserver'



This way you cut it off a the proverbial pass so you don't have to trigger a bunch of unnecessary probes and sensors being processed just to be denied by a Business Rule.. This might be a better use of processing power



if you are looking for other attributes you can use to set your classification criteria take a look at the Windows Classify Sensor and you can see the values you can call..I even did a writeup using a linux host as an example of how those classification parts work...


Doug,



Thank you for always being here to help! I knew there had to be a better way. Thanks for providing it !



Regards,


Jeremy Perdue


Jeremy (and Juli),



Had my syntax wrong..   its



host_name does not contain <value> in the classification criteria, remembering to set the match criteria to all in the top right...



find_real_file.png



For some background I looked in the windows classify sensor to see what values are being set in the CI data..and found this section that said to me "doug, ya dummy, it needs an underscore..."



find_real_file.png


Hi Doug,

Is it possible to set the Classification based on the Model?  We want to suppress discovery for certain Models. Added a Classification criteria for the Model but it doesn't work.  Have tried giving below criteria but neither of them work:

 

model does not contain "BL"

cidata.model does not contain "BL"

 

Thanks for your help in advance!!

Regards,

Deepak