Custom WMI Descovery rule for _Total Hyper-V logical processor counter doesn't work

Maks Cur 196 Reputation points
2020-11-04T17:29:23.407+00:00

Hello.

How I can make it right?
I created MP for monitoring _Total counter of Hyper-V Logical Processor instanse in perfmon. But WMI Descovery rule doesn't work and I don't get instans of my custom class that represent "_Total" counter. I enable that descovery by override for chosen Hyper-V server. But only geting error 10409 on scom server:

Object enumeration failed

Query: 'SELECT Name FROM Win32_PerfFormattedData_HvStats_HyperVHypervisorLogicalProcessor WHERE Name='_Total''

HRESULT: 0x80041010
Details: Invalid class

One or more workflows were affected by this.

Workflow name: Custom.HyperV2012R2.LogicalProcessor.Total.Discovery
Instance name: %scom server FQDN%
Instance ID: {%SCOM server ID%}
Management group: %Management Group Name%

My management pack:

<?xml version="1.0" encoding="utf-8"?>
<ManagementPack SchemaVersion="2.0" ContentReadable="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Manifest>
    <Identity>
      <ID>MP.Custom.HyperV.2012R2</ID>
      <Version>1.0.0.7</Version>
    </Identity>
    <Name>Custom Hyper-V 2012R2 MP</Name>
    <References>
      <Reference Alias="SCDW">
        <ID>Microsoft.SystemCenter.DataWarehouse.Library</ID>
        <Version>7.1.10226.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="SC">
        <ID>Microsoft.SystemCenter.Library</ID>
        <Version>7.0.8433.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="Windows">
        <ID>Microsoft.Windows.Library</ID>
        <Version>7.5.8501.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="System">
        <ID>System.Library</ID>
        <Version>7.5.8501.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="Performance">
        <ID>System.Performance.Library</ID>
        <Version>7.0.8433.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
    </References>
  </Manifest>
  <TypeDefinitions>
    <EntityTypes>
      <ClassTypes>
        <ClassType ID="Custom.HyperV2012R2.LogicalProcessor.Total" Accessibility="Public" Base="System!System.Entity" Abstract="false" Hosted="false" Singleton="false" Extension="false">
          <Property ID="Name" Type="string" AutoIncrement="false" Key="true" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" />
        </ClassType>
      </ClassTypes>
    </EntityTypes>
  </TypeDefinitions>
  <Monitoring>
    <Discoveries>
      <Discovery ID="Custom.HyperV2012R2.LogicalProcessor.Total.Discovery" Enabled="false" Target="Windows!Microsoft.Windows.Server.Computer" ConfirmDelivery="false" Remotable="false" Priority="Normal">
        <Category>Discovery</Category>
        <DiscoveryTypes>
          <DiscoveryClass TypeID="Custom.HyperV2012R2.LogicalProcessor.Total">
            <Property PropertyID="Name" />
            <Property TypeID="System!System.Entity" PropertyID="DisplayName" />
          </DiscoveryClass>
        </DiscoveryTypes>
        <DataSource ID="DS" TypeID="Windows!Microsoft.Windows.WmiProviderWithClassSnapshotDataMapper">
          <NameSpace>\\$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$\root\cimv2</NameSpace>
          <Query>SELECT Name FROM Win32_PerfFormattedData_HvStats_HyperVHypervisorLogicalProcessor WHERE Name='_Total'</Query>
          <Frequency>43200</Frequency>
          <ClassId>$MPElement[Name="Custom.HyperV2012R2.LogicalProcessor.Total"]$</ClassId>
          <InstanceSettings>
            <Settings>
              <Setting>
                <Name>$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Name>
                <Value>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
              </Setting>
              <Setting>
                <Name>$MPElement[Name="Custom.HyperV2012R2.LogicalProcessor.Total"]/Name$</Name>
                <Value>$Data/Property[@Name='Name']$</Value>
              </Setting>
            </Settings>
          </InstanceSettings>
        </DataSource>
      </Discovery>
    </Discoveries>
    <Rules>
      <Rule ID="Custom.HyperV2012R2.LogicalProcessor.Total.TotalUtilization.Counter.Rule" Enabled="false" Target="Custom.HyperV2012R2.LogicalProcessor.Total" ConfirmDelivery="false" Remotable="false" Priority="Normal" DiscardLevel="100">
        <Category>PerformanceCollection</Category>
        <DataSources>
          <DataSource ID="System.Performance.OptimizedDataProvider" TypeID="Performance!System.Performance.OptimizedDataProvider">
            <ComputerName>.</ComputerName>
            <CounterName>% Total Run Time</CounterName>
            <ObjectName>Hyper-V Hypervisor Logical Processor</ObjectName>
            <InstanceName>_Total</InstanceName>
            <AllInstances>false</AllInstances>
            <Frequency>300</Frequency>
            <Tolerance>1</Tolerance>
            <ToleranceType>Absolute</ToleranceType>
            <MaximumSampleSeparation>10</MaximumSampleSeparation>
          </DataSource>
        </DataSources>
        <WriteActions>
          <WriteAction ID="Microsoft.SystemCenter.CollectPerformanceData" TypeID="SC!Microsoft.SystemCenter.CollectPerformanceData" />
          <WriteAction ID="Microsoft.SystemCenter.DataWarehouse.PublishPerformanceData" TypeID="SCDW!Microsoft.SystemCenter.DataWarehouse.PublishPerformanceData" />
        </WriteActions>
      </Rule>
    </Rules>
  </Monitoring>
  <LanguagePacks>
    <LanguagePack ID="ENU" IsDefault="true">
      <DisplayStrings>
        <DisplayString ElementID="Custom.HyperV2012R2.LogicalProcessor.Total">
          <Name>Custom Hyper-V 2012 R2 Logical Processor Total Object</Name>
          <Description>Represent object for _Total Logical Processor Utilization Counter</Description>
        </DisplayString>
        <DisplayString ElementID="Custom.HyperV2012R2.LogicalProcessor.Total.Discovery">
          <Name>Custom HyperV2012R2 LogicalProcessor Total Discovery</Name>
          <Description>Discovery Rule Cusom Hyper-V 2012 R2 Logical Processor Total Object</Description>
        </DisplayString>
        <DisplayString ElementID="Custom.HyperV2012R2.LogicalProcessor.Total.TotalUtilization.Counter.Rule">
          <Name>Custom Hyper-V 2012 R2 Logical Processor Total Total Utilization Counter Rule</Name>
          <Description>Rule for Hyper-V Hypervisor Logical Processor _Total Counter in PerfMon</Description>
        </DisplayString>
        <DisplayString ElementID="Custom.HyperV2012R2.LogicalProcessor.Total" SubElementID="Name">
          <Name>Name</Name>
          <Description>Total Logical Processor Counter</Description>
        </DisplayString>
        <DisplayString ElementID="MP.Custom.HyperV.2012R2">
          <Name>Custom Hyper-V 2012R2 MP</Name>
          <Description>Пакет для мониторинга Hyper-V</Description>
        </DisplayString>
      </DisplayStrings>
      <KnowledgeArticles></KnowledgeArticles>
    </LanguagePack>
  </LanguagePacks>
</ManagementPack>
Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,413 questions
Windows Server Management
Windows Server Management
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Management: The act or process of organizing, handling, directing or controlling something.
420 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CyrAz 5,181 Reputation points
    2020-11-04T18:07:59.957+00:00

    How exactly did you do your override to enable that discovery for hyperv servers?

    From the error you get, the discovery rule is running on the SCOM Management and is obviously failing since that counter doesn't exist except on HyperV servers.

    On a side note, why are you using such a discovery? Wouldn't it be easier to simply import the HyperV MP and to target the perf rule at the HyperV Server class?