[Update: Here is the SPF UR11, that has the fix:
https://support.microsoft.com/en-us/kb/3184834 which updates SPF to 7.2.2386.0 and has been verified to keep Usage operational]
We received a signal from one of our service provider customers in the Netherlands, that they were unable to get Azure Pack to see any usage records.
If you have ever configured Usage, you probably recall that the Azure Pack Usage Collector service runs every 3 minutes for every resource provider to collect usage data from the OperationsManagerDW database. However, the WAP Usage Collector actually depends on Service Provider Foundation (SPF) to connect to the database and run an SQL query against the OperationsManagerDW database.
The WAP usage framework is quite a complex chain of interacting components with several different actors: VMM, SCOM, SPF, WAP and usage consumers such as Cloud Cruiser. It takes a very good understanding of the interaction of these components to troubleshoot WAP Usage and several great blogs have been published to troubleshoot Usage. If you take a look at the Usage section of my Azure Pack Wiki, you’ll quickly find them.
In this case, two WAP specialists at the service provider, had already gone through all the troubleshooting steps and were quite confident their configuration was correct. So that’s where I joined the party, and to tripple check, I again went through an analysis of the Usage configuration. For analysis of a WAP Usage problem, I always use the slide below, which I prepared for a talk to the Houston System Center User Group, several years ago. It helps you understand the order in which you can analyze a WAP Usage problem.
[image not preserved in the archive]
So I started checking if VMM agents were able to collect performance data (1), if the integration between VMM and SCOM was operational (2), if performance data was moved from the SCOM Operational Database to the SCOM DataWarehouse database (3), if SPF could connect to SCOM (4), if there was any usage data in the SPF usage table (5), if there was usage data for all existing resource providers (6), if the WAP Usage Collector was querying SPF for usage data every 3 minutes (7), if usage data was transferred from temporary SPF usage table to WAP Usage Database (8), if for instance Cloud Cruiser was able to connect to the Usage Service API and receive json file from WAP (9) and that data properly ended up in the Cloud Cruiser database (10).
All-in-all quite a complex chain, but if you understand this chain, it is obvious where to start.
I quickly concluded that VMM to SCOM was configured correctly and produced the correct results. The problem had to be in SPF and after I checked that the SPF was correctly configured to know how to connect to SCOM, I had to conclude I was dealing with a bug in SPF UR10.
There are two scenario’s that you can run into this issue:
- You install a fresh copy of SPF and directly upgrade to UR10 and then configure Usage
- You have already installed SPF with UR9, upgrade to UR10 and then configure Usage
I assume that if you already had a working Usage configuration and then upgrade to UR10, you should have no problems.
In this case there was a third possible culprit: SCOM 2016. As part of the WSSC 2016 TAP, the service provider had received approval from Microsoft to upgrade SCOM 2012 R2 to SCOM 2016 TP5. Because WAP Usage had not been configured up to then, this should not cause any problems … but it did. It was easy to blame an unsupported combination of WAP 2013 and SCOM 2016 for breaking Usage … but it didn’t.
After sending a message to the MVP Azure Pack DL, I quickly got a reply from the people in the Azure Pack Team who pointed me to the PM responsible for Usage and a senior escalation engineer who provided me a private fix to try out.
So let me explain what I did to make WAP/SPF Usage work again:
Configuration
| SCOM | 2016 TP5, 7.2.11469.0 |
| SPF | 2012 R2 UR10 |
| VMM Console on SPF | 2012 R2 UR10 |
| VMM | 2012 R2 UR10 |
| WAP | 2012 R2 UR10 |
Issue
The [SCSPFDB].[scspf].[SpfUsageRecord] table remains empty. If you run a REST query against SPF for usage data from the WAP Admin portal, you receive a json file which only shows two brackets: [ ].
Fix
Request private fix WSSC-8286488-Usage-UR10-fix.zip from Microsoft Support or wait until Windows Azure Pack UR11 becomes available.
To install the fix, on the SPF server(s):
- Open Administrative CMD prompt
- Stop IIS. – NET STOP W3SVC
- Change directory to C:\inetpub\SPF\Usage\bin
- Rename existing file REN Microsoft.SystemCenter.Foundation.Billing.dll Microsoft.SystemCenter.Foundation.Billing.dll.UR10
- Rename existing file REN Microsoft.SystemCenter.Foundation.Usage.dll Microsoft.SystemCenter.Foundation.Usage.dll.UR10
- Copy file – COPY c:\temp\WSSC-8286488-Fix\Microsoft.SystemCenter.Foundation.Billing.dll
- Copy file – COPY c:\temp\WSSC-8286488-Fix\Microsoft.SystemCenter.Foundation.Usage.dll
- Start IIS again, NET START W3SVC
After 3 minutes or so you should expect to see the SPF Records table to fill up and the LastID should increase.
Explanation
In UR10 Microsoft fixed an issue where WAP/SPF could get incomplete usage records because the SCOM OperationsManagerDW database hadn’t fully completed the aggregation of performance data. Therefore an IF statement was added to the SQL query used to pull the data from the DataWarehouse. But as it turned out, there must have been a regression when setting up Susage from new and this caused the time brackets to be wrong leading to no records being returned.
— We fetch the usage record from SCOM only if the aggregation of time interval greater that current time interval has started
— We do so because, it is possible that the the aggregation for current time interval has not completed and we end up loosing records.
— As there is no way to identify if current interval aggregation has completed or not in SCOM, the condition will gurantee that
— we don’t loose records from current cycle.
IF (SELECT COUNT(*) FROM [dbo].[StandardDatasetAggregationHistory] WHERE [AggregationTypeId] = 20 AND [AggregationDateTime] > @StartTime) > 0
BEGIN
…. magic happens here….
END
The StartTime/Endtime was pulled from the last time we successfully pulled records in the SPF DB and when this didn’t have any records then this didn’t work properly. In the fix there is an additional parameter that is parse if there are no records in the SPF UsageRecords DB and this would allow the first records pull to enter the statement.
The query itself is part of the SPF Billing DLL, so that is why that DLL plus the Usage.DLL are replaced by the fix.
Result
We started SQL Server Profiler at the server running the OperationsManagerDW database, to monitor the SQL queries that SPF triggers every 3 minutes on behalf of the WAP Usage Collector.
Because we didn’t see results immediately, we decided to restart the SPF servers one by one and voila … the Usage data showed up in the SPFUsageRecord database. You can run this query to quickly verify this.
SELECT
TOP 1000 [Id]
,[RecordIndex]
,[ResourceId]
,[StartTimeTickCount]
,[EndTimeTickCount]
,[ServiceType]
,[SubscriptionId]
FROM
[SCSPFDB].[scspf].[SpfUsageRecord]
But be quick, because before you know it, this Usage data is transferred to the WAP Usage database, and only one SPF Usage record should remain in the SPF Usage table.
The SQL Query you should look for is::
datetime
08:00:00′
09:00:00′
PS
Thank you Joey Hofstede and Jimmy Bandell (both working at ITON) for offering me the opportunity to help you fix this problem and blog about it. Also many thanks to WAP PM’s Walter Oliver and Riyaz Pishori. Lastly, many kudos to Lars Bentzen, senior escalation engineer from the UK who actually provided the fix and helped me to understand what caused the problem and how it was solved.