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

Sure, you would want to do something similar to what I did here with the linux laptop discovery based on Form Factor.. just get that model information instead and you should be able to accomplish....

Doug,



I think I need a little more help here sir.



hostname or Hostname 'does not contain' or 'does not start with' 'testserver' is not working. I was able to do 'output does not contain' on the Linux classifier and it works perfectly. I also came across this article. Windows Discovery classification parameters



Do you have any more suggestions please ?


Doug,


I'm having the same issue and I tried the Classification for windows for hostname does not contain VPWCTX.   I've tried host_name, hostname, "name", "host_name", "hostname".


Obviously there is something I am missing.


In the end I'm trying not to create CIs for our Citrix servers because they are load balanced and make more when needed and delete others when they are no longer needed.


Any help you can give me would be appreciated.



Thanks,   Juli


Were you ever able to resolve this?  I am trying to do the same thing with our Citrix XenApp and 'non-production' servers.  Thanks.