Collector Backlog datasource

TheBackbone.SMP04.Monitoring.Collector.Backlog.DataSource (DataSourceModuleType)

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
SchedulerDS DataSource System.Scheduler Default
ScriptPA ProbeAction Microsoft.Windows.PowerShellPropertyBagProbe Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$FrequencySpecifies the frequency of the backlog workflow
Debugbool$Config/Debug$DebugEnables the debug option in the backlog script

Source Code:

<DataSourceModuleType ID="TheBackbone.SMP04.Monitoring.Collector.Backlog.DataSource" Accessibility="Internal" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" type="xsd:integer" name="IntervalSeconds"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" type="xsd:boolean" name="Debug"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="Debug" Selector="$Config/Debug$" ParameterType="bool"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="SchedulerDS" TypeID="System!System.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval Unit="Seconds">$Config/IntervalSeconds$</Interval>
</SimpleReccuringSchedule>
<ExcludeDates/>
</Scheduler>
</DataSource>
<ProbeAction ID="ScriptPA" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagProbe">
<ScriptName>TheBackbone.SMP04.Collector.Backlog.ps1</ScriptName>
<ScriptBody><Script> param($CollectorPath, $Debug)

# Get access to the scripting API
$oApi=new-object -comObject "MOM.ScriptAPI"

function Debug ($EventId, $Message)
{
if($Debug)
{
$oApi.LogScriptEvent("TheBackbone.SMP04.Collector.Backlog.ps1", $EventId, 0, $Message)
}
}

Debug 1080 "Script started"

$Bag = $oApi.CreatePropertyBag()

if(!(Test-Path ($CollectorPath)))
{
$oApi.LogScriptEvent("TheBackbone.SMP04.Collector.Backlog.ps1", 1081, 3, "Collectorpath $CollectorPath does not exists, exit")
exit 1
}

$EumFiles = null

Try
{
$EumFiles= (new-object System.IO.DirectoryInfo($CollectorPath)).GetFiles("*.eum")
}
Catch
{
$oApi.LogScriptEvent("TheBackbone.SMP04.Collector.Backlog.ps1", 1082, 3, "Exception retrieving information from directory $CollectorPath, exit")
exit 1
}

$OldestEumFile = ""
$OldestEumFileCreationDate = ""

if($EumFiles.Count -gt 0){
$OldestEumFile = $EumFiles | Sort CreationTime | select -First 1
$OldestEumFileCreationDate = $OldestEumFile.CreationTime
}

Debug 1083 ("Information found for collectorpath {0}, There are {1} files in backlog. Oldest file has a creation date of {2}" -f $CollectorPath,$EumFiles.Count,$OldestEumFileCreationDate)

$Bag.AddValue("BacklogFileCount",$EumFiles.Count)
$Bag.AddValue("OldestFileName",$OldestEumFile)
$Bag.AddValue("OldestFileCreationDate",$OldestEumFileCreationDate)

$Bag

Debug 1089 "Script Ended"
</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>CollectorPath</Name>
<Value>$Target/Property[Type="TSL!TheBackbone.SMP04.Collector.Class"]/CollectorPath$</Value>
</Parameter>
<Parameter>
<Name>Debug</Name>
<Value>$Config/Debug$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>300</TimeoutSeconds>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="ScriptPA">
<Node ID="SchedulerDS"/>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
</DataSourceModuleType>