Hi Everyone,
Can a subject matter expert (SME) review my steps below and advise where the issue is as my PS script seems to run on all Servers rather than the 4 that I have targeted.
Thanks!
I have imported Community.PowerShellMonitoring-1.1.1-20170720.074505-2.mpb into OM1801
I want to monitor the health state (“Error”) or (“Ok”) of our HPE TRIM/RM/CM Mail Notification Processors.
If the Mail Notification Processor starts queuing mail it is a major issue for our business units (a “Stop the Press” event) and requires an Alert in the OM console and E-Mail via a OM Subscription.
STEPS
Open the Authoring PANE, and Look for “Windows Computer” which will be my target for my two state Availability Unit Monitor
Right click on “Availability”, create a monitor, unit monitor
Select Scripting/PowerShell Based/PowerShell Script Two State Monitor (Community)
Choose my destination MP (Company.Windows Server)
In the General properties, I enter the name, description
Monitor target is “Windows Computer”
I untick the “monitor is enabled” as I don’t want to push my powershell script out to ALL Servers. Once the monitor is created I will override the monitor and select the group I have created with the 4 x Windows Member Server Computers that are running the HPE Mail Notification Processor and enable by changing default from false to true.
In the configure a schedule wizard, I set the script every 60 minutes
In the “Enter script Information” screen, I enter my filename and PS script and set the timeout to 2 minutes. The PS script should return “Error” or “Ok” state to $PropertyBag:
$ScomAPI = New-Object -comObject “MOM.ScriptAPI”
$PropertyBag = $ScomAPI.CreatePropertyBag()
$query = Get-EventLog -log Application -After (Get-Date).AddHours(-1) | where-object {$_.Message -like “Mail Notification”}
if ($query) {
$PropertyBag.AddValue(“State”,”Error”)
}
else
{
#$PropertyBag.AddValue(“State”,”Ok”)
}
Send output to SCOM
$PropertyBag
In the “Filter one or more events” wizard for my two state unit monitor:
Parameter name Property(@Name=’State’) Operator Equals Error
Click Next
Parameter name Property(@Name=’State’) Operator Equals Ok
Click Next
Map Monitor to Conditions health state wizard
Monitor Condition, Operational State, Health State
Healthy, Healthy, Healthy
Unhealthy, Unhealthy, Critical
Click Next
Alert Settings wizard screen
TICK “Generate Alerts for this monitor”
Generate an alert when:
The monitor is in a critical health state
Enter Alert Properties, Alert Name/Description
Create a Group called “HPE Mail Notification Processor Hosts” and add the four servers that run the Mail Notification Processor.
Question: Should these objects be Microsoft.Windows.Computer.host.FQDN OR Microsoft.System.Center.Installed.OMProducts:host.FQDN.Microsoft Monitoring Agent?
Right click the monitor / Override the Monitor / For a Group / and select the group I created
Change Override / Enabled False to True / Click Apply
I then add a subscription / subscription criteria notify on all alerts for the monitor “HPE Mail Notification Processor Monitor”
Enter my AD user name, SMTP Channel, click finish and test.