In my "QuickTricks: Removing Images from the Topology and Image Widgets" blog post I explained a quick way to remove images which you added for the Image or Topology widgets. Behind the scenes I spent several hours trying to find any way to be able to remove these images. This blog post will go into the behind-the-scenes tricks used to track this one down as it gives some good tricks which may be helpful in the future with Operations Manager.
Where does Operations Manager store information?
To track down to remove this image it required stepping back and thinking about any location where this information could be stored in Operations Manager. From a high level I could only think of three areas where information such as these images could be stored in Operations Manager:
- XML files
Each of these areas stores information relevant to Operations Manager, we’ll start with the registry.
Setting up the test
To identify where information is being stored for Operations Manager, I recommend picking a unique string which would not be found elsewhere in the registry, XML files or in the OperationsManager database. For my examples I chose names, but other random syntax could also be used like: ABC123XYZ. When the string is unique it removes the difficulty of tracking through any existing references to the same string. So as an example, if I wanted to find where a view was stored I could name the view "ABC123XYZ" and then search for that string in the various locations.
For this test, I initially uploaded two images with unique names into the image widget and the topology widget to see where that information was stored. The first was "Marnix and I" and the second was "Ultima Online" (see the quicktricks blog post for the history on these).
Where does Operations Manager store information in the registry?
The registry settings for Operations Manager are under HKLM\SOFTWARE\Microsoft\Microsoft Operations Manager as shown below.
For details on the registry see the Operations Manager Unleashed book in Appendix C. Information stored in the registry is server specific so we would expect that nothing which would need to span management servers (such as an image uploaded into a topology or image widget) would be stored in the registry. What we would expect is to see management server specific information and general configuration information for Operations Manager.
As an example the network discovery section is shown below.
Which makes sense as the same discovery is configured for this server as shown below in the Network Devices Discovery Wizard.
A quick search through the registry confirmed my expectation that there was no reference to either of my unique strings (Marnix, UltimaOnline) in the registry on the management server. So… The image information is not in the registry on the management server.
Where does Operations Manager store information in the management pack XML files?
When you add an override in Operations Manager or create a new management pack, XML files distributed to the management server in the following default location: C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\Health Service State\Management Packs. When the images were uploaded, there were no new XML files or updated time/date stamps found in this directory structure. In hindsight it makes sense that the images would not be listed here as this type of a change would not need to be replicated to other servers to change how they are being monitored (which is what would occur in the case of an override which changes behavior of a management pack).
So… The image information is not in the folder where XML files are stored for Operations Manager.
Where does Operations Manager store information in the database?
That leaves the big place where data can be stored – in the OperationsManager database. So on to the OperationsManager database we go! The biggest question at this point is – where in the heck would this information actually be stored with the various tables within the OperationsManager database. Using the script in this post was able to search the entire OperationsManager database/all tables to identify locations of the unique string which I had chosen: http://gallery.technet.microsoft.com/scriptcenter/c0c57332-8624-48c0-b4c3-5b31fe641c58
Using the above stored procedure I was able to find what references there were for both of the two unique strings.
So, where did I find Marnix in the OperaitonsManager database? And where did I find Ultima Online in the OperationsManager database?
After creating the above stored procedure I used this query to search all tables for any reference to "Marnix" in the OperationsManager database.
EXEC SP_SearchTables @Tablenames = ‘%’
,@SearchStr = ‘%Marnix%’
The results indicated three references that string in the database in the tables: dbo.ManagementPack, dbo.LocalizedText and dbo.Resource as shown below.
And the same query done for the search string "UltimaOnline" provided similar results. The results indicated three references the string in the same tables identified earlier.
NOTE: At this point it may seem like a good idea to just remove these three references from the database but from personal experience (and supportability requirements I expect) I would not recommend taking that approach.
Further digging revealed that the MPRunTimeXML field from the dbo.ManagementPack table had the relevant information to resolve this issue. The field had XML readable content which could be copied out and viewed in notepad. The XML shown below referenced both unique strings and indicated the name of the management pack (see the ID field below: "Microsoft.SystemCenter.Visualization.Component.Library.Resources").
This could now be tracked back to a specific management pack in the Operations Manager environment as shown below.
And to match up the ID for the management pack:
To remove the non-required images, I removed the Microsoft.SystemCenter.Visualization.Component.Library.Resources MP (as discussed in the earlier blog post). And then validate that the images were no longer appearing on the topology widget:
And were no longer appearing in the image widget.
This management pack appears to be created when you upload an image. I tested this concept by uploading a new graphic with a new unique string. [As part of the debug I ended up rebooting the Operations Manager management server and the server the console was installed on]. The unique graphic for this round included several of the speakers from the SCU Europe event last year. J
Once this was successfully added I could now validate that the Management Pack was re-created as shown below.
And now we can find Maarten (or Anders or Pete) in the OperationsManager database to validate that we receive the same table results that we saw earlier.
Exporting the Microsoft.SystemCenter.Visualization.Component.Library.Resources management pack results in an MPB file which may be able to be used to provide a backup for this MP if you will be using a significant number of images in either of these widgets. So if you wanted to remove one you could delete the pack and then re-import the backed-up version of the management pack.
Summary: Hopefully this blog post has given a good review of where Operations Manager stores data and has provided some useful tricks which may be useful in tracking down data in similar situations (such as the query of all tables in the OperationsManager database for a unique string – that’s my favorite new OM trick J ).