System.SnmpProbe

Applies To: Operations Manager 2007 R2

The System.SnmpProbe probe action module type is used to perform SNMP GET, GET-NEXT and SET actions and returns a System.SnmpData data type.

Usage

Use this module to either receive or write SNMP data within a workflow such as a rule or monitor.

Type Definition

<ProbeActionModuleType ID="System.SnmpProbe" Accessibility="Public">
  <Configuration>
    <xsd:element minOccurs="0" maxOccurs="1" name="Walk" type="xsd:boolean" />
    <xsd:element minOccurs="0" maxOccurs="1" name="WalkReturnMultipleItems" type="xsd:boolean" />
    <xsd:element name="IsWriteAction" type="xsd:boolean" />
    <xsd:element name="IP" type="xsd:string" />
    <xsd:element name="CommunityString" type="xsd:string" />
    <xsd:element minOccurs="0" maxOccurs="1" name="Version" type="xsd:string" />
    <xsd:element name="SnmpVarBinds">
      <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>
  </Configuration>
  <ModuleImplementation>
    <Native>
      <ClassID>2B72C326-CDBB-421a-ACC3-A1994DBD52BB</ClassID>
    </Native>
  </ModuleImplementation>
  <OutputType>System.SnmpData</OutputType>
  <InputType>System!System.BaseData</InputType>
</ProbeActionModuleType>

Parameters

The System.SnmpProbe module supports the following configuration parameters:

Parameter Type Description

Walk

Boolean

Optional. Specifies whether to walk or perform a GET-NEXT action on the SNMP MIB.The default value is false.

WalkReturnMultipleItems

Boolean

R2 Specific. Optional. Specifies whether to return separate System.SnmpData objects for each traversed SNMP MIB OID. The default value is false.

IsWriteAction

Boolean

Specifies whether the current operation on the SNMP MIB is a write action. When set to true, the System.SnmpProbe module is configured to perform a SET operation on the SNMP MIB. When false, the module is intended to perform either a GET or GET-NEXT operation.

IP

String

Specifies the IP address of the SNMP managed entity.

CommunityString

String

Contains the SNMP Community..

Version

String

Optional. Specifies the SNMP version. The default value is “2”. To perform an SNMP v1 transaction, the value must be “1”.

SnmpVarBinds

Complex

Contains a list of SNMP variable bindings as SnmpVarBind elements. If the Walk parameter is true, only one SnmpVarBind must be specified.

Walk

When set to true, the System.SnmpProbe module is configured to walk the SNMP MIB in a GET-NEXT request. The SnmpVarBinds list must contain only one SnmpVarBind element from which to begin the walk. When false, the module is intended to perform a GET or SET operation on specified SNMP MIB variables.

<Walk>true</Walk>

WalkReturnMultipleItems

When set to true, the probe module will return each traversed OID instance in a separate System.SnmpData object. This allows the management server to create separate entities for each discovered instance. When false, the probe module returns a single System.SnmpData object. This parameter is used only when the Walk parameter is set to true.

Note

This parameter exists only for the R2 release of Operations Manager.

<WalkReturnMultipleItems>true</WalkReturnMultipleItems>

IP

This is the IP address of the SNMP MIB.

<IP>$Target/Property[Type="Microsoft.SystemCenter.NetworkDevice"]/IPAddress$</IP>

SnmpVarBinds

The SnmpVarBinds element contains an SMTP variable binding list. Each variable binding in the list is represented as an SnmpVarBind element. The SnmpVarBind element contains the following sub elements:

Element

Type

Description

OID

String

Specifies the SNMP OID of the entity in the SNMP MIB table.

Value

String

The value and variable type of OID entity. The variable type can be specified in the optional VariantType property. The value of the Value element is set only when the IsWriteAction parameter is set to true and a SET action is to be performed.

The following table maps SNMP data types to VariantType strings:

 

SNMP MIB type VariantType Value Variant Type

Integer, Counters, Gauges, TimeTicks (SNMPv1 and SNMPv2)

3

VT_I4

Octet strings, Object Identifiers, IP Addresses, Opaques, Network Addresses

8

VT_BSTR

Null

1

VT_NULL

Syntax

String

The Syntax property indicates the failure or success of the SNMP operation and can be inspected by a condition detection module in a workflow. If the operation is successful, the module sets the value of this property to the appropriate SNMP syntax data type.

Note

Note that for SET operations, the Syntax property must be set to one of the SNMP syntax data types.

The following table maps SNMP syntax data types to the appropriate string values.

 

Syntax data type String value

SNMP_SYNTAX_INT

2

SNMP_SYNTAX_INT32

2

SNMP_SYNTAX_BITS

3

SNMP_SYNTAX_OCTETS

4

SNMP_SYNTAX_NULL

5

SNMP_SYNTAX_OID

6

SNMP_SYNTAX_NSAPADDR

8

SNMP_SYNTAX_SEQUENCE

48

SNMP_SYNTAX_IPADDR

64

SNMP_SYNTAX_CNTR32

65

SNMP_SYNTAX_GUAGE32

66

SNMP_SYNTAX_TIMETICKS

67

SNMP_SYNTAX_OPAQUE

68

SNMP_SYNTAX_NSAPADDR

69

SNMP_SYNTAX_CENTR64

70

SNMP_SYNTAX_UINT32

71

The following table maps SNMP error syntax data types to the appropriate string values.

 

Error syntax data type String value

SNMP_SYNTAX_NOSUCHOBJECT

128

SNMP_SYNTAX_NOSUCHINSTANCE

129

SNMP_SYNTAX_ENDOFMIBVIEW

130

For more information, see RFC 1902, "Structure of Management Information for Version 2 of the Simple Network Management Protocol (SNMPv2)."

The following examples demonstrate the appropriate syntax for defining SnmpVarBind elements for both SET and GET actions.

In the following sample code, an SnmpVarBind element is defined for a probe that is to perform a GET action on the sysDescr MIB element.

 

<SnmpVarBind>
   <OID>1.3.6.1.2.1.1.0</OID>
   <Syntax>0</Syntax>
   <Value VariantType=”8”/>
</SnmpVarBind>

In the following sample code, an SnmpVarBind element is defined for a probe that is to perform a SET action on the sysName MIB element.

Composition

The System.SnmpProbe module is a native module.

The System.SnmpProbe module wraps portions of the WinSNMP API. For a deeper understanding of how the module works internally, see the WinSNMP API topic.

Errors

The following errors can occur from within the System.SnmpProbe module.

Exception Reason

11001

An SNMP GET message failed.

11002

An SNMP SET message failed.

11004

The module failed to retrieve PDU data.

11006

The module was unable to initialize the SNMP session.

Module Type Usage

System.SnmpScanProbe

Performs SNMP GET actions in the context of an IP range. The module returns a System.SnmpData data type.

System.SnmpScanProbe

Returns SNMP trap events as a System.SnmpData data type.

External Module References

The System.SnmpProbe module is a member of the following modules:

Module Type Library Usage

System.SnmpEventProvider

System.Snmp.Library

Performs SNMP GET actions at the specified interval, and converts the response System.SnmpData data to a System.Event.Data data type.

System.SnmpQueryProvider

System.Snmp.Library

Performs SNMP GET actions at the specified interval and returns the SNMP data as a System.SnmpData data type.

Sample

The following XML sample shows a successful data item output from the System.SnmpProbe module.

<?xml version="1.0" encoding="utf-8"?>
<DataItem type="System.SnmpData">
  <SnmpData>
    <Source>127.0.0.1</Source>
    <Destination>127.0.0.9</Destination>
    <CommunityString>public</CommunityString>
    <ErrorCode>1</ErrorCode>
    <Version>1</Version>
    <SnmpVarBinds>
      <SnmpVarBind>
       <OID>.1.3.6.1.2.1.1.5.0</OID>
       <Syntax>4</Syntax>
       <Value VariantType="8" >My Machine Name</Value>
      </SnmpVarBind>
    </SnmpVarBinds>
  </SnmpData>
</DataItem>

The following sample management pack illustrates how you can use the System.SnmpProbe to discover a specific kind of SNMP device, namely, a Microsoft.OM.Samples.Modules.SNMP.WindowsServerDevice. The example also shows how you can use the System.SnmpProbe module in a task that targets the discovered SNMP device and performs a GET on the SysObjectID field.

<ManagementPack ContentReadable="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <Manifest>
    <Identity>
      <ID>Microsoft.OM.Samples.Modules.SNMP</ID>
      <Version>1.0.0.0</Version>
    </Identity>
    <Name>Microsoft.OM.Samples.Modules.SNMP</Name>
    <References>
      <Reference Alias="SC">
        <ID>Microsoft.SystemCenter.Library</ID>
        <Version>6.1.7043.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="MicrosoftSystemCenterNetworkDeviceLibrary">
        <ID>Microsoft.SystemCenter.NetworkDevice.Library</ID>
        <Version>6.1.7043.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="Windows">
        <ID>Microsoft.Windows.Library</ID>
        <Version>6.1.7043.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="Health">
        <ID>System.Health.Library</ID>
        <Version>6.1.7043.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="System">
        <ID>System.Library</ID>
        <Version>6.1.7043.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="Snmp">
        <ID>System.Snmp.Library</ID>
        <Version>6.1.7043.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
    </References>
  </Manifest>
  <TypeDefinitions>
    <EntityTypes>
      <ClassTypes>
        <ClassType ID="Microsoft.OM.Samples.Modules.SNMP.WindowsServerDevice" Accessibility="Internal" Abstract="false" Base="MicrosoftSystemCenterNetworkDeviceLibrary!Microsoft.SystemCenter.NetworkDevice" Hosted="false" Singleton="false" />
      </ClassTypes>
    </EntityTypes>
    <ModuleTypes>
      <DataSourceModuleType ID="Microsoft.OM.Samples.Modules.SNMP.SNMPDeviceDiscoveryDataSource" Accessibility="Internal" Batching="false">
        <Configuration>
          <IncludeSchemaTypes>
            <SchemaType>System!System.Discovery.MapperSchema</SchemaType>
            <SchemaType>System!System.ExpressionEvaluatorSchema</SchemaType>
            <SchemaType>System!System.ParamListSchema</SchemaType>
          </IncludeSchemaTypes>
          <xsd:element minOccurs="1" name="Interval" type="xsd:integer" />
          <xsd:element minOccurs="1" name="IP" type="xsd:string" />
          <xsd:element minOccurs="1" name="CommunityString" type="xsd:string" />
          <xsd:element minOccurs="1" name="ClassId" type="xsd:string" />
          <xsd:element minOccurs="1" name="Expression" type="ExpressionType" />
          <xsd:element minOccurs="1" name="InstanceSettings" type="SettingsType" />
          <xsd:element name="SnmpVarBinds">
            <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>
        </Configuration>
        <ModuleImplementation Isolation="Any">
          <Composite>
            <MemberModules>
              <DataSource ID="Scheduler" TypeID="System!System.Scheduler">
                <Scheduler>
                  <SimpleReccuringSchedule>
                    <Interval Unit="Seconds">$Config/Interval$</Interval>
                  </SimpleReccuringSchedule>
                  <ExcludeDates />
                </Scheduler>
              </DataSource>
              <ProbeAction ID="Probe" TypeID="Snmp!System.SnmpProbe">
                <IsWriteAction>false</IsWriteAction>
                <IP>$Config/IP$</IP>
                <CommunityString>$Config/CommunityString$</CommunityString>
                <SnmpVarBinds>$Config/SnmpVarBinds$</SnmpVarBinds>
              </ProbeAction>
              <ConditionDetection ID="Filter" TypeID="System!System.ExpressionFilter">
                <Expression>
                  <SimpleExpression>
                    <ValueExpression>
                      <XPathQuery Type="String">ErrorCode</XPathQuery>
                    </ValueExpression>
                    <Operator>Equal</Operator>
                    <ValueExpression>
                      <XPathQuery Type="UnsignedInteger">1</XPathQuery>
                    </ValueExpression>
                  </SimpleExpression>
                </Expression>
              </ConditionDetection>
              <ConditionDetection ID="Mapper" TypeID="System!System.Discovery.FilteredClassSnapshotDataMapper">
                <Expression>$Config/Expression$</Expression>
                <ClassId>$Config/ClassId$</ClassId>
                <InstanceSettings>$Config/InstanceSettings$</InstanceSettings>
              </ConditionDetection>
            </MemberModules>
            <Composition>
              <Node ID="Mapper">
                <Node ID="Filter">
                  <Node ID="Probe">
                    <Node ID="Scheduler" />
                  </Node>
                </Node>
              </Node>
            </Composition>
          </Composite>
        </ModuleImplementation>
        <OutputType>System!System.Discovery.Data</OutputType>
      </DataSourceModuleType>
    </ModuleTypes>
  </TypeDefinitions>
  <Monitoring>
    <Discoveries>
      <Discovery ID="Microsoft.OM.Samples.Modules.SNMP.DiscoverWindowsServer" Enabled="true" Target="MicrosoftSystemCenterNetworkDeviceLibrary!Microsoft.SystemCenter.NetworkDevice" ConfirmDelivery="true" Remotable="true" Priority="Normal">
        <Category>Discovery</Category>
        <DiscoveryTypes>
          <DiscoveryClass TypeID="Microsoft.OM.Samples.Modules.SNMP.WindowsServerDevice" />
        </DiscoveryTypes>
        <DataSource ID="DiscoveryDS" TypeID="Microsoft.OM.Samples.Modules.SNMP.SNMPDeviceDiscoveryDataSource">
          <Interval>300</Interval>
          <IP>$Target/Property[Type="MicrosoftSystemCenterNetworkDeviceLibrary!Microsoft.SystemCenter.NetworkDevice"]/IPAddress$</IP>
          <CommunityString>public</CommunityString>
          <ClassId>$MPElement[Name="MicrosoftSystemCenterNetworkDeviceLibrary!Microsoft.SystemCenter.NetworkDevice"]$</ClassId>
          <Expression>
            <RegExExpression>
              <ValueExpression>
                <XPathQuery>/SnmpVarBinds/SnmpVarBind[1]/Value</XPathQuery>
              </ValueExpression>
              <Operator>ContainsSubstring</Operator>
              <Pattern>1.3.6.1.4.1.311.1.1.3.1.2</Pattern>
            </RegExExpression>
          </Expression>
          <InstanceSettings>
            <Settings>
              <Setting>
                <Name>$MPElement[Name="MicrosoftSystemCenterNetworkDeviceLibrary!Microsoft.SystemCenter.NetworkDevice"]/IPAddress$</Name>
                <Value>$Data/Source$</Value>
              </Setting>
              <Setting>
                <Name>$MPElement[Name="MicrosoftSystemCenterNetworkDeviceLibrary!Microsoft.SystemCenter.NetworkDevice"]/Name$</Name>
                <Value>$Data/SnmpVarBinds/SnmpVarBind[5]/Value$</Value>
              </Setting>
              <Setting>
                <Name>$MPElement[Name="MicrosoftSystemCenterNetworkDeviceLibrary!Microsoft.SystemCenter.NetworkDevice"]/SystemDescription$</Name>
                <Value>$Data/SnmpVarBinds/SnmpVarBind[4]/Value$</Value>
              </Setting>
              <Setting>
                <Name>$MPElement[Name="MicrosoftSystemCenterNetworkDeviceLibrary!Microsoft.SystemCenter.NetworkDevice"]/SystemContact$</Name>
                <Value>$Data/SnmpVarBinds/SnmpVarBind[3]/Value$</Value>
              </Setting>
              <Setting>
                <Name>$MPElement[Name="MicrosoftSystemCenterNetworkDeviceLibrary!Microsoft.SystemCenter.NetworkDevice"]/SystemLocation$</Name>
                <Value>$Data/SnmpVarBinds/SnmpVarBind[2]/Value$</Value>
              </Setting>
              <Setting>
                <Name>$MPElement[Name="MicrosoftSystemCenterNetworkDeviceLibrary!Microsoft.SystemCenter.NetworkDevice"]/SystemOID$</Name>
                <Value>$Data/SnmpVarBinds/SnmpVarBind[1]/Value$</Value>
              </Setting>
            </Settings>
          </InstanceSettings>
          <SnmpVarBinds>
            <SnmpVarBind>
              <OID>.1.3.6.1.2.1.1.5.0</OID>
              <Syntax>0</Syntax>
              <Value VariantType="8" />
            </SnmpVarBind>
            <SnmpVarBind>
              <OID>.1.3.6.1.2.1.1.1.0</OID>
              <Syntax>0</Syntax>
              <Value VariantType="8" />
            </SnmpVarBind>
            <SnmpVarBind>
              <OID>.1.3.6.1.2.1.1.4.0</OID>
              <Syntax>0</Syntax>
              <Value VariantType="8" />
            </SnmpVarBind>
            <SnmpVarBind>
              <OID>.1.3.6.1.2.1.1.6.0</OID>
              <Syntax>0</Syntax>
              <Value VariantType="8" />
            </SnmpVarBind>
            <SnmpVarBind>
              <OID>.1.3.6.1.2.1.1.2.0</OID>
              <Syntax>0</Syntax>
              <Value VariantType="8" />
            </SnmpVarBind>
          </SnmpVarBinds>
        </DataSource>
      </Discovery>
    </Discoveries>
    <Tasks>
      <Task ID="Microsoft.Samples.Snmp.SnmpProbeTask" Accessibility="Internal" Enabled="true" Target="Microsoft.OM.Samples.Modules.SNMP.WindowsServerDevice" Timeout="300" Remotable="true">
        <Category>Custom</Category>
        <ProbeAction ID="Probe" TypeID="Snmp!System.SnmpProbe">
          <IsWriteAction>false</IsWriteAction>
          <IP>$Target/Property[Type="MicrosoftSystemCenterNetworkDeviceLibrary!Microsoft.SystemCenter.NetworkDevice"]/IPAddress$</IP>
          <CommunityString>public</CommunityString>
          <SnmpVarBinds>
            <SnmpVarBind>
              <OID>1.3.6.1.4.1.311.1.1.3.1.2</OID>
              <Syntax>0</Syntax>
              <Value VariantType="8" />
            </SnmpVarBind>
          </SnmpVarBinds>
        </ProbeAction>
      </Task>
    </Tasks>
  </Monitoring>
   <LanguagePacks>
    <LanguagePack ID="ENU" IsDefault="true">
      <DisplayStrings>
        <DisplayString ElementID="Microsoft.OM.Samples.Modules.SNMP">
          <Name>Microsoft OM SNMP Module Samples</Name>
        </DisplayString>
        <DisplayString ElementID="Microsoft.OM.Samples.Modules.SNMP.DiscoverWindowsServer">
          <Name>Discover Windows Server</Name>
        </DisplayString>
        <DisplayString ElementID="Microsoft.OM.Samples.Modules.SNMP.SNMPDeviceDiscoveryDataSource">
          <Name>Windows Server SNMP Discovery DataSource</Name>
        </DisplayString>
        <DisplayString ElementID="Microsoft.OM.Samples.Modules.SNMP.WindowsServerDevice">
          <Name>Windows Server Device</Name>
        </DisplayString>
        <DisplayString ElementID="Microsoft.Samples.Snmp.SnmpProbeTask">
          <Name>SnmpProbe Task</Name>
          <Description />
        </DisplayString>
      </DisplayStrings>
    </LanguagePack>
  </LanguagePacks>
</ManagementPack>

Information

   

Module Type

ProbeActionModuleType

Input Type

System.BaseData

Output Type

System.SnmpData

Implementation

Native

Library

System.Snmp.Library