|
Huntland Services Ltd Tel: +44 (0)1392-490518
|
Setting the Alert Resolution State by Script
|
||||
|
[NB Updated 06/08/02 to include additional modification to 'Alert.TimeResolved'.] Being able to trawl through all the outstanding alerts on the System and set them to some resolution state can be very useful for MOM administrators. For instance, sometimes it's convenient to set all the alerts to resolved, or allocate an owner to many alerts, or change the state of all the alerts for a particular computer. Most of these actions are possible via the MOM Admin Console but here are a couple of scripts that might just make life a little easier. UpdateAlertResolutionBySource.sqlThis script will want the name of a particular source (e.g. 'DNS' or 'W3Svc'). These values can be seen in the Source column when viewing the 'All Open Alerts' panel in the MOM Admin Console. It will then pass through the Alert table modifying the ResolutionState field wherever it finds the alert was raised from your nominated source. The example below would change the Alert state of all DNS sourced alerts to 'New', mark each record with the data and time of when it was modified, who made the modification and who the owner is. It also updates the Alert History table with the original entry so you can keep track of how the alert has progressed.
UpdateAlertResolutionByComputer.sqlAnother angle on the same problem is to change the state for all alerts that belong to a particular computer. This allows you to say set all the alerts to resolved for a particular box because you've dealt with all the problems and want to start afresh. This example does this for a machine called 'Server1'
Resolution StatesMOM uses an integer between 0 and 255 to designate the resolution state of an alert. Administrators can create their own, such as 'Pending', and designate a number from within this range. However some numbers are reserved and in use by the system for the standard resolution states. They are as follows:
Obviously it makes sense when creating new Resolution States to number them in sequence as to how they are escalated.
Please accept these Transact SQL scripts as is. In all cases it makes sense to test them out in your own environment and always back up the data first. Any feed back will be gratefully received at Debug@huntland.co.uk
|
|||||