Event Data in Web Availability Monitoring

Hi,

i am working with the Web Transaction Monitoring Template in SCOM 2016 to monitor the availability of some Websites. But when a website is not reachable, the alert generated by the monitor just says “see alert context for more details”. So users have to check the Health Explorer in SCOM to see what data is being returned. I would like to display the Statuscode of the website in the Alert description of the Monitor, so that the Users can see the real issue at first sight. Is there a way to extract the neccessary information fom the alert context and put it in the alert description? Maybe something like “$Data/Context/RequestResults/RequestResult/BasePageData/ResponseBody$”. I haven’t found a good documentation so far, so i hope that someone could help me.

Here are some of the monitors that I leverage with the Microsoft.SystemCenter.WebApplicationTest.WebTestProbe.DS DataSource. Their alert parameters might assist you.

    <MonitorTypes>
      <UnitMonitorType ID="Microsoft.SystemCenter.WebApplication.Community.MonitorType.WebTestProbe.CertificateExpiration" Accessibility="Internal">
        <MonitorTypeStates>
          <MonitorTypeState ID="Healthy" />
          <MonitorTypeState ID="Warning" />
          <MonitorTypeState ID="Critical" />
        </MonitorTypeStates>
        <Configuration>
          <xsd:element minOccurs="1" name="DaysToExpiryWarning" type="xsd:integer" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
        </Configuration>
        <OverrideableParameters>
          <OverrideableParameter ID="DaysToExpiryWarning" Selector="$Config/DaysToExpiryWarning$" ParameterType="int" />
        </OverrideableParameters>
        <MonitorImplementation>
          <MemberModules>
            <DataSource TypeID="MSWL!Microsoft.SystemCenter.WebApplicationTest.WebTestProbe.DS" ID="DS" />
            <!-- Define the OK/Healthy detection here -->
            <ConditionDetection ID="FilterOK" TypeID="System!System.ExpressionFilter">
              <Expression>
                <And>
                  <Expression>
                    <SimpleExpression>
                      <ValueExpression>
                        <XPathQuery Type="UnsignedInteger">RequestResults/RequestResult/BasePageData/DaysToExpiry</XPathQuery>
                      </ValueExpression>
                      <Operator>Greater</Operator>
                      <ValueExpression>
                        <Value Type="UnsignedInteger">$Config/DaysToExpiryWarning$</Value>
                      </ValueExpression>
                    </SimpleExpression>
                  </Expression>
                  <Expression>
                    <SimpleExpression>
                      <ValueExpression>
                        <XPathQuery Type="Boolean">RequestResults/RequestResult/BasePageData/CertificateExpired</XPathQuery>
                      </ValueExpression>
                      <Operator>NotEqual</Operator>
                      <ValueExpression>
                        <Value Type="Boolean">true</Value>
                      </ValueExpression>
                    </SimpleExpression>
                  </Expression>
                  <Expression>
                    <SimpleExpression>
                      <ValueExpression>
                        <XPathQuery Type="UnsignedInteger">RequestResults/RequestResult/BasePageData/MonitorSSLEvalResult</XPathQuery>
                      </ValueExpression>
                      <Operator>NotEqual</Operator>
                      <ValueExpression>
                        <!--0=unmonitored | so it does not change back to healthy when SSL evaluation does not happen-->
                        <Value Type="UnsignedInteger">0</Value>
                      </ValueExpression>
                    </SimpleExpression>
                  </Expression>
                </And>
              </Expression>
            </ConditionDetection>
            <!-- Define the Warning detection here -->
            <ConditionDetection ID="FilterWarning" TypeID="System!System.ExpressionFilter">
              <Expression>
                <And>
                  <Expression>
                    <SimpleExpression>
                      <ValueExpression>
                        <XPathQuery Type="UnsignedInteger">RequestResults/RequestResult/BasePageData/DaysToExpiry</XPathQuery>
                      </ValueExpression>
                      <Operator>LessEqual</Operator>
                      <ValueExpression>
                        <Value Type="UnsignedInteger">$Config/DaysToExpiryWarning$</Value>
                      </ValueExpression>
                    </SimpleExpression>
                  </Expression>
                  <Expression>
                    <SimpleExpression>
                      <ValueExpression>
                        <XPathQuery Type="Boolean">RequestResults/RequestResult/BasePageData/CertificateExpired</XPathQuery>
                      </ValueExpression>
                      <Operator>NotEqual</Operator>
                      <ValueExpression>
                        <Value Type="Boolean">true</Value>
                      </ValueExpression>
                    </SimpleExpression>
                  </Expression>
                </And>
              </Expression>
            </ConditionDetection>
            <!-- Define the Critical detection here -->
            <ConditionDetection ID="FilterCritical" TypeID="System!System.ExpressionFilter">
              <Expression>
                <SimpleExpression>
                  <ValueExpression>
                    <XPathQuery Type="Boolean">RequestResults/RequestResult/BasePageData/CertificateExpired</XPathQuery>
                  </ValueExpression>
                  <Operator>Equal</Operator>
                  <ValueExpression>
                    <Value Type="Boolean">true</Value>
                  </ValueExpression>
                </SimpleExpression>
              </Expression>
            </ConditionDetection>
          </MemberModules>
          <RegularDetections>
            <RegularDetection MonitorTypeStateID="Healthy">
              <Node ID="FilterOK">
                <Node ID="DS" />
              </Node>
            </RegularDetection>
            <RegularDetection MonitorTypeStateID="Warning">
              <Node ID="FilterWarning">
                <Node ID="DS" />
              </Node>
            </RegularDetection>
            <RegularDetection MonitorTypeStateID="Critical">
              <Node ID="FilterCritical">
                <Node ID="DS" />
              </Node>
            </RegularDetection>
          </RegularDetections>
        </MonitorImplementation>
      </UnitMonitorType>
      <UnitMonitorType ID="Microsoft.SystemCenter.WebApplication.Community.MonitorType.WebTestProbe.TransactionEvalResult" Accessibility="Internal">
        <MonitorTypeStates>
          <MonitorTypeState ID="Healthy" />
          <MonitorTypeState ID="Unhealthy" />
        </MonitorTypeStates>
        <Configuration>
          <xsd:element name="MatchCount" type="xsd:integer" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
          <xsd:element name="UnhealthyTransactionEvalResult" type="xsd:integer" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
        </Configuration>
        <OverrideableParameters>
          <OverrideableParameter ID="MatchCount" Selector="$Config/MatchCount$" ParameterType="int" />
        </OverrideableParameters>
        <MonitorImplementation>
          <MemberModules>
            <DataSource TypeID="MSWL!Microsoft.SystemCenter.WebApplicationTest.WebTestProbe.DS" ID="DS" />
            <ConditionDetection TypeID="System!System.ExpressionFilter" ID="FilterHealthy">
              <Expression>
                <SimpleExpression>
                  <ValueExpression>
                    <XPathQuery Type="UnsignedInteger">TransactionEvalResult</XPathQuery>
                  </ValueExpression>
                  <Operator>NotEqual</Operator>
                  <ValueExpression>
                    <!--1=healthy | 2=warning | 3=critical-->
                    <Value Type="UnsignedInteger">$Config/UnhealthyTransactionEvalResult$</Value>
                  </ValueExpression>
                </SimpleExpression>
              </Expression>
            </ConditionDetection>
            <ConditionDetection TypeID="System!System.ExpressionFilter" ID="FilterUnhealthy">
              <Expression>
                <SimpleExpression>
                  <ValueExpression>
                    <XPathQuery Type="UnsignedInteger">TransactionEvalResult</XPathQuery>
                  </ValueExpression>
                  <Operator>Equal</Operator>
                  <ValueExpression>
                    <Value Type="UnsignedInteger">$Config/UnhealthyTransactionEvalResult$</Value>
                  </ValueExpression>
                </SimpleExpression>
              </Expression>
              <SuppressionSettings>
                <MatchCount>$Config/MatchCount$</MatchCount>
              </SuppressionSettings>
            </ConditionDetection>
          </MemberModules>
          <RegularDetections>
            <RegularDetection MonitorTypeStateID="Healthy">
              <Node ID="FilterHealthy">
                <Node ID="DS" />
              </Node>
            </RegularDetection>
            <RegularDetection MonitorTypeStateID="Unhealthy">
              <Node ID="FilterUnhealthy">
                <Node ID="DS" />
              </Node>
            </RegularDetection>
          </RegularDetections>
        </MonitorImplementation>
      </UnitMonitorType>
    </MonitorTypes>
  </TypeDefinitions>
  <Monitoring>
    <Monitors>
      <UnitMonitor ID="Microsoft.SystemCenter.WebApplication.Community.UnitMonitor.WebTestProbe.TransactionEvalResult.Warning" Accessibility="Internal" Enabled="true" Target="MSWL!Microsoft.SystemCenter.WebApplicationTest.WebTest" ParentMonitorID="MSWL!Microsoft.SystemCenter.WebApplicationTest.AggregateMonitor" Remotable="true" Priority="Normal" TypeID="Microsoft.SystemCenter.WebApplication.Community.MonitorType.WebTestProbe.TransactionEvalResult" ConfirmDelivery="false">
        <Category>AvailabilityHealth</Category>
        <AlertSettings AlertMessage="Microsoft.SystemCenter.WebApplication.Community.UnitMonitor.WebTestProbe.TransactionEvalResult.Warning.AlertMessage">
          <AlertOnState>Warning</AlertOnState>
          <AutoResolve>true</AutoResolve>
          <AlertPriority>Normal</AlertPriority>
          <AlertSeverity>MatchMonitorHealth</AlertSeverity>
          <AlertParameters>
            <AlertParameter1>$Target/Property[Type="System!System.Entity"]/DisplayName$</AlertParameter1>
            <AlertParameter2>$Data/Context/RequestResults/RequestResult/BasePageData/ResponseUrl$</AlertParameter2>
            <AlertParameter3>$Data/Context/RequestResults/RequestResult/BasePageData/StatusCode$</AlertParameter3>
            <AlertParameter4>$Data/Context/RequestResults/RequestResult/BasePageData/DNSResolutionTime$</AlertParameter4>
            <AlertParameter5>$Data/Context/RequestResults/RequestResult/BasePageData/TCPConnectTime$</AlertParameter5>
            <AlertParameter6>$Data/Context/RequestResults/RequestResult/BasePageData/Redirected$</AlertParameter6>
            <AlertParameter7>$Data/Context/RequestResults/RequestResult/BasePageData/RedirectTime$</AlertParameter7>
            <AlertParameter8>$Data/Context/RequestResults/RequestResult/BasePageData/TimeToFirstByte$</AlertParameter8>
            <AlertParameter9>$Data/Context/RequestResults/RequestResult/BasePageData/TimeToLastByte$</AlertParameter9>
            <AlertParameter10>$Data/Context/TransactionResponseTime$</AlertParameter10>
          </AlertParameters>
        </AlertSettings>
        <OperationalStates>
          <OperationalState ID="Healthy" MonitorTypeStateID="Healthy" HealthState="Success" />
          <OperationalState ID="Unhealthy" MonitorTypeStateID="Unhealthy" HealthState="Warning" />
        </OperationalStates>
        <Configuration>
          <MatchCount>$Target/Property[Type="MSWL!Microsoft.SystemCenter.WebApplicationTest.WebTestBase"]/ConsecutiveMatchCount$</MatchCount>
          <UnhealthyTransactionEvalResult>2</UnhealthyTransactionEvalResult>
        </Configuration>
      </UnitMonitor>
      <UnitMonitor ID="Microsoft.SystemCenter.WebApplication.Community.UnitMonitor.WebTestProbe.CertificateExpiration" Accessibility="Internal" Enabled="true" Target="MSWL!Microsoft.SystemCenter.WebApplicationTest.WebTest" ParentMonitorID="Health!System.Health.ConfigurationState" Remotable="true" Priority="Normal" TypeID="Microsoft.SystemCenter.WebApplication.Community.MonitorType.WebTestProbe.CertificateExpiration" ConfirmDelivery="false">
        <Category>ConfigurationHealth</Category>
        <AlertSettings AlertMessage="Microsoft.SystemCenter.WebApplication.Community.UnitMonitor.WebTestProbe.CertificateExpiration.AlertMessage">
          <AlertOnState>Warning</AlertOnState>
          <AutoResolve>true</AutoResolve>
          <AlertPriority>Normal</AlertPriority>
          <AlertSeverity>MatchMonitorHealth</AlertSeverity>
          <AlertParameters>
            <AlertParameter1>$Data/Context/RequestResults/RequestResult/BasePageData/CertificateExpired$</AlertParameter1>
            <AlertParameter2>$Data/Context/RequestResults/RequestResult/BasePageData/DaysToExpiry$</AlertParameter2>
            <AlertParameter3>$Data/Context/RequestResults/RequestResult/BasePageData/RequestUrl$</AlertParameter3>
            <AlertParameter4>$Data/Context/RequestResults/RequestResult/BasePageData/Redirected$</AlertParameter4>
            <AlertParameter5>$Data/Context/RequestResults/RequestResult/BasePageData/ResponseUrl$</AlertParameter5>
            <AlertParameter6>$Target/Property[Type="MSWL!Microsoft.SystemCenter.WebApplicationTest.WebTestBase"]/Context$</AlertParameter6>
          </AlertParameters>
        </AlertSettings>
        <OperationalStates>
          <OperationalState ID="Healthy" MonitorTypeStateID="Healthy" HealthState="Success" />
          <OperationalState ID="Warning" MonitorTypeStateID="Warning" HealthState="Warning" />
          <OperationalState ID="Critical" MonitorTypeStateID="Critical" HealthState="Error" />
        </OperationalStates>
        <Configuration>
          <DaysToExpiryWarning>60</DaysToExpiryWarning>
        </Configuration>
      </UnitMonitor>
      <UnitMonitor ID="Microsoft.SystemCenter.WebApplication.Community.UnitMonitor.WebTestProbe.TransactionEvalResult.Critical" Accessibility="Internal" Enabled="true" Target="MSWL!Microsoft.SystemCenter.WebApplicationTest.WebTest" ParentMonitorID="MSWL!Microsoft.SystemCenter.WebApplicationTest.AggregateMonitor" Remotable="true" Priority="Normal" TypeID="Microsoft.SystemCenter.WebApplication.Community.MonitorType.WebTestProbe.TransactionEvalResult" ConfirmDelivery="false">
        <Category>AvailabilityHealth</Category>
        <AlertSettings AlertMessage="Microsoft.SystemCenter.WebApplication.Community.UnitMonitor.WebTestProbe.TransactionEvalResult.Critical.AlertMessage">
          <AlertOnState>Error</AlertOnState>
          <AutoResolve>true</AutoResolve>
          <AlertPriority>Normal</AlertPriority>
          <AlertSeverity>MatchMonitorHealth</AlertSeverity>
          <AlertParameters>
            <AlertParameter1>$Target/Property[Type="System!System.Entity"]/DisplayName$</AlertParameter1>
            <AlertParameter2>$Data/Context/RequestResults/RequestResult/BasePageData/Unreachable$</AlertParameter2>
            <AlertParameter3>$Data/Context/RequestResults/RequestResult/BasePageData/DNSResolutionFailure$</AlertParameter3>
            <AlertParameter4>$Data/Context/TestTimeout$</AlertParameter4>
            <AlertParameter5>$Data/Context/RequestResults/RequestResult/BasePageData/Redirected$</AlertParameter5>
            <AlertParameter6>$Data/Context/RequestResults/RequestResult/BasePageData/ResponseUrl$</AlertParameter6>
            <AlertParameter7>$Data/Context/RequestResults/RequestResult/BasePageData/ResponseBodyEvalResult$</AlertParameter7>
            <AlertParameter8>$Data/Context/RequestResults/RequestResult/BasePageData/MonitorSSLEvalResult$</AlertParameter8>
            <AlertParameter9>$Data/Context/RequestResults/RequestResult/BasePageData/StatusCodeEvalResult$</AlertParameter9>
            <AlertParameter10>$Data/Context/TransactionResponseTimeEvalResult$</AlertParameter10>
          </AlertParameters>
        </AlertSettings>
        <OperationalStates>
          <OperationalState ID="Healthy" MonitorTypeStateID="Healthy" HealthState="Success" />
          <OperationalState ID="Unhealthy" MonitorTypeStateID="Unhealthy" HealthState="Error" />
        </OperationalStates>
        <Configuration>
          <MatchCount>$Target/Property[Type="MSWL!Microsoft.SystemCenter.WebApplicationTest.WebTestBase"]/ConsecutiveMatchCount$</MatchCount>
          <UnhealthyTransactionEvalResult>3</UnhealthyTransactionEvalResult>
        </Configuration>
      </UnitMonitor>
    </Monitors>

Wow, thanks for this info, this should help me modify the alert message as needed.