Performance Subtraction SNMP Divided by 1024 Data Source Module

DataSourceModule.Performance.Subtraction.Div1024 (DataSourceModuleType)

Subtracts One SNMP Value from another and divides by 1024

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
OutputTypeSystem.Performance.Data

Member Modules:

ID Module Type TypeId RunAs 
SnmpDataSource DataSource System.NetworkManagement.SnmpDataSource Default
ScriptProbePS ProbeAction Microsoft.Windows.PowerShellPropertyBagTriggerOnlyProbe Default
Mapper ConditionDetection System.Performance.DataGenericMapper Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$Interval SecondsFrequency in seconds that module is run.
NoOfRetriesint$Config/NoOfRetries$Number of RetriesNumber of times that the request should be retried if the first request fails.
Timeoutint$Config/Timeout$TimeoutSeconds that the request must be complete before it is terminated.
Portint$Config/Port$SNMP PortSNMP Port of Device

Source Code:

<DataSourceModuleType ID="DataSourceModule.Performance.Subtraction.Div1024" Accessibility="Public" Batching="false">
<Configuration>
<IncludeSchemaTypes>
<SchemaType>System!System.ParamListSchema</SchemaType>
<SchemaType>System!System.ExpressionEvaluatorSchema</SchemaType>
<SchemaType>SNMP!System.SnmpVarBindsSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IntervalSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="NoOfRetries" type="xsd:unsignedInt" default="3"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Timeout " type="xsd:unsignedInt" default="500"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Port" type="xsd:unsignedInt" default="161"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="IP" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Community" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="0" maxOccurs="1" name="Version" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SnmpVarBinds" type="SnmpVarBindsType"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="ObjectName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="CounterName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="InstanceName" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="NoOfRetries" Selector="$Config/NoOfRetries$" ParameterType="int"/>
<OverrideableParameter ID="Timeout" Selector="$Config/Timeout$" ParameterType="int"/>
<OverrideableParameter ID="Port" Selector="$Config/Port$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="SnmpDataSource" TypeID="SNL!System.NetworkManagement.SnmpDataSource">
<Scheduler>
<SimpleReccuringSchedule>
<Interval Unit="Seconds">$Config/IntervalSeconds$</Interval>
</SimpleReccuringSchedule>
<ExcludeDates/>
</Scheduler>
<NoOfRetries>$Config/NoOfRetries$</NoOfRetries>
<Timeout>$Config/Timeout$</Timeout>
<Port>$Config/Port$</Port>
<SNMPv3UserName>$RunAs[Name="SNL!System.NetworkManagement.SnmpV3.MonitoringAccount"]/UserName$</SNMPv3UserName>
<SNMPv3AuthProtocol>$RunAs[Name="SNL!System.NetworkManagement.SnmpV3.MonitoringAccount"]/AuthenticationProtocol$</SNMPv3AuthProtocol>
<SNMPv3AuthPassword>$RunAs[Name="SNL!System.NetworkManagement.SnmpV3.MonitoringAccount"]/AuthenticationKey$</SNMPv3AuthPassword>
<SNMPv3PrivProtocol>$RunAs[Name="SNL!System.NetworkManagement.SnmpV3.MonitoringAccount"]/PrivacyProtocol$</SNMPv3PrivProtocol>
<SNMPv3PrivPassword>$RunAs[Name="SNL!System.NetworkManagement.SnmpV3.MonitoringAccount"]/PrivacyKey$</SNMPv3PrivPassword>
<SNMPv3ContextName>$RunAs[Name="SNL!System.NetworkManagement.SnmpV3.MonitoringAccount"]/ContextName$</SNMPv3ContextName>
<IP>$Config/IP$</IP>
<CommunityString>$Config/Community$</CommunityString>
<Version>$Config/Version$</Version>
<SnmpVarBinds>$Config/SnmpVarBinds$</SnmpVarBinds>
<OutputOnError>false</OutputOnError>
</DataSource>
<ProbeAction ID="ScriptProbePS" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagTriggerOnlyProbe">
<ScriptName>SubtractDiv1024.ps1</ScriptName>
<ScriptBody><Script>#==================================================================================
# Script: Subtract Div1024.ps1
# Date: 14/05/18
# Author: Andi Patrick
# Purpose: Subtracts Number from another Number and divides result by 1024.
#==================================================================================

# Named Parameters
param($Number1, $Number2)

#Start by setting up API object.
$api = New-Object -comObject 'MOM.ScriptAPI'

#Create a property bag.
$bag = $api.CreatePropertyBag()

# Create Result
$Result = $Number1 - $Number2
$Result = [int]($Result / 1024)

# Add Result to Property Bag
$bag.AddValue('Number', $Result)

# Return Property Bag
#$api.Return($bag) # Used for debugging
$bag</Script></ScriptBody>
<SnapIns/>
<Parameters>
<Parameter>
<Name>Number1</Name>
<Value>$Data/SnmpVarBinds/SnmpVarBind[1]/Value$</Value>
</Parameter>
<Parameter>
<Name>Number2</Name>
<Value>$Data/SnmpVarBinds/SnmpVarBind[2]/Value$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>60</TimeoutSeconds>
</ProbeAction>
<ConditionDetection ID="Mapper" TypeID="Perf!System.Performance.DataGenericMapper">
<ObjectName>$Config/ObjectName$</ObjectName>
<CounterName>$Config/CounterName$</CounterName>
<InstanceName>$Config/InstanceName$</InstanceName>
<Value>$Data/Property[@Name="Number"]$</Value>
</ConditionDetection>
</MemberModules>
<Composition>
<Node ID="Mapper">
<Node ID="ScriptProbePS">
<Node ID="SnmpDataSource"/>
</Node>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>Perf!System.Performance.Data</OutputType>
</DataSourceModuleType>