Skip to content

Commit

Permalink
Merge pull request #48 from stegenfeldt:stegenfeldt/issue44
Browse files Browse the repository at this point in the history
FIXED #44 - New overridable property for how many "bad" files are required for a critical alert. Less than that generates a warning.
  • Loading branch information
stegenfeldt authored Apr 5, 2022
2 parents f4bb168 + 32f7804 commit 3ad707a
Show file tree
Hide file tree
Showing 17 changed files with 267 additions and 162 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DeploymentNextVersion>1.0.3.328</DeploymentNextVersion>
<DeploymentNextVersion>1.0.3.337</DeploymentNextVersion>
</PropertyGroup>
</Project>
10 changes: 8 additions & 2 deletions Atea.Windows.File.Monitoring/HealthModel/Monitors/FileAge.mptg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Instance ID="Instance1cb8bbbf42bb4bd8ba0ce5a2d4aaa2da" Type="Microsoft.SystemCenter.Authoring.CodeGeneration.Monitoring.UnitMonitor" Version="1.0.0.0">
<UnitMonitorConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MonitorType>Windows.File.FileAge.MonitorType</MonitorType>
<MonitorConfig>&lt;TimeoutSeconds&gt;300&lt;/TimeoutSeconds&gt;&lt;IntervalSeconds&gt;300&lt;/IntervalSeconds&gt;&lt;FolderFriendlyName&gt;$Target/Property[Type="Atea.Windows.File.FileAgeFolder"]/FriendlyName$&lt;/FolderFriendlyName&gt;&lt;FileAgeAttribute&gt;$Target/Property[Type="Atea.Windows.File.FileAgeFolder"]/FileAgeAttribute$&lt;/FileAgeAttribute&gt;&lt;EnableVerboseLogging&gt;false&lt;/EnableVerboseLogging&gt;</MonitorConfig>
<MonitorConfig>&lt;TimeoutSeconds&gt;300&lt;/TimeoutSeconds&gt;&lt;IntervalSeconds&gt;300&lt;/IntervalSeconds&gt;&lt;FolderFriendlyName&gt;$Target/Property[Type="Atea.Windows.File.FileAgeFolder"]/FriendlyName$&lt;/FolderFriendlyName&gt;&lt;FileAgeAttribute&gt;$Target/Property[Type="Atea.Windows.File.FileAgeFolder"]/FileAgeAttribute$&lt;/FileAgeAttribute&gt;&lt;EnableVerboseLogging&gt;false&lt;/EnableVerboseLogging&gt;&lt;FileCountErrorThreshold&gt;1&lt;/FileCountErrorThreshold&gt;</MonitorConfig>
<MonitorOperationalStates>
<OperationalState>
<OperationalStateId>Healthy</OperationalStateId>
Expand All @@ -13,10 +13,16 @@
</OperationalState>
<OperationalState>
<OperationalStateId>Error</OperationalStateId>
<OperationalStateDisplayName>Bad Files Found</OperationalStateDisplayName>
<OperationalStateDisplayName>Too Many Unwanted Files Found</OperationalStateDisplayName>
<MonitorTypeStateId>Error</MonitorTypeStateId>
<HealthState>Error</HealthState>
</OperationalState>
<OperationalState>
<OperationalStateId>Warning</OperationalStateId>
<OperationalStateDisplayName>Some Unwanted Files Found</OperationalStateDisplayName>
<MonitorTypeStateId>Warning</MonitorTypeStateId>
<HealthState>Warning</HealthState>
</OperationalState>
</MonitorOperationalStates>
<ParentMonitor>Health!System.Health.AvailabilityState</ParentMonitor>
<Accessibility>Public</Accessibility>
Expand Down
Binary file modified Atea.Windows.File.Monitoring/HealthModel/Monitors/FileAge.mptg.mpx
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<TemplateGroup>
<Instances>
<Instance ID="Instance1cb8bbbf42bb4bd8ba0ce5a2d4aaa2da" Type="Microsoft.SystemCenter.Authoring.CodeGeneration.Monitoring.UnitMonitor" Version="1.0.0.0">
<UnitMonitorConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<UnitMonitorConfig xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MonitorType>Atea.Windows.File.Monitoring.FileShareFreeSpace.MonitorType</MonitorType>
<MonitorConfig>&lt;TimeoutSeconds&gt;60&lt;/TimeoutSeconds&gt;&lt;IntervalSeconds&gt;600&lt;/IntervalSeconds&gt;&lt;ShareName&gt;$Target/Property[Type="Atea.Windows.File.Monitoring.FileShareWatcher"]/ShareName$&lt;/ShareName&gt;&lt;UNCPath&gt;$Target/Property[Type="Atea.Windows.File.Monitoring.FileShareWatcher"]/UNCPath$&lt;/UNCPath&gt;&lt;FreeSpaceErrorThreshold&gt;3&lt;/FreeSpaceErrorThreshold&gt;&lt;FreeSpaceWarningThreshold&gt;10&lt;/FreeSpaceWarningThreshold&gt;&lt;UsePercent&gt;true&lt;/UsePercent&gt;</MonitorConfig>
<MonitorOperationalStates>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ManagementPackFragment SchemaVersion="2.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TypeDefinitions>
<SecureReferences>
<SecureReference ID="Atea.Windows.File.FileCreationTimeFolder.RunasProfile" Accessibility="Public" Context="Atea.Windows.File.FileCreationTimeFolder" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ManagementPackFragment SchemaVersion="2.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TypeDefinitions>
<SecureReferences>
<SecureReference ID="Atea.Windows.File.FileShareMonitoring.RunasProfile" Accessibility="Public" Context="Atea.Windows.File.FileCreationTimeFolder" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ManagementPackFragment SchemaVersion="2.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TypeDefinitions>
<ModuleTypes>
<ProbeActionModuleType ID="Atea.Windows.File.FileAgeFolder.DiscoveryProbe" Accessibility="Internal" Batching="false" PassThrough="false">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ManagementPackFragment SchemaVersion="2.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TypeDefinitions>
<ModuleTypes>
<ProbeActionModuleType ID="Atea.Windows.File.Monitoring.FileAgeProbeModule" Accessibility="Internal">
Expand All @@ -10,7 +11,7 @@
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="FileTimeAttribute" ParameterType="string" Selector="$Config/FileAgeAttribute$" />
<OverrideableParameter ID="TimeoutSeconds" ParameterType="int" Selector="$Config/TimeoutSeconds$"/>
<OverrideableParameter ID="TimeoutSeconds" ParameterType="int" Selector="$Config/TimeoutSeconds$" />
<OverrideableParameter ID="EnableVerboseLogging" ParameterType="string" Selector="$Config/EnableVerboseLogging$" />
</OverrideableParameters>
<ModuleImplementation>
Expand Down Expand Up @@ -43,4 +44,4 @@
</ProbeActionModuleType>
</ModuleTypes>
</TypeDefinitions>
</ManagementPackFragment>
</ManagementPackFragment>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ManagementPackFragment SchemaVersion="2.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TypeDefinitions>
<ModuleTypes>
<ProbeActionModuleType ID="Atea.Windows.File.Monitoring.FileShareSpacePropertyBagProbe" Accessibility="Internal">
Expand Down Expand Up @@ -55,4 +56,4 @@
</ProbeActionModuleType>
</ModuleTypes>
</TypeDefinitions>
</ManagementPackFragment>
</ManagementPackFragment>
Original file line number Diff line number Diff line change
@@ -1,110 +1,154 @@
<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TypeDefinitions>
<MonitorTypes>
<!--<UnitMonitorType ID="Windows.File.FileAge.MonitorType" Accessibility="Internal" RunAs="Atea.Windows.File.FileCreationTimeFolder.RunasProfile">-->
<UnitMonitorType ID="Windows.File.FileAge.MonitorType" Accessibility="Internal">
<MonitorTypeStates>
<MonitorTypeState ID="Healthy"/>
<MonitorTypeState ID="Error"/>
</MonitorTypeStates>
<Configuration>
<xsd:element minOccurs="1" name="TimeoutSeconds" type="xsd:integer" />
<xsd:element minOccurs="1" name="IntervalSeconds" type="xsd:integer" />
<xsd:element minOccurs="1" name="FolderFriendlyName" type="xsd:string" />
<xsd:element minOccurs="1" name="FileAgeAttribute" type="xsd:string" />
<xsd:element minOccurs="0" name="EnableVerboseLogging" type="xsd:string" />
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="TimeOutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
<OverrideableParameter ID="FileAgeAttribute" Selector="$Config/FileAgeAttribute$" ParameterType="string"/>
<OverrideableParameter ID="EnableVerboseLogging" Selector="$Config/EnableVerboseLogging$" ParameterType="string"/>
</OverrideableParameters>
<MonitorImplementation>
<MemberModules>
<DataSource ID="TimedFileAgePropertyBag" TypeID="Atea.Windows.File.FileAge.TimedPropertyBag">
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<FolderFriendlyName>$Config/FolderFriendlyName$</FolderFriendlyName>
<FileAgeAttribute>$Config/FileAgeAttribute$</FileAgeAttribute>
<EnableVerboseLogging>$Config/EnableVerboseLogging$</EnableVerboseLogging>
</DataSource>
<ProbeAction ID="Probe" TypeID="Atea.Windows.File.Monitoring.FileAgeProbeModule">
<FileAgeAttribute>$Config/FileAgeAttribute$</FileAgeAttribute>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<FolderFriendlyName>$Config/FolderFriendlyName$</FolderFriendlyName>
<EnableVerboseLogging>$Config/EnableVerboseLogging$</EnableVerboseLogging>
</ProbeAction>
<ConditionDetection ID="FilterFolder" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>Property[@Name='FolderFriendlyName']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$Config/FolderFriendlyName$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
<ConditionDetection ID="ErrorFilter" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='FileCount']</XPathQuery>
</ValueExpression>
<Operator>NotEqual</Operator>
<ValueExpression>
<Value Type="String">0</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
<ConditionDetection ID="HealthyFilter" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='FileCount']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">0</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
</MemberModules>
<RegularDetections>
<RegularDetection MonitorTypeStateID="Healthy">
<Node ID="HealthyFilter">
<Node ID="TimedFileAgePropertyBag" />
</Node>
</RegularDetection>
<RegularDetection MonitorTypeStateID="Error">
<Node ID="ErrorFilter">
<Node ID="TimedFileAgePropertyBag" />
</Node>
</RegularDetection>
</RegularDetections>
<OnDemandDetections>
<OnDemandDetection MonitorTypeStateID="Healthy">
<Node ID="HealthyFilter">
<Node ID="FilterFolder">
<Node ID="Probe" />
</Node>
</Node>
</OnDemandDetection>
<OnDemandDetection MonitorTypeStateID="Error">
<Node ID="ErrorFilter">
<Node ID="FilterFolder">
<Node ID="Probe" />
</Node>
</Node>
</OnDemandDetection>
</OnDemandDetections>
</MonitorImplementation>
</UnitMonitorType>
</MonitorTypes>
</TypeDefinitions>
<ManagementPackFragment SchemaVersion="2.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TypeDefinitions>
<MonitorTypes>
<!--<UnitMonitorType ID="Windows.File.FileAge.MonitorType" Accessibility="Internal" RunAs="Atea.Windows.File.FileCreationTimeFolder.RunasProfile">-->
<UnitMonitorType ID="Windows.File.FileAge.MonitorType" Accessibility="Internal">
<MonitorTypeStates>
<MonitorTypeState ID="Healthy" />
<MonitorTypeState ID="Warning" />
<MonitorTypeState ID="Error" />
</MonitorTypeStates>
<Configuration>
<xsd:element minOccurs="1" name="TimeoutSeconds" type="xsd:integer" />
<xsd:element minOccurs="1" name="IntervalSeconds" type="xsd:integer" />
<xsd:element minOccurs="1" name="FolderFriendlyName" type="xsd:string" />
<xsd:element minOccurs="1" name="FileAgeAttribute" type="xsd:string" />
<xsd:element minOccurs="0" name="EnableVerboseLogging" type="xsd:string" />
<xsd:element minOccurs="1" name="FileCountErrorThreshold" type="xsd:integer" />
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="TimeOutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
<OverrideableParameter ID="FileAgeAttribute" Selector="$Config/FileAgeAttribute$" ParameterType="string" />
<OverrideableParameter ID="EnableVerboseLogging" Selector="$Config/EnableVerboseLogging$" ParameterType="string" />
<OverrideableParameter ID="FileCountErrorThreshold" Selector="$Config/FileCountErrorThreshold$" ParameterType="int" />
</OverrideableParameters>
<MonitorImplementation>
<MemberModules>
<DataSource ID="TimedFileAgePropertyBag" TypeID="Atea.Windows.File.FileAge.TimedPropertyBag">
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<FolderFriendlyName>$Config/FolderFriendlyName$</FolderFriendlyName>
<FileAgeAttribute>$Config/FileAgeAttribute$</FileAgeAttribute>
<EnableVerboseLogging>$Config/EnableVerboseLogging$</EnableVerboseLogging>
</DataSource>
<ProbeAction ID="Probe" TypeID="Atea.Windows.File.Monitoring.FileAgeProbeModule">
<FileAgeAttribute>$Config/FileAgeAttribute$</FileAgeAttribute>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<FolderFriendlyName>$Config/FolderFriendlyName$</FolderFriendlyName>
<EnableVerboseLogging>$Config/EnableVerboseLogging$</EnableVerboseLogging>
</ProbeAction>
<ConditionDetection ID="FilterFolder" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>Property[@Name='FolderFriendlyName']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$Config/FolderFriendlyName$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
<ConditionDetection ID="ErrorFilter" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='FileCount']</XPathQuery>
</ValueExpression>
<Operator>GreaterEqual</Operator>
<ValueExpression>
<Value Type="Integer">$Config/FileCountErrorThreshold$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
<ConditionDetection ID="WarningFilter" TypeID="System!System.ExpressionFilter">
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='FileCount']</XPathQuery>
</ValueExpression>
<Operator>Less</Operator>
<ValueExpression>
<Value Type="Integer">$Config/FileCountErrorThreshold$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='FileCount']</XPathQuery>
</ValueExpression>
<Operator>NotEqual</Operator>
<ValueExpression>
<Value Type="Integer">0</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</ConditionDetection>
<ConditionDetection ID="HealthyFilter" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='FileCount']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="Integer">0</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
</MemberModules>
<RegularDetections>
<RegularDetection MonitorTypeStateID="Healthy">
<Node ID="HealthyFilter">
<Node ID="TimedFileAgePropertyBag" />
</Node>
</RegularDetection>
<RegularDetection MonitorTypeStateID="Warning">
<Node ID="WarningFilter">
<Node ID="TimedFileAgePropertyBag" />
</Node>
</RegularDetection>
<RegularDetection MonitorTypeStateID="Error">
<Node ID="ErrorFilter">
<Node ID="TimedFileAgePropertyBag" />
</Node>
</RegularDetection>
</RegularDetections>
<OnDemandDetections>
<OnDemandDetection MonitorTypeStateID="Healthy">
<Node ID="HealthyFilter">
<Node ID="FilterFolder">
<Node ID="Probe" />
</Node>
</Node>
</OnDemandDetection>
<OnDemandDetection MonitorTypeStateID="Warning">
<Node ID="WarningFilter">
<Node ID="FilterFolder">
<Node ID="Probe" />
</Node>
</Node>
</OnDemandDetection>
<OnDemandDetection MonitorTypeStateID="Error">
<Node ID="ErrorFilter">
<Node ID="FilterFolder">
<Node ID="Probe" />
</Node>
</Node>
</OnDemandDetection>
</OnDemandDetections>
</MonitorImplementation>
</UnitMonitorType>
</MonitorTypes>
</TypeDefinitions>
</ManagementPackFragment>
Loading

0 comments on commit 3ad707a

Please sign in to comment.