Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-07-2024 10:13 AM
Hi,
Indicator source - cmdb_ci_outage table
indicator with breakdown on cmdb_ci_business_app
job with relative start 10 days ago and relative end 0 days ago .
Aim is to find out downtime of an application for a day . Consider an application A had an outage with begin date oct 4th 2024 1pm and end date oct 6th 2024 5pm .I need output as below
oct 4th -11 hrs
oct 5th -24 hrs
oct 6th - 17 hrs
So in indicator source I have used PA scripts as below
var diff = function(x, y)
{
return y.dateNumericValue() - x.dateNumericValue();
};
var minutes = function(x, y) {
return diff(x, y) / (60 * 1000);
};
var allDay = function() {
return 60 * 24;
};
var isToday = function(x) {
var gdt = new GlideDateTime(x);
var today = new GlideDateTime();
return gdt.getLocalDate().getValue() == today.getLocalDate().getValue();
// today.setNumericValue(score_start.dateNumericValue());
//return gdt.getDate().getValue() == today.getDate().getValue();
};
if (isToday(current.begin) && isToday(current.end)) {
minutes(current.begin, current.end);
} else if (isToday(current.begin)) {
minutes(current.begin, score_end);
} else if (isToday(current.end)) {
minutes(score_start, current.end);
} else {
allDay();
}
Here whenever I run historic job my current date is calculated as the date when I run that job manually and only else condition got executed .GlideDateTime is not considering the relative date from pa job . Please advise .
Thanks,
Ragavi
- Labels:
-
Architect