You don't explain where the script runs nor how it determines which site is live, so the whole mechanism is quite unclear.
However it is absolutely possible to base a monitor or a rule on a powershell script result.
You can have a look at Kevin Holman's fragment library to get an idea of it's working, especially the Monitor.TimedScript.Powershell and Rule.AlertGEenrating.TimeScript.Powershell fragments.
https://github.com/thekevinholman/FragmentLibrary
SCOM 2012 Rule/Monitor based on outcome of a script
Hi,
Hope everyone is well.
We use SCOM2012 to monitor our environment.
We run live out of 1 of 2 sites.
I have a script that tells us which site is live. How best to use that before the rule/alert?
Example:
We have a Rule to check event logs for error eventid 666 and alert
We are live on site A
We do want the alerts for site A but not site B
Can you put the live site script in before the alert rule is processed?
Any help appreciated.
Cheers,
Sean
2 answers
Sort by: Most helpful
-
CyrAz 5,181 Reputation points
2021-06-24T14:38:04.337+00:00 -
Sean de Fraine 1 Reputation point
2021-06-24T14:52:39.497+00:00 My script just gathers TRUE or FALSE from a DNS lookup.
If LIVE SITE A is TRUE I want to run a rule against multiple servers in SITE A else run against servers in SITE B.I am not a coder so wondered if you could amend the Configuration Tab of the rule properties in any way by adding a Response before the Alert?