Discovery Probes and Sensors
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2016 08:12 PM
We recently upgraded our instance from Eureka to Geneva.
Custom probes are not working, in the discovery dashboard we are getting Major Minor version mismatch.
We fixed that though few probes are not working, what might be the issue here?
Do we have to update the version of the port probes too? which is not in the dashboard by the way.
Regards,
Sundaresan M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2016 11:05 PM
What kind of errors are you seeing in the logs? Do you see any activity with the custom probes at all?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2016 12:43 AM
Hi Tanti,
Thanks for the response, one of the probes is not even getting triggered.
If the major version is reverted will the error or warning pertains in the discovery dashboard?
In the version history if it says history rather than previous near the system upgrade do we need to change the version of that one too?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2016 05:18 AM
I reverted the version, now this is the post processing script :
new ProbePostProcessor({
/**
* Runs the probe instance
*/
process : function() {
related_data.tDataObj = {};
// key (property name) is currentBlock + ':' + field name...
var matchMap = {
'1:Manufacturer' : 'manufacturer',
'1:Product Name' : 'model_id',
'1:Version' : 'model_number',
'1:Serial Number' : 'system_serial_number',
'1:UUID' : 'uuid_serial',
'2:Serial Number' : 'baseboard_serial',
'3:Serial Number' : 'chassis_serial'
};
var handleRegex = /.*DMI type ([0-9]+).*/;
var valueRegex = /^\s*([^:]*)\s*:\s*(.*?)\s*$/;
var currentBlock = -1;
/**
* Output for dmidecode will be in this format:
* Handle 0x0107, DMI type 3, 6 bytes
* Serial Number: VMware-42 08 4b d3 41 9e eb e3-5e fd 7e 7b 42 42 c0 66;
* UUID: 42084BD3-419E-EBE3-5EFD-7E7B4242C066
*
* Handle 0x0105, DMI type 23, 13 bytes
* ...
*
* The following code splits the output into blocks (around "Handle 0x").
* A bit of optimization is done based on the fact that we only care about
* DMI types between 1~3.
* Skip processing on blocks with types that are not in this range.
* If the type is between 1~3, we grab the field names that we care about and
* save those in tDataObj.
*/
var blocks = output.split(/Handle\s0x/);
for(var i = 0; i < blocks.length; i++) {
var block = blocks[i];
var mat = handleRegex.exec(block);
if (mat) {
currentBlock = parseInt(mat[1]);
// we're only interested in blocks 1 through 3...
if (currentBlock < 1 || currentBlock > 3)
continue;
}
var values = block.split(/\n/);
for (var j = 0; j < values.length; j++) {
var value = values[j].trim();
mat = value.match(valueRegex);
if (!mat)
continue;
var fieldName = mat[1];
var fieldValue = mat[2];
var curName = matchMap['' + currentBlock + ':' + fieldName];
if (curName == null)
continue;
// don't overwrite data we already have, as sometimes there are duplicate blocks with no data...
if (related_data.tDataObj[curName] == null)
related_data.tDataObj[curName] = fieldValue;
}
}
}
});
This is my Sensor script :
function(ciData, debug, sensor) {
var ci_data = ciData.getData();
var tDataObj = related_data.tDataObj;
if (gs.nil(tDataObj))
return;
if (JSUtil.notNil(tDataObj.manufacturer) || JSUtil.notNil(tDataObj.model_id)) {
var mm = MakeAndModelJS.fromNames(tDataObj.manufacturer, tDataObj.model_id, "hardware");
ci_data.manufacturer = mm.getManufacturerSysID();
ci_data.model_id = mm.getModelNameSysID();
}
if (JSUtil.notNil(tDataObj.model_number))
ci_data.model_number = tDataObj.model_number;
var snm = new SerialNumberManager();
if (JSUtil.notNil(tDataObj.system_serial_number))
snm.add('system', tDataObj.system_serial_number);
if (JSUtil.notNil(tDataObj.chassis_serial))
snm.add('chassis', tDataObj.chassis_serial);
if (JSUtil.notNil(tDataObj.uuid_serial))
snm.add('uuid', tDataObj.uuid_serial);
if (JSUtil.notNil(tDataObj.baseboard_serial))
snm.add('baseboard', tDataObj.baseboard_serial);
var srlArr = snm.getSerialsForCIData();
if (JSUtil.notNil(srlArr))
ci_data.serial_number = snm.getSerialNumber();
addToCIData(ciData, srlArr);
function addToCIData(ciData, srls) {
var rl = new CIRelatedList('cmdb_serial_number', 'cmdb_ci');
for(var i=0; i<srls.length; i++)
rl.addRec(srls[i]);
ciData.addRelatedList(rl);
}
}
When I test the probe, I am getting this :
Script error in sensor: MultiProbe script error for probe `Linux - Hardware Information`: ReferenceError: "related_data" is not defined.
System Logs -> Errors
JavaScript evaluation error on:
//The ID sensor is an implementation of the multi sensor. In the related list "Responds to Probes", the script will be processed first.
new DiscoveryJSONIDSensor({
//
// this sensor uses the common script include class "DiscoveryIDSensor"
//
type: "Linux Identity"
});
: org.mozilla.javascript.JavaScriptException: MultiProbe script error for probe `Linux - Hardware Information`: ReferenceError: "related_data" is not defined.: org.mozilla.javascript.gen.c7701.call(sys_script_include.778011130a0a0b2500c4595ad1d1d768:13)
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1227)
org.mozilla.javascript.BaseFunction.applyOrCall(BaseFunction.java:490)
org.mozilla.javascript.BaseFunction.execMethod(BaseFunction.java:195)
org.mozilla.javascript.IdFunction.call(IdFunction.java:78)
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1227)
org.mozilla.javascript.gen.c248.call(sys_script_include.d22e7bdbc0a8016500a18e024bfc9aa3:4)
org.mozilla.javascript.BaseFunction.construct(BaseFunction.java:236)
org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:1329)
org.mozilla.javascript.gen.c8744.call(discovery_sensor.8e9fbf340a0a0baa4d8ded98d80fa9ba:3)
org.mozilla.javascript.gen.c8744.exec(discovery_sensor.8e9fbf340a0a0baa4d8ded98d80fa9ba)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:233)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:105)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:72)
com.snc.discovery.DiscoveryUtils.evaluateStringWithCurrent(DiscoveryUtils.java:91)
com.snc.discovery.sensor.processor.JavascriptSensor.process(JavascriptSensor.java:54)
com.snc.discovery.sensor.ASensor.processSensor(ASensor.java:79)
com.snc.discovery.sensor.ASensor.run(ASensor.java:73)
com.snc.discovery.SensorEvaluator.run(SensorEvaluator.java:39)
com.snc.discovery.SensorProcessor.processSensor(SensorProcessor.java:240)
com.snc.discovery.SensorProcessor.processSensors(SensorProcessor.java:191)
com.snc.discovery.SensorProcessor.process(SensorProcessor.java:133)
sun.reflect.GeneratedMethodAccessor1480.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:256)
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1227)
org.mozilla.javascript.gen.c7593.call(sys_trigger.b807101937dda200207bdb9643990e92:5)
org.mozilla.javascript.gen.c7593.exec(sys_trigger.b807101937dda200207bdb9643990e92)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:233)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:105)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:72)
com.glide.script.Evaluator.evaluatePossiblePrefixedString(Evaluator.java:192)
com.glide.job.RunScriptJob.evaluateScript(RunScriptJob.java:158)
com.glide.job.RunScriptJob.runScript(RunScriptJob.java:121)
com.glide.job.RunScriptJob.execute(RunScriptJob.java:88)
com.glide.schedule.JobExecutor.execute(JobExecutor.java:80)
com.glide.schedule.GlideScheduleWorker.executeJob(GlideScheduleWorker.java:191)
com.glide.schedule.GlideScheduleWorker.process(GlideScheduleWorker.java:135)
com.glide.schedule.GlideScheduleWorker.run(GlideScheduleWorker.java:57)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2016 04:32 PM
Hi Sundaresan,
Have you taken a look at this video? Discovery Probe and Sensor Versioning | Introduction - YouTube