Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Custom sensor throwing an error

shalaka_v
Tera Contributor

Hi,

I am trying to discover UPS devices manufactured by Sanyo denki. For UPS we don't have OOTB pattern available yet. OOTB Probe was able to only fetch the name and IP address of the UPS and not the serial number, due to which IRE threw errors and did not create the CI.

 

My task is simple. I wanna capture the serial number which uses a different OID  so that IRE can at least allow to create this CI. 

 

For this, I created a custom classifier, included the below OOTB probes-

DNS-DNS
SNMP-SNMP - UPS

 

And i created a custom multi-probe that include our base Identity Probe and a dedicated probe to just retrieve the serial number using that specific OID -

SNMP- Identity Info

Sanyo Denki UPS Serial number

 

In the custom probe "Sanyo Denki UPS Serial number" - I am simply defining the snmp walk OID command in the "SNMP fields" related list which is fetching the serial number as expected

 

For processing this info I have written a custom sensor script -

function(result, ciData, debug, sensor) {
    var Serial_OID = 'iso.org.dod.internet.private.enterprises.unk_3465.unk_41.unk_1.unk_10';
    var idutil = new IDSensorUtil();
    var serialNumber = idutil.calculateSnmpSerialNumber(result, Serial_OID, null, 'Sanyo Denki Devices');
    idutil.addToSerialNumberTable(serialNumber, ciData);
}
 
And lastly, I am able to see a record under "sensors" tab in my custom probe. In this record( its a multi sensor script), I have initialized the DiscoveryIDSensor class
->new DiscoveryIDSensor({})
However, when executed, this throws an error -
Root cause of JavaScriptException: org.mozilla.javascript.ConsString
JavaScript evaluation error on:
new DiscoveryIDSensor({});
org.mozilla.javascript.JavaScriptException: TypeError: Cannot read property "name" from null
Stack: at sys_script_include.7eb50b460a0a0b3f009981accbd08ce2.script:9
at sys_script_include.778011130a0a0b2500c4595ad1d1d768.script:255
at sys_script_include.778011130a0a0b2500c4595ad1d1d768.script:159
at sys_script_include.778011130a0a0b2500c4595ad1d1d768.script:116
at sys_script_include.778011130a0a0b2500c4595ad1d1d768.script:33
 
I am not able to pin point why this error is happening and how can I resolve this. I tried following the same code skeleton as the other OOTB sensors
 
Can someone please help / provide inputs / suggestions?
 
 

 

 

1 REPLY 1

shalaka_v
Tera Contributor

@srinija_itom, @Zach Biewend1, @johnram

 

I saw your comments on few of the related posts . Do you guys have any idea about what might be going wrong here? Any inputs are highly appreciated 🙂