- 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-27-2016 10:27 AM
Pieter,
Already tried this.
Added some GS.log lines in the script, but they don't log anything. It seems the script is not even executed due to the error.
Andre
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2016 10:43 AM
Check your parenthesis and semi colons on line 1 and 3.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2016 10:54 AM
No looks good, I should not try this on an iPhone.
Can you send a screenshot of the list view of the script that shows the column name?
Does the OOB script for incident.age.days work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2016 11:20 AM
I cannot figure out is that is actually used in the oob jobs, so I dont know if that actually works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2016 11:23 AM
Just checked, and that works, or at least does not give any errors.