SCOM 2012 R2: Wrong calculation in server availability report
Issue
Customer reported a strange issue in SCOM Reporting wherein they were getting incorrect downtime calculation under Microsoft Generic Report Library Availability report.
According to them, nothing was changed in their SCOM Reporting. There were only two changes in their SCOM environment in last 6 months:
- SCOM infra Scale Out (Moved SQL DW and DB on SQL Cluster).
- UR9 update.
Troubleshooting
Check the issue by fetching a sample Availability report for few servers.
http://systemcentermvp.com/wp-content/uploads/sites/12583/2016/08/15.png
I checked the Downtime Periods under Availability Report.
http://systemcentermvp.com/wp-content/uploads/sites/12583/2016/08/23.png
When you check the Downtime Duration table in the report, it is not showing the correct downtime calculation.
http://systemcentermvp.com/wp-content/uploads/sites/12583/2016/08/33.png
Then check the same report in the development environment and get the correct Downtime Duration there.
http://systemcentermvp.com/wp-content/uploads/sites/12583/2016/08/42.png
Compare the report definition of Downtime Report from both the SCOM environments (Production and Development).
DOWNLOADING REPORT DEFINITION FILE (RDL FILE)
** **
Below is the process to download the RDL file from SCOM report server:
1. Open the report URL through Internet Explorer.
2. Click on Microsoft.SystemCenter.DataWarehouse.Report.Library
http://systemcentermvp.com/wp-content/uploads/sites/12583/2016/08/52.png
- Look for Microsoft.SystemCenter.DataWarehouse.Report.Downtime RDL file.
4. Select Manage option from drop down.
http://systemcentermvp.com/wp-content/uploads/sites/12583/2016/08/62.png
- Click on Download button.
6. Save the file at desired location.
http://systemcentermvp.com/wp-content/uploads/sites/12583/2016/08/72.png
Once the RDL files are downloaded from both the SCOM environments, need to compare both the files. You can open the files using Notepad.
While comparing the files I found below expression which was causing the issue:
=Code.FormatTimeInterval(Code.GetWorkingDuration(IIF(IsNothing(Fields!FromDateTime.Value),"", Code.FormatDateTime("G",Code.ToReportDate(Fields!FromDateTime.Value))), IIF(IsNothing(Fields!ToDateTime.Value),"", Code.FormatDateTime("G",Code.ToReportDate(Fields!ToDateTime.Value)))))”
http://systemcentermvp.com/wp-content/uploads/sites/12583/2016/08/81.png
The Function GetWorkingDuration does not exist in the SCOM development environment.
http://systemcentermvp.com/wp-content/uploads/sites/12583/2016/08/9.png
Rreplaced the incorrect expression with below one, which I took from my development environment:
=Code.FormatTimeInterval(DateDiff("s", Fields!FromDateTime.Value, Code.GetIntervalEndValue(Fields!ToDateTime.Value)))
After saving the file, it’s time to replace the incorrect RDL file with the new one in which we made changes.
IMPORTING RDL FILE
** **
1. Click on Replace button under Microsoft.SystemCenter.DataWarehouse.Report.Downtime.
http://systemcentermvp.com/wp-content/uploads/sites/12583/2016/08/10.png
- Browse the RDL file in which changes were made.
3. Click OK to continue.
http://systemcentermvp.com/wp-content/uploads/sites/12583/2016/08/111.png
4. Click Apply button to apply the changes.
http://systemcentermvp.com/wp-content/uploads/sites/12583/2016/08/121.png
TESTING
** **
Once the changes are applied, it’s time to run the report again and check the Downtime period report.
I checked the Downtime period report using same parameters used before and able to see the correct downtime calculation now.
http://systemcentermvp.com/wp-content/uploads/sites/12583/2016/08/131.png