logo

NJP

Discovery : How to create a custom probe and sensor

My Knowledge Hub · Aug 02, 2021 · article

# Introduction:

We always wonder in discovery how the CI information is fetched and how it is processed. Also what if the information we need is not fetched by discovery but customer wants it. So the answer is probe & sensor and yes also patterns which is an emerging concept. So i though why not put the knowledge of creating this custom probe and sensor in front. In this article we are going to see how to create a custom probe and sensor to fetch extra details from the Windows Server and update the CI with that details. Thanks for our community friends for asking this article. So the main motive of this article is to trigger a PowerShell probe to get whoami information in exploration phase of discovery. For Pattern i will create a separate article on same lines.

# Use Case:

Create a custom probe on windows server to fetch whoami information and allow sensor to process the data and update the CMDB CI. We will see how to trigger two commands mainly whoami and ipconfig

### Probe Creation:

1) Probe basic details :

2) Probe Parameters :

### Sensor :

Important things to note here is result object and this.getCMDBRecord().

* result : it is a xml from ECC queue. result.output gives you the output received after executing the command whoami on the target machine.

* this.getCMDBRecord() : this is a CI record which was identified in identification phase and which we are going to update in this sensor script.

**_Note: If you test this probe using test probe option then you will get output but the this.getCMDBRecord() will be empty as we are testing this probe in standalone manner. So its very important to attach this probe to classifier._** **_So dont forget to add this probe to CI Classification – Windows – Windows Server 2016 (for testing i have added it to windows 2016, you can add wherever you want to)_**

### Output:

In this example you can see we are updating short description of the CI with the whoami out as shown above. So below you can see the updated record.

So in this way we create the custom probe and custom sensor. Similarly you can do this for IPCONFIG and other commands. In next article i will come up with custom script and file triggering on MID Server and many more.

If you are interested in Linux Custom Probe and Sensor then i recommend you to have a look at this article by Jace:

**Attached is the custom probe, probe parameter and sensor for you guys to test it on your instance**.

**_Please don’t forget to mark helpful ,bookmark this article and subscribe my YouTube channel._**

**Thanks and Regards,**
**Ashutosh Munot**

**[ServiceNow MVP 2019/2020](https://community.servicenow.com/community?id=community%5Fblog&sys%5Fid=fb488720dbaacc504819fb2439961900)**

**[My Article and Blogs](https://community.servicenow.com/community?id=community%5Fuser%5Fprofile&user=2a131665db1c1fc09c9ffb651f9619fb)**

**[YouTube Channel](https://www.youtube.com/channel/UCf7bnvR3MOiJN5tDxLZPNuw?view%5Fas=subscriber)**

View original source

https://ashutoshmunot.wordpress.com/2021/08/03/discovery-how-to-create-a-custom-probe-and-sensor/