- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2019 12:59 AM
Hi
Can anyone help me with discovery related to exclude CI's based on host name i.e starting with d2,D2 not with IPAddress
I Tried with 2 methods
1) I tried modifying DiscoveryJSONIDSensor and DiscoveryIDSensor script includes by adding the below script at Line89
var regexp = new RegExp('^[dD][2]'); //hostnames ending in p01 or P2 or similar
var host_name = this.ciData.data.host_name;
if (!host_name)
host_name = this.ciData.data.name;
var sub = host_name.substring(0,2);
if (sub=='d2' || sub=='D2'){
this.explore = false;
this.setTriggerProbes(false);
logger.info('Non-prod machine: '+ host_name +'. Not exploring device', this.type, this.getEccQueueId());
return false;
} else {
logger.info('Production Machine: '+ host_name +'. Continue to explore device', this.type, this.getEccQueueId());
}
2) I tried changing Classifier by adding Classification Criteria.
Both the cases did not worked
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
Solved! Go to Solution.
- Labels:
-
Discovery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2019 12:25 AM
Hi Rohila,
Apologies, looks like I have some errors in my notes on this. You could try the following:
hostname instead of host_name with Windows. i.e. hostname does not start with d2:
cidata.host_name does not start with d2:
If you still have a problem, post a screenshot of the classifier and I will have a look.
I would also test this thoroughly before doing deciding to implement this in a production envrionment.
Regards,
Dave

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2020 04:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2020 12:19 PM
Hi John
Yes it can be accomplished based on CI classification like windows and linux etc.. based on criteria. Best part is we can use RegEx as well to select or ignore the CI's based on match.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2020 07:27 AM
I'm using cidata.name does not end with 'T' (to exclude our 'test' servers), and this is not working. In fact, for a server that does not end with 'T', it is skipping this classification and instead creating an entry in the 'computer' classification. Any idea why it's not working?