Share via


System.NetworkManagement.Computation

Applies To: System Center 2012 - Operations Manager, System Center 2012 R2 Operations Manager, System Center 2012 SP1 - Operations Manager

The System.NetworkManagement.Computation condition detection module type takes System.BaseData data as input and outputs System.ComputationData.

Usage

This module is commonly used by modules in the System.NetworkManagement.Monitoring management pack to perform mathematical computations on values returned by SNMP devices before passing those values to the next module in the workflow. It can also be used to test a condition in a workflow, and provide a different result based on whether that condition is true or false.

Type Definition

<ConditionDetectionModuleType ID="System.NetworkManagement.Computation" Accessibility="Public" Batching="false" Stateful="false" PassThrough="false">
  <Configuration>
    <IncludeSchemaTypes>
      <SchemaType>System.ExpressionEvaluatorSchema</SchemaType>
    </IncludeSchemaTypes>
    <xsd:element name="NumericValue" type="NumericValueExpressionType" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
  </Configuration>
  <ModuleImplementation Isolation="Any">
    <Native>
      <ClassID>C75C06DE-A537-4744-BDF9-5775E63E014A</ClassID>
    </Native>
  </ModuleImplementation>
  <OutputType>System!System.ComputationData</OutputType>
  <InputTypes>
    <InputType>System!System.BaseData</InputType>
  </InputTypes>
</ConditionDetectionModuleType>

Parameters

The System.NetworkManagement.Computation module supports the following configuration parameter:

Parameter Type Overrideable Description

NumericValue

NumericValueExpressionType

False

Required parameter. Contains either a numeric value, or an expression that resolves to a numeric value.

The NumericValueExpressionType is a complex type with the following definition:

<xsd:complexType name="NumericValueExpressionType" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:choice>
    <xsd:element name="XPathQuery" type="NumericXPathQueryValueType" />
    <xsd:element name="Value" type="NumericConstantValueType" />
    <xsd:element name="BranchValueExpression" type="NumericBranchValueExpressionType" />
    <xsd:element name="Summation" type="SummationValueType" />
    <xsd:element name="Product" type="MultiplicationValueType" />
    <xsd:element name="Subtraction" type="SubtractionValueType" />
    <xsd:element name="Division" type="DivisionValueType" />
    <xsd:element name="Negation" type="NegationValueType" />
    <xsd:element name="IntegerValue" type="IntNumericValueExpressionType" />
    <xsd:element name="Delta" type="DeltaValueType" />
  </xsd:choice>
</xsd:complexType>

The NumericValueExpressionType is essentially any type that resolves to a numeric value, but that type can be calculated in any one of a number of ways. The choice element of the type definition requires that only one of the ten types of value calculation can be used to provide the value. However, these types can be nested; for example, a BranchValueExpression might have two value branches, one of which is a multiplication type, and one of which is a division type. The following table lists the potential value types:

Value type name Definition

XPathQuery

Any XPath query that resolves to a NumericXPathQueryValueType, which can be an integer or a double.

Value

A constant value that resolves to either an integer or a double.

BranchValueExpression

A complex type that provides a choice between two possible values, controlled by a Boolean expression.

Summation

A value determined by addition of two or more NumericValueExpressionType values.

Product

A value determined by multiplication of two or more NumericValueExpressionType values.

Subtraction

A value determined by subtraction of two and only two NumericValueExpressionType values.

Division

A value determined by division of two and only two NumericValueExpressionType values.

Negation

A value determined by negating another NumericValueExpressionType value.

IntegerValue

An integer value that can be any of the other types for NumericValueExpressionType, as well as modulus, bitwise or, bitwise and, or bitwise Xor.

Delta

The delta value type is a complex type that consists of an integer and a delta computation type, which can be one of the following: Absolute, Percent, RatePerSecond, RatePerMinute, RatePerHour, or RatePerDay.

The BranchValueExpression type is commonly used, and requires some additional explanation. It consists of three elements:

  • Expression, an expression that can be evaluated to true or false.

  • TrueValueExpression, an expression that will be evaluated if the Expression is true. This expression must evaluate to a numeric value.

  • FalseValueExpression, an expression that will be evaluated if the Expression is false. This expression must evaluate to a numeric value.

The following is a simple example from the System.NetworkManagement.ComputedPerfProvider.Division module. The intention here is to prevent any computation from dividing by zero and generating an error.

<BranchValueExpression>
  <Expression>
    <SimpleExpression>
      <ValueExpression>
        <NumericValue>$Config/Denominator$</NumericValue>
      </ValueExpression>
      <Operator>Equal</Operator>
      <ValueExpression>
        <NumericValue>
          <Value Type="Double">0.0</Value>
        </NumericValue>
      </ValueExpression>
    </SimpleExpression>
  </Expression>
  <TrueValueExpression>
    <NumericValue>
      <Value Type="Double">$Config/DefaultValue$</Value>
    </NumericValue>
  </TrueValueExpression>
  <FalseValueExpression>
    <NumericValue>
      <Division>
        <NumericValue>$Config/Numerator$</NumericValue>
        <NumericValue>$Config/Denominator$</NumericValue>
      </Division>
    </NumericValue>
  </FalseValueExpression>
</BranchValueExpression>

The Expression element evaluates whether the Denominator variable is equal to zero, which would cause an error. If this expression is true, you don’t want to perform the calculation, so the entire branch value expression evaluates to the configured default value, as shown in the TrueValueExpression element. If the denominator is not equal to zero, then the expression is false, and the calculation is safe to perform. Therefore, the FalseValueExpression element contains a nested Division element that performs the calculation and returns that value as the value of the BranchValueExpression.

It’s important to understand that only one of the two value expressions will be used; the other is discarded. In this example, if the denominator variable is not zero, the TrueValueExpression is never evaluated, and the default value variable is thrown away.

The following is a somewhat more complex example from the LargestFreeBufferProvider module. The purpose of this module is to return the size of the largest free memory buffer on a network node, but it’s possible that the node could return invalid data. Even if the returned data is valid, the module expresses the value as a percentage of the free memory in the memory pool, so that value needs to be calculated.

<BranchValueExpression>
  <Expression>
    <And>
      <Expression>
        <RegExExpression>
          <ValueExpression>
            <XPathQuery Type="Double">SnmpVarBinds/SnmpVarBind[OID="$Config/ValidMemoryOID$"]/Value</XPathQuery>
          </ValueExpression>
          <Operator>MatchesRegularExpression</Operator>
          <Pattern>$Config/ValidMemoryRegEx$</Pattern>
        </RegExExpression>
      </Expression>
      <Expression>
        <SimpleExpression>
          <ValueExpression>
            <NumericValue>
              <XPathQuery Type="Double">SnmpVarBinds/SnmpVarBind[OID="$Config/LargestFreeBufferOID$"]/Value</XPathQuery>
            </NumericValue>
          </ValueExpression>
          <Operator>Greater</Operator>
          <ValueExpression>
            <NumericValue>
              <Value>0.0</Value>
            </NumericValue>
          </ValueExpression>
        </SimpleExpression>
      </Expression>
      <Expression>
        <SimpleExpression>
          <ValueExpression>
            <NumericValue>
              <XPathQuery Type="Double">SnmpVarBinds/SnmpVarBind[OID="$Config/FreeMemoryOID$"]/Value</XPathQuery>
            </NumericValue>
          </ValueExpression>
          <Operator>Greater</Operator>
          <ValueExpression>
            <NumericValue>
              <Value>0.0</Value>
            </NumericValue>
          </ValueExpression>
        </SimpleExpression>
      </Expression>
    </And>
  </Expression>
  <TrueValueExpression>
    <NumericValue>
      <Division>
        <NumericValue>
          <Product>
            <NumericValue>
              <XPathQuery Type="Double">SnmpVarBinds/SnmpVarBind[OID="$Config/LargestFreeBufferOID$"]/Value</XPathQuery>
            </NumericValue>
            <NumericValue>
              <Value Type="Double">100.0</Value>
            </NumericValue>
          </Product>
        </NumericValue>
        <NumericValue>
          <XPathQuery Type="Double">SnmpVarBinds/SnmpVarBind[OID="$Config/FreeMemoryOID$"]/Value</XPathQuery>
        </NumericValue>
      </Division>
    </NumericValue>
  </TrueValueExpression>
  <FalseValueExpression>
    <NumericValue>
      <Value Type="Double">100.0</Value>
    </NumericValue>
  </FalseValueExpression>
</BranchValueExpression>

The Expression element is a three-part BranchValueExpression, with each part enclosed in an And tag. The first clause compares the “valid memory” value returned from the node with a configured regular expression, to ensure that the node really is returning good values for memory. The second clause checks to see if the “largest free buffer” value returned is greater than zero (that is, if there is a buffer at all). The third clause checks to see if the “total free memory” value is greater than zero, because that value will be needed for the calculation.

If any of these conditions are false, the calculation can’t continue. In that case, the module returns a value of 100.0, as shown in the FalseValueExpression element.

If all three of the conditions in the Expression element are true, some calculation is needed to return a useful value. The value returned as the largest free buffer is multiplied by 100, so that the result of the next calculation will be a percentage. That result is then divided by the value returned as the total free memory, and the new result is the value of the TrueValueExpression. This example shows how you can carry out multiple calculations within a single expression, as long as the result is a single value.

Composition

The System.NetworkManagement.Computation module is a native module.

Module Type Usage

System.Computation

Also performs a computation using the same parameters as System.NetworkManagement.Computation.

External Module References

Module Type Usage

System.NetworkManagement.ComputedPerfProvider

Provides performance data for an SNMP object that requires a calculation before the next step in the workflow.

System.NetworkManagement.MemoryPerfProvider

Retrieves performance information regarding the memory on the specified SNMP node.

Sample

The following XML example shows a unit monitor that uses the System.NetworkManagement.Computation module to perform a complex calculation in the ComputeHighThreshold element.

<UnitMonitorType ID="System.NetworkManagement.ComputedRelativeThresholdRangeMonitorType" Accessibility="Public">
  <MonitorTypeStates>
    <MonitorTypeState ID="MTSThresholdSuccess" NoDetection="false" />
    <MonitorTypeState ID="MTSThresholdError" NoDetection="false" />
  </MonitorTypeStates>
  <Configuration>
    <IncludeSchemaTypes>
      <SchemaType>System.ExpressionEvaluatorSchema</SchemaType>
    </IncludeSchemaTypes>
    <xsd:element minOccurs="1" name="Interval" type="xsd:integer" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element minOccurs="0" maxOccurs="1" name="NoOfRetries" type="xsd:unsignedInt" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element name="NumberOfSamples" type="xsd:unsignedInt" minOccurs="0" maxOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element minOccurs="0" maxOccurs="1" name="Timeout" type="xsd:unsignedInt" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element minOccurs="1" name="SnmpVarBinds" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:complexType>
        <xsd:sequence>
          <xsd:element minOccurs="1" maxOccurs="unbounded" name="SnmpVarBind">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="OID" type="xsd:string" />
                <xsd:element name="Syntax" type="xsd:integer" />
                <xsd:element name="Value">
                  <xsd:complexType>
                    <xsd:simpleContent>
                      <xsd:extension base="xsd:string">
                        <xsd:attribute name="VariantType" type="xsd:integer" use="optional" />
                      </xsd:extension>
                    </xsd:simpleContent>
                  </xsd:complexType>
                </xsd:element>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:element>
    <xsd:element minOccurs="1" name="ComputedPerformanceValue" type="NumericValueExpressionType" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element minOccurs="1" name="RelativeThreshold" type="xsd:integer" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element minOccurs="1" name="HighThreshold" type="NumericValueExpressionType" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element minOccurs="1" name="LowThreshold" type="NumericValueExpressionType" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
  </Configuration>
  <OverrideableParameters>
    <OverrideableParameter ID="Interval" Selector="$Config/Interval$" ParameterType="int" />
    <OverrideableParameter ID="NoOfRetries" Selector="$Config/NoOfRetries$" ParameterType="int" />
    <OverrideableParameter ID="NumberOfSamples" Selector="$Config/NumberOfSamples$" ParameterType="int" />
    <OverrideableParameter ID="Timeout" Selector="$Config/Timeout$" ParameterType="int" />
    <OverrideableParameter ID="RelativeThreshold" Selector="$Config/RelativeThreshold$" ParameterType="int" />
  </OverrideableParameters>
  <MonitorImplementation>
    <MemberModules>
      <DataSource ID="ProbeDS" TypeID="System.NetworkManagement.Host.ExtendedSnmpQueryProvider">
        <Interval>$Config/Interval$</Interval>
        <NoOfRetries>$Config/NoOfRetries$</NoOfRetries>
        <Timeout>$Config/Timeout$</Timeout>
        <SnmpVarBinds>$Config/SnmpVarBinds$</SnmpVarBinds>
      </DataSource>
      <ConditionDetection ID="ComputePerfValue" TypeID="System.NetworkManagement.Computation">
        <NumericValue>$Config/ComputedPerformanceValue$</NumericValue>
      </ConditionDetection>
      <ConditionDetection ID="ComputeLowThreshold" TypeID="System.NetworkManagement.Computation">
        <NumericValue>
          <Product>
            <NumericValue>
              <Summation>
                <NumericValue>
                  <Value>1</Value>
                </NumericValue>
                <NumericValue>
                  <Division>
                    <NumericValue>
                      <Value>$Config/RelativeThreshold$</Value>
                    </NumericValue>
                    <NumericValue>
                      <Value>100</Value>
                    </NumericValue>
                  </Division>
                </NumericValue>
              </Summation>
            </NumericValue>
            <NumericValue>$Config/LowThreshold$</NumericValue>
          </Product>
        </NumericValue>
      </ConditionDetection>
      <ConditionDetection ID="ComputeHighThreshold" TypeID="System.NetworkManagement.Computation">
        <NumericValue>
          <Product>
            <NumericValue>
              <Subtraction>
                <NumericValue>
                  <Value>1</Value>
                </NumericValue>
                <NumericValue>
                  <Division>
                    <NumericValue>
                      <Value>$Config/RelativeThreshold$</Value>
                    </NumericValue>
                    <NumericValue>
                      <Value>100</Value>
                    </NumericValue>
                  </Division>
                </NumericValue>
              </Subtraction>
            </NumericValue>
            <NumericValue>$Config/HighThreshold$</NumericValue>
          </Product>
        </NumericValue>
      </ConditionDetection>
      <ConditionDetection ID="TestWithinThreshold" TypeID="System.NetworkManagement.ExpressionFilter">
        <Expression>
          <Or>
            <Expression>
              <And>
                <Expression>
                  <SimpleExpression>
                    <ValueExpression>
                      <XPathQuery Type="Double">Context/DataItem/Context/DataItem/Value</XPathQuery>
                    </ValueExpression>
                    <Operator>GreaterEqual</Operator>
                    <ValueExpression>
                      <NumericValue>
                        <Value>0</Value>
                      </NumericValue>
                    </ValueExpression>
                  </SimpleExpression>
                </Expression>
                <Expression>
                  <SimpleExpression>
                    <ValueExpression>
                      <XPathQuery Type="Double">Context/DataItem/Context/DataItem/Value</XPathQuery>
                    </ValueExpression>
                    <Operator>GreaterEqual</Operator>
                    <ValueExpression>
                      <XPathQuery Type="Double">Value</XPathQuery>
                    </ValueExpression>
                  </SimpleExpression>
                </Expression>
                <Expression>
                  <SimpleExpression>
                    <ValueExpression>
                      <XPathQuery Type="Double">Context/DataItem/Context/DataItem/Value</XPathQuery>
                    </ValueExpression>
                    <Operator>LessEqual</Operator>
                    <ValueExpression>
                      <XPathQuery Type="Double">Context/DataItem/Value</XPathQuery>
                    </ValueExpression>
                  </SimpleExpression>
                </Expression>
              </And>
            </Expression>
            <Expression>
              <And>
                <Expression>
                  <SimpleExpression>
                    <ValueExpression>
                      <XPathQuery Type="Double">Context/DataItem/Context/DataItem/Value</XPathQuery>
                    </ValueExpression>
                    <Operator>Less</Operator>
                    <ValueExpression>
                      <NumericValue>
                        <Value>0</Value>
                      </NumericValue>
                    </ValueExpression>
                  </SimpleExpression>
                </Expression>
                <Expression>
                  <SimpleExpression>
                    <ValueExpression>
                      <XPathQuery Type="Double">Context/DataItem/Context/DataItem/Value</XPathQuery>
                    </ValueExpression>
                    <Operator>LessEqual</Operator>
                    <ValueExpression>
                      <XPathQuery Type="Double">Value</XPathQuery>
                    </ValueExpression>
                  </SimpleExpression>
                </Expression>
                <Expression>
                  <SimpleExpression>
                    <ValueExpression>
                      <XPathQuery Type="Double">Context/DataItem/Context/DataItem/Value</XPathQuery>
                    </ValueExpression>
                    <Operator>GreaterEqual</Operator>
                    <ValueExpression>
                      <XPathQuery Type="Double">Context/DataItem/Value</XPathQuery>
                    </ValueExpression>
                  </SimpleExpression>
                </Expression>
              </And>
            </Expression>
          </Or>
        </Expression>
        <SuppressionSettings>
          <MatchCount>$Config/NumberOfSamples$</MatchCount>
          <SampleCount>$Config/NumberOfSamples$</SampleCount>
        </SuppressionSettings>
      </ConditionDetection>
      <ConditionDetection ID="TestOutsideThreshold" TypeID="System.NetworkManagement.ExpressionFilter">
        <Expression>
          <Or>
            <Expression>
              <And>
                <Expression>
                  <SimpleExpression>
                    <ValueExpression>
                      <XPathQuery Type="Double">Context/DataItem/Context/DataItem/Value</XPathQuery>
                    </ValueExpression>
                    <Operator>GreaterEqual</Operator>
                    <ValueExpression>
                      <NumericValue>
                        <Value>0</Value>
                      </NumericValue>
                    </ValueExpression>
                  </SimpleExpression>
                </Expression>
                <Expression>
                  <Or>
                    <Expression>
                      <SimpleExpression>
                        <ValueExpression>
                          <XPathQuery Type="Double">Context/DataItem/Context/DataItem/Value</XPathQuery>
                        </ValueExpression>
                        <Operator>Less</Operator>
                        <ValueExpression>
                          <XPathQuery Type="Double">Value</XPathQuery>
                        </ValueExpression>
                      </SimpleExpression>
                    </Expression>
                    <Expression>
                      <SimpleExpression>
                        <ValueExpression>
                          <XPathQuery Type="Double">Context/DataItem/Context/DataItem/Value</XPathQuery>
                        </ValueExpression>
                        <Operator>Greater</Operator>
                        <ValueExpression>
                          <XPathQuery Type="Double">Context/DataItem/Value</XPathQuery>
                        </ValueExpression>
                      </SimpleExpression>
                    </Expression>
                  </Or>
                </Expression>
              </And>
            </Expression>
            <Expression>
              <And>
                <Expression>
                  <SimpleExpression>
                    <ValueExpression>
                      <XPathQuery Type="Double">Context/DataItem/Context/DataItem/Value</XPathQuery>
                    </ValueExpression>
                    <Operator>Less</Operator>
                    <ValueExpression>
                      <NumericValue>
                        <Value>0</Value>
                      </NumericValue>
                    </ValueExpression>
                  </SimpleExpression>
                </Expression>
                <Expression>
                  <Or>
                    <Expression>
                      <SimpleExpression>
                        <ValueExpression>
                          <XPathQuery Type="Double">Context/DataItem/Context/DataItem/Value</XPathQuery>
                        </ValueExpression>
                        <Operator>Greater</Operator>
                        <ValueExpression>
                          <XPathQuery Type="Double">Value</XPathQuery>
                        </ValueExpression>
                      </SimpleExpression>
                    </Expression>
                    <Expression>
                      <SimpleExpression>
                        <ValueExpression>
                          <XPathQuery Type="Double">Context/DataItem/Context/DataItem/Value</XPathQuery>
                        </ValueExpression>
                        <Operator>Less</Operator>
                        <ValueExpression>
                          <XPathQuery Type="Double">Context/DataItem/Value</XPathQuery>
                        </ValueExpression>
                      </SimpleExpression>
                    </Expression>
                  </Or>
                </Expression>
              </And>
            </Expression>
          </Or>
        </Expression>
        <SuppressionSettings>
          <MatchCount>$Config/NumberOfSamples$</MatchCount>
          <SampleCount>$Config/NumberOfSamples$</SampleCount>
        </SuppressionSettings>
      </ConditionDetection>
    </MemberModules>
    <RegularDetections>
      <RegularDetection MonitorTypeStateID="MTSThresholdSuccess">
        <Node ID="TestWithinThreshold">
          <Node ID="ComputeLowThreshold">
            <Node ID="ComputeHighThreshold">
              <Node ID="ComputePerfValue">
                <Node ID="ProbeDS" />
              </Node>
            </Node>
          </Node>
        </Node>
      </RegularDetection>
      <RegularDetection MonitorTypeStateID="MTSThresholdError">
        <Node ID="TestOutsideThreshold">
          <Node ID="ComputeLowThreshold">
            <Node ID="ComputeHighThreshold">
              <Node ID="ComputePerfValue">
                <Node ID="ProbeDS" />
              </Node>
            </Node>
          </Node>
        </Node>
      </RegularDetection>
    </RegularDetections>
  </MonitorImplementation>
</UnitMonitorType>

Information

   

Module Type

ConditionDetectionModuleType

Input Type

System.BaseData

Output Type

System.ComputationData

Implementation

Native

Library

System.NetworkManagement.Monitoring