-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMonitor.Unix.ShellCommand.mpx
More file actions
141 lines (136 loc) · 7.87 KB
/
Monitor.Unix.ShellCommand.mpx
File metadata and controls
141 lines (136 loc) · 7.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--
%%
Description:
A MONITOR to run a SHELL COMMAND and compare the ouput of the command to expression criteria
In this example we compare the output based on whether it will return a "0" or a "1" but this can be changed
CompanyID - is a short abbreviation for your company with NO SPACES OR SPECIAL CHARACTERS ALLOWED
AppName - is a short name for your app with NO SPACES OR SPECIAL CHARACTERS ALLOWED
ClassID - is the targeted class such as your custom class or Windows!Microsoft.Windows.Server.OperatingSystem
UniqueID - Is a unique short description of the monitor purpose (NO SPACES OR SPECIAL CHARACTERS ALLOWED) such as "MonitorFilesInFolder"
ShellCommand - My sample shell command looks for a file in a directory such as: "ls /opt/myapp|wc -l"
Version: 1.1
LastModified: 4-Nov-2017
%%
In this fragment you need to replace:
##CompanyID##
##AppName##
##ClassID##
##UniqueID##
##ShellCommand##
This fragment depends on references:
RequiredReference: Alias="Health", ID="System.Health.Library"
RequiredReference: Alias="MUL", ID="Microsoft.Unix.Library"
RequiredReference: Alias="MUSL", ID="Microsoft.Unix.ShellCommand.Library"
@@Author=Kevin Holman@@
-->
<Monitoring>
<Monitors>
<UnitMonitor ID="##CompanyID##.##AppName##.##UniqueID##.Unix.ShellCommand.Monitor" Accessibility="Public" Enabled="true" Target="##ClassID##" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="MUSL!Microsoft.Unix.ShellCommand.TwoState.MonitorType" ConfirmDelivery="false">
<Category>Custom</Category>
<AlertSettings AlertMessage="##CompanyID##.##AppName##.##UniqueID##.Unix.ShellCommand.Monitor.AlertMessage">
<AlertOnState>Warning</AlertOnState> <!-- Warning or Error should match OperationalStates below -->
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Warning</AlertSeverity> <!-- Common options for AlertSeverity are MatchMonitorHealth, Information, Warning, Error -->
<AlertParameters>
<AlertParameter1>$Target/Host/Property[Type="MUL!Microsoft.Unix.Computer"]/PrincipalName$</AlertParameter1>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />
<OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Warning" /> <!-- HealthState = Warning or Error -->
</OperationalStates>
<Configuration>
<Interval>900</Interval> <!-- seconds -->
<SyncTime />
<TargetSystem>$Target/Host/Property[Type="MUL!Microsoft.Unix.Computer"]/NetworkName$</TargetSystem>
<UserName>$RunAs[Name="MUL!Microsoft.Unix.ActionAccount"]/UserName$</UserName>
<Password>$RunAs[Name="MUL!Microsoft.Unix.ActionAccount"]/Password$</Password>
<ShellCommand>##ShellCommand##</ShellCommand>
<TimeOut>120</TimeOut>
<TimeOutInMS>120000</TimeOutInMS>
<HealthyExpression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">//*[local-name()="StdOut"]</XPathQuery> <!-- Common options for XPathQuery Type are "Boolean" "String" "Integer" "Double" -->
</ValueExpression>
<Operator>Equal</Operator> <!-- Common options for SimpleExpression Operator are "Equal" "NotEqual" "Greater" "Less" "GreaterEqual" "LessEqual" "Like" "NotLike" -->
<ValueExpression>
<Value Type="Integer">1</Value> <!-- Common options for XPathQuery Type are "Boolean" "String" "Integer" "Double" -->
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">//*[local-name()="ReturnCode"]</XPathQuery> <!-- Common options for XPathQuery Type are "Boolean" "String" "Integer" "Double" -->
</ValueExpression>
<Operator>Equal</Operator> <!-- Common options for SimpleExpression Operator are "Equal" "NotEqual" "Greater" "Less" "GreaterEqual" "LessEqual" "Like" "NotLike" -->
<ValueExpression>
<Value Type="Integer">0</Value> <!-- Common options for XPathQuery Type are "Boolean" "String" "Integer" "Double" -->
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</HealthyExpression>
<ErrorExpression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">//*[local-name()="StdOut"]</XPathQuery> <!-- Common options for XPathQuery Type are "Boolean" "String" "Integer" "Double" -->
</ValueExpression>
<Operator>NotEqual</Operator> <!-- Common options for SimpleExpression Operator are "Equal" "NotEqual" "Greater" "Less" "GreaterEqual" "LessEqual" "Like" "NotLike" -->
<ValueExpression>
<Value Type="Integer">1</Value> <!-- Common options for XPathQuery Type are "Boolean" "String" "Integer" "Double" -->
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">//*[local-name()="ReturnCode"]</XPathQuery> <!-- Common options for XPathQuery Type are "Boolean" "String" "Integer" "Double" -->
</ValueExpression>
<Operator>Equal</Operator> <!-- Common options for SimpleExpression Operator are "Equal" "NotEqual" "Greater" "Less" "GreaterEqual" "LessEqual" "Like" "NotLike" -->
<ValueExpression>
<Value Type="Integer">0</Value> <!-- Common options for XPathQuery Type are "Boolean" "String" "Integer" "Double" -->
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</ErrorExpression>
</Configuration>
</UnitMonitor>
</Monitors>
</Monitoring>
<Presentation>
<StringResources>
<StringResource ID="##CompanyID##.##AppName##.##UniqueID##.Unix.ShellCommand.Monitor.AlertMessage" />
</StringResources>
</Presentation>
<LanguagePacks>
<LanguagePack ID="ENU" IsDefault="true">
<DisplayStrings>
<DisplayString ElementID="##CompanyID##.##AppName##.##UniqueID##.Unix.ShellCommand.Monitor">
<Name>##CompanyID## ##AppName## Unix ShellCommand Monitor</Name>
<Description />
</DisplayString>
<DisplayString ElementID="##CompanyID##.##AppName##.##UniqueID##.Unix.ShellCommand.Monitor" SubElementID="StatusError">
<Name>StatusError</Name>
</DisplayString>
<DisplayString ElementID="##CompanyID##.##AppName##.##UniqueID##.Unix.ShellCommand.Monitor" SubElementID="StatusOK">
<Name>StatusOK</Name>
</DisplayString>
<DisplayString ElementID="##CompanyID##.##AppName##.##UniqueID##.Unix.ShellCommand.Monitor.AlertMessage">
<Name>##CompanyID## ##AppName## Unix ShellCommand Monitor Alert</Name>
<Description>The shell command output returned a bad result on {0}
The shell command executed was "##ShellCommand##"</Description>
</DisplayString>
</DisplayStrings>
<KnowledgeArticles></KnowledgeArticles>
</LanguagePack>
</LanguagePacks>
</ManagementPackFragment>