hmscott4 / AlertManagement

Manage SCOM Alerts
2 stars 3 forks source link

Assign-ScomAlert: Group assign.alert.config rules by owner #8

Closed randomnote1 closed 3 years ago

randomnote1 commented 3 years ago

Rather than defining each owner and management pack in a separate rule, define a single owner node with multiple management pack nodes. This will make the config file easier to maintain.

randomnote1 commented 3 years ago

Select Owner via XPath

Try {
     $assignmentRule=$configFile.SelectSingleNode("//config/exceptions/exception[@enabled='true']/Alert[@Name=""$alertName"" and @enabled='true']/parent::*")
    }

[assign.alert.config.txt](https://github.com/hmscott4/AlertManagement/files/6394202/assign.alert.config.txt)
Catch [System.Exception] {

        $msg=$_.Exception.Message
        $msgLevel=1
        Write-LogEntry $msg $msgLevel $logLevel $logFile
                                $warnCounter++
    }
    if($assignmentRule){
        $assignedTo=$assignmentRule.Owner
    }

assign.alert.config.txt

randomnote1 commented 3 years ago

@hmscott4, working on this now as it will be much too hard to do later. Just one question for you regarding Alert Exceptions. I think it makes sense to add the alert properties as separate nodes as opposed to attributes. That way they can be tagged as CDATA if necessary. Thoughts?

<Alert Name="Failed to perform Application Pool discovery" enabled="true">
    <AlertProperty>MonitoringObjectDisplayName</AlertProperty>
    <AlertPropertyMatches>rdpcert</AlertPropertyMatches>
</Alert>