Populate SNMP Sensor Return Data

varaprasad123
Kilo Guru

Hello,

 

I want to update a custom field on my CI record by capturing the SNMP Sensor return data  on  Classifier "On Classification Script".

 

How do i get the SNMP probe sensor data into "On Classification Script" 

 

Servicenow Wiki has this code, but this wasn't much help

 

var computerName = g_sensor.deviceGR.name; var processClassiferName = g_classification.name; current.name = processClassiferName + "999" + "@" + computerName;

 

Regards.

4 REPLIES 4

Aneesh-D
Tera Guru
Tera Guru

@varaprasad123 - You want to change the way your CI is classified? or your classification is works fine and you have your CI record created, now you want an additional custom field value to be populated?

 

Assuming you ask is later: you can extend the pattern associated with the classifier and write your custom logic with OID to fetch the data and populate the field.

 

AneeshD_1-1722952384094.png

 

 

AneeshD_0-1722952338312.png

 

Hi @Aneesh-D , thanks for your reply. I do not have a pattern in place, we are using a Probe / Sensor.

 

And then I have Process classifier, So i want "On Classification script" to update the custom field on CI record with Sensor return data precisely name of CI that returning from Sensor.

 

Hope i'm clear?

 

Thanks

varaprasad123
Kilo Guru

Nevermind, I figured it out, since CI Classifier "On Classification Script" runs on table. We have access to Current. So that makes it easy to reach any field that we wanted to udpate.  

And, We have access to Sensor return data as well in the " On Classification Script".

 

So, Sample syntax to update a custom field with sensor return device name is, 

 

current.customfield_name = values.get('name'); and this did magic 🙂

 

Just incase, If anybody looking for a an answer.

Thanks though @Aneesh-D 

joanlee9494
Kilo Contributor

bro you should direct contact them by instagram through this link of website it also download reels and stories of instagram. click here