The Hyper-V 2008 and 2012 Management Pack issues

It’s been a while since I blogged something about SCOM and some issues found during implementations, testing and playing with my beloved product. Recently I was busy doing lots of trainings, presentations not only on SCOM, but also SCVMM, Service Manager and Orchestrator, although SCOM is still my key goal in Microsoft. Throughout last three weeks I was able to install two System Center Operations Manager 2012 R2 environments where customers would like to replace Nagios with it. Well, funny enough, it was not the key goal, it appeared during configuration that Nagios can be replaced with SCOM and SCOM is even better. Oh well, it should a general truth, though :)

So this is first of blog posts about the issues I encountered and how to resolve them. At first the small production environment consisted of 50 servers. Most of them virtualized with XXX technology, though 7 servers were a Hyper-V node, 5 of them were 2008 R2 SP1, 2 were 2012. And the disrupt began. Immediately after both Management Packs for Hyper-V 2008 and 2012 were installed, 5 servers thrown out the following error:

Alert: Operations Manager failed to start a process

Source: HYPERV1.my.local

Path: HYPERV1.my.local

Last modified by: System

Last modified time: 11/26/2013 3:24:51 PM Alert description: The process started at 3:24:37 PM failed to create System.PropertyBagData. Errors found in output:

C:\Program Files\Microsoft Monitoring Agent\Agent\Health Service State\Monitoring Host Temporary Files 1\3059\GetDiskPartitionSpace.vbs(60, 5) Microsoft VBScript runtime error: Overflow

Command executed: "C:\Windows\system32\cscript.exe" /nologo "GetDiskPartitionSpace.vbs" HYPERV1.my.local

Working Directory: C:\Program Files\Microsoft Monitoring Agent\Agent\Health Service State\Monitoring Host Temporary Files 1\3059\

One or more workflows were affected by this.

Workflow name: Microsoft.Windows.HyperV.2008.DiskPartitionSpaceProvider.FreeSpaceCollectionRule

Instance name: FILESERVER

Instance ID: {9B3F7158-81D8-BD11-E6BF-6540C9CA856F}

Management group: MY-PROD

Thought – awesome. Another script debugging day. The key point here is the word Overflow. This means that the script couldn’t launch a task it supposed to do because of wrong data or calculation of parameters in that task. So let’s check what’s in line 60:

UsedSpacePerc = (UsedSpace * 100)/TotalSpace

This is an extract from bigger function which should calculate disk size for specific Virtual Machine and its usage. Now for the main dish – answer to question “Why?”. Because the UsedSpace and TotalSpace are query from results from WMI for Fixed VHDs. And fixed VHDs have Used Space and Total Space values as “0”. Who likes to divide by zero? Neither me, nor the script. The worst thing is that 2012 Management Pack will act the same only for fixed sized VHDs. So there are three rules which should be overridden – either globally disabled or disabled just for specific VM instances:

For Hyper-V 2008 Management Pack:

Free Disk Space Collection Rule

For Hyper-V 2012 Management Pack

Hyper-V 2012 Virtual Machine Hard Drive Percentage of Used Space Collection Rule

Virtual Machine Disk Free Space Collection Rule

For Hyper-V 2012 R2 Management Pack – didn’t have time to check yet :)

Happy Hyper-V monitoring.