How to create custom probe and sensor.
Creating custom probe and sensor.
Before starting this I assume you already know what is probe and sensor and what does it do.If you are not aware of probe and sensor then please go through this link first Probes and Sensor.
Here we will try implementing a very small and basic requirement. Once you understand how it works you can implement any complex requirement also. So here we will try to fetch the BIOS information of a windows system and will populate this result into the BIOS detail field ( which is a custom field that I have created ) of CI table .
Let's start with probe first :-
To create a probe follow the below steps :-
1. Under Discovery definition click on probes module.
2. Give a meaningful name to the probe. Ex. Windows-BIOS version.
3. The value in the ECC queue topic field appears in the ECC queue output record's "topic" field when this probe is launched.Since its a DOS command write Command in the field. Please note it's case sensitive so if you will write command it will not execute.
4. If your command that needs to be executed is small and concise then you can enter your command directly into the ECC queue name field. Write systeminfo|find "BIOS Version" in this field
5. Now save the record and click on the test probe related list and provide and provide the IP address of the windows device and select the proper midserver. Click on ok button
After probe gets executed you will be redirected to ecc_queue table with two entries. First record whose "Queue" value is output is the probe which went to the midserver along with the command that we wanted to execute. In our case it is " systeminfo|find "BIOS Version ".
The second probe whose "Queue" value is input is the one that was sent by the midserver to the servicenow along with the result. Open this record and look inside the payload field. You will see the output of your command is carried inside the result tag.
By now we have completed half of our work.
So what all we have accomplished by now as per our requirement ? The answer is by now we have created a probe which contains the command to extract the BIOS information of the device. Executing this probe successfully brings the BIOS information back to the servicenow tool.
Now we need someone who can use this result and insert this information into the BIOS detail field ( which is a custom field that I have created ) of the CI whose BIOS information we have extracted.
Here comes the Sensor which does this job.
To create a sensor follow the below steps :-
1. Under Discovery definition click on sensor module.
2. Give a meaningful name to the sensor. I am giving the same name Windows-BIOS version so that one can easily understand for which probe this sensor related to.
3. In "Reacts to Probe" field select the probe you just created i.e. Windows-BIOS version
4. In the script filed we write the javascript which extracts the <stdout> tag value from the result. For this first we create the object of DiscoverySensor class. Each sensor initiates a new object using DiscoverySensor class. If you open this script include then you might find it very complex to understand but for simple situations, you only need to create the process function. In the below code we have created the cobject of DiscoverySensor class. In process function the result parameter contains the output returned by the probe.
new DiscoverySensor({
process: function(result) {
// API shell -- every probe needs a sensor
},
type: "DiscoverySensor"
});
3. Now if you see the output that came back to the servicenow "BIOS Version: LENOVO 9ACN29WW, 10/20/2014" you will notice that we need to modify this data before inserting this into the field. For this purpose we will use javascript code.
new DiscoverySensor({
process: function(result) {
// API shell -- every probe needs a sensor
var output=result.stdout;//stdout is the tag that contains the output of the command
var bios_result=output.split(":")
current.u_bios_detail=bios_result[1]; //assigning the result into the BIOS detail field.
},
type: "DiscoverySensor"
});
Now we are done with creation of probe and sensor. Now one final work is left to make it fully functional. We need our probe to attach so that it can run every time discovery runs of Windows device. To do this go to Discovery Definition > CI Classification >windows. Open the windows record which is for cmdb_ci_computer table.
Go to Triggers pobes related list and click on edit.
Select your custom probe Windows-BIOS version.
Now we are done with every thing. Cross your fingers now because now is the time to test......
Go to Discovery Schedules click on Quick Discovery button in the dialog box opened enter the IP address of the window device select your midserver and click on OK button. Let the discovery complete.
Once discovery gets competed one the device from device related list and check the BIOS detail field. You will see the filed populated with the value.
I hope you will find this post helpful. Please give your feedback in the comments. Thankyou
use more tags and use different theme to make a good user interface.
ReplyDeleteIts useful. thanks.
ReplyDeleteReally awsmm document thks alot...
ReplyDeleteExactly what I was looking for. Excellent and to the point topic.
ReplyDeleteThank you very much.
Rajan
Hello Kamlesh,
ReplyDeleteQuick question. I used your blog and created a custom Probe to execute systeminfo command and I noticed that every time I run the discovery, it brings me the same results. Then I realized, that it is bringing results of MID server. Is there any step I might be missing?
Please advise.
Thanks,
Rajan
Thank you for sharing wonderful information with us to get some idea about that content.
ReplyDeleteServiceNow Training in Hyderabad
Great Site, The Course were so simple and easy to understand.
ReplyDeleteServiceNow Online Training
ServiceNow Training
ServiceNow Training in Ameerpet
ReplyDeleteI like your post very much. It is very much useful for my research. I hope you to share more info about this. Keep posting!! Best Devops Training Institute
I am Here to Get Learn Good Stuff About servicenow,Thanks For servicenow.servicenow training in bangalore
ReplyDeleteHi Kamlesh,
ReplyDeleteI need to do almost exactly what you wrote. The only difference is that my BIOS field is not in the cmdb_ci_computer table. Any idea how I can do this?
ReplyDeleteIt is amazing to visit your site. Thanks for sharing this information, this is useful to me...
Servicenow Online Training
Servicenow Online Training in Hyderabad
Servicenow Developer Training
Servicenow Training in Ameerpet
Servicenow Course Online
Best Servicenow Online Training
Servicenow Developer Training Online
Servicenow Admin Training Online
Learn Servicenow Online
Servicenow Developer Online Training
Servicenow Admin Online Training
Servicenow Online Training in India
Servicenow Online Training Hyderabad
Very nice article,keep sharing more posts with us.
ReplyDeletethank you...
Servicenow course
kayseriescortu.com - alacam.org - xescortun.com
ReplyDeleteexcellent , could you provide any video
ReplyDeleteThanks for your information. very good article.
ReplyDeleteServiceNow developer certification
itsm certification
Thank you for sharing wonderful information with us to get some idea about that content.
ReplyDeleteServiceNow Online Training in Hyderabad
ServiceNow Developer Training
Mmorpg oyunlar
ReplyDeleteİnstagram takipci satın al
tiktok jeton hilesi
tiktok jeton hilesi
SAÇ EKİM ANTALYA
instagram takipçi satın al
İnstagram takipci
metin2 pvp serverlar
takipçi
perde modelleri
ReplyDeletesms onay
mobil odeme bozdurma
nft nasıl alınır
ankara evden eve nakliyat
TRAFİK SİGORTASİ
dedektör
web sitesi kurma
AŞK ROMANLARI
Thanks for sharing this information
ReplyDeleteServiceNow Online Training in Hyderabad
ServiceNow Developer Training
Good content. You write beautiful things.
ReplyDeletevbet
hacklink
taksi
hacklink
mrbahis
mrbahis
sportsbet
vbet
sportsbet
This is very helpful..
ReplyDeleteSuccess Write content success. Thanks.
ReplyDeletebetpark
canlı slot siteleri
canlı poker siteleri
kıbrıs bahis siteleri
deneme bonusu
betmatik
kralbet
başakşehir
ReplyDeletebayrampaşa
beşiktaş
beykoz
beylikdüzü
ZKX0X
mecidiyeköy
ReplyDeletesakarya
istanbul
kayseri
ordu
BWSF
https://saglamproxy.com
ReplyDeletemetin2 proxy
proxy satın al
knight online proxy
mobil proxy satın al
O85Y
arnavutköy
ReplyDeleteartvin
avcılar
aydın
bağcılar
MPQHOV
adapazarı
ReplyDeleteadıyaman
afyon
alsancak
antakya
KC0FQ
https://saglamproxy.com
ReplyDeletemetin2 proxy
proxy satın al
knight online proxy
mobil proxy satın al
JTSP