Important: Consider this script as BETA! I will not take responsibility for any damage this script might cause due to unforseen behaviour.
NOTE: I will rephrase this and add an Example with shiny screenshots once I find time for it.
how, what and why would I write this?
I had several reasons but basically there is nothing more boring than creating overrides for Management Packs one by one. It’s a time consuming, mind-numbing process that I prefer to solve by running a script.
And since I was already planning it, I thought I’d create a very generic one.
We only react to alerts that have a High Priority. So, when we import a new Management Pack like the SQL Management Pack we’d have to override the Priority of Alerts one by one until the ones we don’t want to see are gone.
So I thought: Instead of doing this over and over for each Management Pack we just pre-override the Alerts to Medium and only activate the ones we really want to see.
In the script you can find attached to this Blog you see the following Properties at the Top:
– OverrideMPDisplayName (Display Name of the MP in which you store the Overrides. Only alpha-numerical)
– FilePath (Folder in which you drop the Management Pack)
– MPNames (Name of an MP or a list of names separated by a semicolon ; )
– OverridePropertyName (Name of the Property you want to Override)
– OverrideValue (Value for the Override)
– RootManagementServer (name of the RMS)
Step 1: Loading/Creating the Override Management Pack
I decided to write the Management Pack to some folder instead of writing it directly into the Operations Manager.
So what I do is, I take the OverrideMPDisplayName and create an MPName (Removing Spaces) for it. I then check if it already exists in the folder you configured in FilePath.
In case it does, I load it, in case it doesn’t, I create a new one. So, if you want to create overrides for various values you can just use the same Target MP over and over.
Step 2: Creating Overrides for each Management Pack
I load each Management Pack you provided from the RMS and check if it’s sealed, if it’s not, I can’t create an Override for it and skip it.
If everything is fine, I add a Reference to the currently processed MP in the Overrides MP.
I then iterate through each rule/monitor and check if the OverridePropertyName you provided is overrideable on it. If yes, I create an Override, otherwise I skip it.
Step 3: Save the Management Pack
When everything is finished, I save the Management Pack to your Filepath with the MPName I created for it. It’s the Displayname without spaces, file ending is .xml.
Note: I tested this with the Exchange 2010 Management Pack and when it says “Writing Management Pack…” it will stay there for quite some time. Actually, it takes ages. It has to verify each Override first, otherwise it won’t let you save the MP (that’s per default).