title: How to create SCOM management pack monitor with three states
body: <p>I develop integration with SCOM. But I am a green hand in it.</p>
  
  <p>I have created management pack XML and it works fine.</p>
  
  <p>Please review management pack below:</p>
  
  <pre><code>&lt;ManagementPack xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ContentReadable="true"&gt;
    &lt;Manifest&gt;
      &lt;Identity&gt;
        &lt;ID&gt;CloudMonix.ResourceMonitoring&lt;/ID&gt;
        &lt;Version&gt;1.0.0.0&lt;/Version&gt;
      &lt;/Identity&gt;
      &lt;Name&gt;CloudMonix Resource Monitoring Pack&lt;/Name&gt;
      &lt;References&gt;
        &lt;Reference Alias="System"&gt;
          &lt;ID&gt;System.Library&lt;/ID&gt;
          &lt;Version&gt;7.5.8501.0&lt;/Version&gt;
          &lt;PublicKeyToken&gt;31bf3856ad364e35&lt;/PublicKeyToken&gt;
        &lt;/Reference&gt;
        &lt;Reference Alias="SystemCenter"&gt;
          &lt;ID&gt;Microsoft.SystemCenter.Library&lt;/ID&gt;
          &lt;Version&gt;7.0.8437.0&lt;/Version&gt;
          &lt;PublicKeyToken&gt;31bf3856ad364e35&lt;/PublicKeyToken&gt;
        &lt;/Reference&gt;
      &lt;/References&gt;
    &lt;/Manifest&gt;
    &lt;TypeDefinitions&gt;
      &lt;EntityTypes&gt;
        &lt;ClassTypes&gt;
          &lt;ClassType ID="CloudMonix.ResourceMonitoring.Resource" Accessibility="Public" Abstract="false" Base="System!System.Entity" Hosted="false" Singleton="false"&gt;
            &lt;Property ID="ResourceId" Type="string" Key="true" CaseSensitive="false" Length="256" MinLength="1" /&gt;
            &lt;Property ID="ResourceType" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="1" /&gt;
            &lt;Property ID="ResourceStatus" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="1" /&gt;
            &lt;Property ID="ResourceGroups" Type="string" Key="false" CaseSensitive="false" Length="1024" MinLength="1" /&gt;
          &lt;/ClassType&gt;
        &lt;/ClassTypes&gt;
      &lt;/EntityTypes&gt;
    &lt;/TypeDefinitions&gt;
    &lt;Presentation&gt;
      &lt;Views&gt;
        &lt;View ID="CloudMonix.ResourceMonitoring.MainView" Accessibility="Public" Enabled="true" Target="CloudMonix.ResourceMonitoring.Resource" TypeID="SystemCenter!Microsoft.SystemCenter.StateViewType" Visible="true"&gt;
          &lt;Category&gt;Operations&lt;/Category&gt;
          &lt;Criteria&gt;
            &lt;InMaintenanceMode&gt;false&lt;/InMaintenanceMode&gt;
          &lt;/Criteria&gt;
          &lt;Presentation&gt;
  
            &lt;ColumnInfo Index="0" SortIndex="0" Width="100" Grouped="false" Sorted="true" IsSortable="true" Visible="true" SortOrder="Descending"&gt;
              &lt;Name&gt;State&lt;/Name&gt;
              &lt;Id&gt;CloudMonix.ResourceMonitoring.Resource&lt;/Id&gt;
            &lt;/ColumnInfo&gt;
  
            &lt;ColumnInfo Index="1" SortIndex="-1" Width="100" Grouped="false" Sorted="false" IsSortable="true" Visible="true" SortOrder="Ascending"&gt;
              &lt;Name&gt;Resource Type&lt;/Name&gt;
              &lt;Id&gt;ResourceType&lt;/Id&gt;
            &lt;/ColumnInfo&gt;
            &lt;ColumnInfo Index="2" SortIndex="-1" Width="100" Grouped="false" Sorted="false" IsSortable="true" Visible="true" SortOrder="Ascending"&gt;
              &lt;Name&gt;Resource Name&lt;/Name&gt;
              &lt;Id&gt;DisplayName&lt;/Id&gt;
            &lt;/ColumnInfo&gt;
            &lt;ColumnInfo Index="3" SortIndex="-1" Width="100" Grouped="false" Sorted="false" IsSortable="true" Visible="true" SortOrder="Ascending"&gt;
              &lt;Name&gt;Resource Status&lt;/Name&gt;
              &lt;Id&gt;ResourceStatus&lt;/Id&gt;
            &lt;/ColumnInfo&gt;
            &lt;ColumnInfo Index="4" SortIndex="-1" Width="100" Grouped="false" Sorted="false" IsSortable="true" Visible="true" SortOrder="Ascending"&gt;
              &lt;Name&gt;Resource Groups&lt;/Name&gt;
              &lt;Id&gt;ResourceGroups&lt;/Id&gt;
            &lt;/ColumnInfo&gt;
          &lt;/Presentation&gt;
          &lt;Target /&gt;
        &lt;/View&gt;
      &lt;/Views&gt;
      &lt;Folders&gt;
        &lt;Folder ID="CloudMonix.ResourceMonitoring.MainFolder" Accessibility="Public" ParentFolder="SystemCenter!Microsoft.SystemCenter.Monitoring.ViewFolder.Root" /&gt;
      &lt;/Folders&gt;
      &lt;FolderItems&gt;
        &lt;FolderItem ElementID="CloudMonix.ResourceMonitoring.MainView" Folder="CloudMonix.ResourceMonitoring.MainFolder" /&gt;
      &lt;/FolderItems&gt;
    &lt;/Presentation&gt;
    &lt;LanguagePacks&gt;
      &lt;LanguagePack ID="ENU" IsDefault="false"&gt;
        &lt;DisplayStrings&gt;
          &lt;DisplayString ElementID="CloudMonix.ResourceMonitoring"&gt;
            &lt;Name&gt;CloudMonix Resource Monitoring&lt;/Name&gt;
            &lt;Description&gt;&lt;/Description&gt;
          &lt;/DisplayString&gt;
          &lt;DisplayString ElementID="CloudMonix.ResourceMonitoring.MainFolder"&gt;
            &lt;Name&gt;CloudMonix Folder&lt;/Name&gt;
            &lt;Description&gt;&lt;/Description&gt;
          &lt;/DisplayString&gt;
          &lt;DisplayString ElementID="CloudMonix.ResourceMonitoring.MainView"&gt;
            &lt;Name&gt;CloudMonix Resource View&lt;/Name&gt;
            &lt;Description&gt;&lt;/Description&gt;
          &lt;/DisplayString&gt;
          &lt;DisplayString ElementID="CloudMonix.ResourceMonitoring.Resource"&gt;
            &lt;Name&gt;CloudMonix Resource&lt;/Name&gt;
            &lt;Description&gt;&lt;/Description&gt;
          &lt;/DisplayString&gt;
          &lt;DisplayString ElementID="CloudMonix.ResourceMonitoring.Resource" SubElementID="ResourceId"&gt;
            &lt;Name&gt;Resource Id&lt;/Name&gt;
            &lt;Description&gt;&lt;/Description&gt;
          &lt;/DisplayString&gt;
          &lt;DisplayString ElementID="CloudMonix.ResourceMonitoring.Resource" SubElementID="ResourceType"&gt;
            &lt;Name&gt;Resource Type&lt;/Name&gt;
            &lt;Description&gt;&lt;/Description&gt;
          &lt;/DisplayString&gt;
          &lt;DisplayString ElementID="CloudMonix.ResourceMonitoring.Resource" SubElementID="ResourceStatus"&gt;
            &lt;Name&gt;Resource Status&lt;/Name&gt;
            &lt;Description&gt;&lt;/Description&gt;
          &lt;/DisplayString&gt;
          &lt;DisplayString ElementID="CloudMonix.ResourceMonitoring.Resource" SubElementID="ResourceGroups"&gt;
            &lt;Name&gt;Resource Groups&lt;/Name&gt;
            &lt;Description&gt;&lt;/Description&gt;
          &lt;/DisplayString&gt;
        &lt;/DisplayStrings&gt;
      &lt;/LanguagePack&gt;
    &lt;/LanguagePacks&gt;
  &lt;/ManagementPack&gt;
  </code></pre>
  
  <p>I have installed this management pack using SCOM <a href="https://msdn.microsoft.com/ru-ru/library/bb437500.aspx" rel="nofollow noreferrer">SDK</a> and <a href="https://msdn.microsoft.com/en-us/library/hh329087.aspx" rel="nofollow noreferrer">ImportManagementPack</a> method.</p>
  
  <p>Also I have developed Inbound Connector as described in <a href="https://msdn.microsoft.com/en-us/library/hh329020.aspx" rel="nofollow noreferrer">example</a>.</p>
  
  <p>I can send discovery data, performance metrics and events using my connector. And it works fine.</p>
  
  <p>The result of successful import is on the screenshot:
  <a href="https://i.stack.imgur.com/ZlDyo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZlDyo.png" alt="enter image description here"></a></p>
  
  <p>The monitoring objects were created correctly.</p>
  
  <p>But these objects have <code>Not monitored</code> Health State.</p>
  
  <p><strong>My main question is how to change Health State?</strong></p>
  
  <p>My logic for Health State is very simple:</p>
  
  <ol>
  <li>If <code>Resource Status</code> (please look this property in the screenshot and in management pack XML) property is equal to <code>Ready</code> then Health State is <code>Success</code>.</li>
  <li>If <code>Resource Status</code> property is equal to <code>Down</code> then Health State is <code>Error</code>.</li>
  <li>Otherwise Health State is <code>Not monitored</code>.</li>
  </ol>
  
  <p>I have reviewed many documents (<a href="https://blogs.technet.microsoft.com/momteam/2008/03/14/operations-manager-2007-sdk-documentation-updates/" rel="nofollow noreferrer">here</a> and <a href="https://technet.microsoft.com/en-us/library/hh457603%28v=sc.12%29.aspx?f=255&amp;MSPPError=-2147217396" rel="nofollow noreferrer">here</a>) and found that I need to create monitor, monitor types, expression rules for changing Health State.</p>
  
  <p>Also I have checked XML examples <a href="https://systemcenter.wiki/?GetCategory=System%20Center%20Operations%20Manager%20%28version%201801%29" rel="nofollow noreferrer">here</a>.</p>
  
  <p>But I don't understand how to define my expressions and how to add necessary information to management pack XML file.</p>
  
  <p>The best answer for me is complete XML example with implementation of expression rules of my logic.</p>
  
  <p>Thanks in advance.</p>