Bringing log entries while testing custom sensors

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2014 11:18 AM
Hi,
I am currently troubleshooting network switch's whose serial number wasn't brought by discovery. It took some investigation but I found the OID table with the desired serial number. (1.3.6.1.2.1.47.1.1.1.1 - entPhysicalSerialNum).
I am developing a sensor to parse the same but I am unable to determine if I am on the right track because I can't verify my progress. Can you guys help me with putting some logs under "Output and Artifacts>Discovery Log" link (Or any other place).
My sensor currently looks like(below).
new DiscoverySensor({
process: function(result) {
//var snmp = new SNMPResponse(result);
//logWarning('Executed successfully', 'Troubleshooting'); **Didn't work
var dlogger = new DiscoveryLogger(current.sys_id); **Ain't working either
dlogger.info('Executed successfully', 'Troubleshooting');
this.parseOutput(result.output);
},
parseOutput: function(output) {
},
type: "DiscoverySensor"
});
I am trying to figure out how to bring logs under "Output and Artifacts>Discovery Log" with "Test probe" option (Comes when we are under a specific probe).
Thanks,
Ankush Latawa
- Labels:
-
Discovery
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2014 11:49 AM
Try this:
g_device.log("Your message", this.getSensorName(), this.getEccQueueId());
Here's an example from DiscoveryFunctions() script include:
updatedHistory: function(gr, sensor, eccID) {
var fieldsChanged = this.getFieldsThatChanged(gr);
if (fieldsChanged.length > 0)
g_device.log("Updated device fields " + fieldsChanged.join(", "), sensor, eccID);
},
g_device is the product of a function call DeviceHistory.getFromContext()
DeviceHistory is a SN java object: Packages.com.snc.discovery.logging.DeviceHistory

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2014 12:53 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2014 01:27 PM
As far as I can tell, the g_device.log should log to the Discovery Log table you've indicated.
Are you running just the probe by clicking the "test probe" UI action in the probe? This doesn't process in quite the same way as if you ran an ad-hoc discovery against the IP address starting with Shazzam. I think you'd need to run a full discovery against the IP in order for g_device to work.
On Berlin, putting g_device.log("A Message", this.getSensorName(), this.getEccQueueId());
Yields a line in the log file of the table you screen shot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2014 04:26 PM
actually log statements are in the system log or script log statements modules.. Check there you might just see them... also I like using gs.log, search the community for that, plenty of references on its use!