- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2016 11:37 PM
In Performance Analytics we are trying to create a breakdown, based on the Age of CI, referenced in the cert_audit_result table
It should be based on the sys_created_on and the time the script actually runs picking up the system date/time.
Our input is the cert_audit_results table, and then the referenced CI on a record where we want to use it's sys_created_on field for the calculation of the CI age.
We get below error in our collector job log:
Error during JavaScript evaluation: Not all references of "current" are passed in by "arguments" script: var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var enddate= gs.nowDateTime();
var days=function(x,y){return diff(x,y)/(24*60*60*1000);};
days(current.cmdb_ci.sys_created_on, enddate);
Below the script and its settings.
I read the fields selection should match the field in the script, and I this it does.
Any suggestions what I am doing wrong ?
Solved! Go to Solution.
- Labels:
-
Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2016 01:29 AM
I have tried the below myself in an instance, and it does not produce errors.
var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var hours=function(x,y){return diff(x,y)/(60*60*1000);};
hours(current.configuration_item.sys_created_on, score_end);
Do you see something similar as below in the collection log:
Especially the line with "Fetching "sys_id,configuration_item.sys_created_on" from "cert_audit_result"" is interesting because here it passes configuration_item.sys_created_on as current.
One of the things I am wondering about is if the user that is used in the 'run as' in the collection job has the correct ACLs to fetch 'cert_audit_result.configuration_item'. It seems unlikely, and I am not sure what kind of error that would produce in the collection log, but I have seen stranger things.
Best regards,
Erik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2016 12:20 AM
Also tried the almost original script from incident.age.days:
Error during JavaScript evaluation: Not all references of "current" are passed in by "arguments" script: var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var days=function(x,y){return diff(x,y)/(24*60*60*1000);};
days(current.cmdb_ci.sys_created_on, score_end);
Gives the same error!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2016 03:16 AM
Hi Andre,
looking at 'cert_audit_result' table that is passed at source, I think it should be 'current.configuration_item.sys_created_on'.
The field referencing CI in 'cert_audit_result' is named 'configuration_item'.
Best regards,
Erik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2016 04:35 AM
Erik,
Thanks for the tip, but already tried this and still the same result!.
Andre
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2016 05:33 AM