scipt-based, alert-generating rule
Hello,
Is it possible to create a scipt-based, alert-generating rule? We need to generate an alert if a particular file does not exist in the file system. Though "Timed Commands\Execute a Script" exists as a rule type, it does not have a "System.Health.GenerateAlert"
write action module. Can I simply copy this write action module (XML) from an alert-generating rule?
thanks
October 24th, 2011 7:30am
Hello,
Like this:
<Rule ID="Demo.NewRule" Enabled="true" Target="Windows!Microsoft.Windows.Server.OperatingSystem" ConfirmDelivery="true" Remotable="true" Priority="Normal" DiscardLevel="100">
<Category>Custom</Category>
<DataSources>
<DataSource ID="Bag" TypeID="Windows!Microsoft.Windows.TimedScript.PropertyBagProvider">
<IntervalSeconds>100</IntervalSeconds>
<SyncTime>00:00</SyncTime>
<ScriptName>ScriptName.vbs</ScriptName>
<Arguments>Argument1 Argument2</Arguments>
<ScriptBody><[![CDATA
place your script here,
you can use this script
]]></ScriptBody>
<TimeoutSeconds>1</TimeoutSeconds>
</DataSource>
</DataSources>
<ConditionDetection ID="ex" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='MyProperty']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Bad</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
<WriteActions>
<WriteAction ID="Alert" TypeID="Health!System.Health.GenerateAlert">
<Priority>0</Priority>
<Severity>0</Severity>
</WriteAction>
</WriteActions>
</Rule>http://OpsMgr.ru/
Free Windows Admin Tool Kit Click here and download it now
October 24th, 2011 8:14am
Here are more information:
How to generate an alert directly from a script-based rule
http://blogs.technet.com/b/jonathanalmquist/archive/2010/05/25/how-to-generate-an-alert-directly-from-a-script-based-rule.aspxPlease remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
October 25th, 2011 2:51am
Rule or monitor? For checking for the existence of a file, I'd go with a monitor so that it's state based (does the file exist? Yes/No) And you can do this in the authoring node of the SCOM console; just create a new monitor, select Scripting-Generic-2
State Monitor. Drop your script in and have it return a property bag that says "good" or "bad" (or whatever), and evaluate that as the state of the monitor. I have an MP that I can share with you that does this for the age of a specific file. Email me at my
handle @gmail and I'll send it along."Fear disturbs your concentration"
Free Windows Admin Tool Kit Click here and download it now
October 25th, 2011 11:09am