Start Maintenance Mode with Opalis

In this post I want to show you a example how you can start Operations Manager maintenance mode from Opalis. Operations Manager maintenance mode is used to prevent alerts and notifications from objects that you under maintenance. In maintenance mode, alerts, notifications, rules, monitors, automatic responses, state changes, and new alerts are suppressed at the agent. By design, Operations Manager 2007 monitor that the agent is functioning correctly even if the computer is in maintenance mode. If the Health Service and the Health Service Watcher for the agent are not in maintenance mode when you reboot the machine, you will get an alert saying heartbeat failure and failed to connect to computer. This example will put the Windows computer, the health service and the health service watcher into maintenance mode.

The policy contains a number of objects
1. Custom Start.
2. Start maintenance mode for a windows computer
3. Start maintenance mode for a health service
4. Query the Operations Manager database to get the computer GUID
5. Start maintenance mode for a health service watcher
6. Generate a platform event including a summary

The Start Maintenance Mode object puts an monitor in Operations Manager into maintenance mode. You can use the object to browse for a object.

To put the health service watcher into maintenance mode we need the GUID of the machine. The other two “start maintenance mode” objects are a bit easier as we can input the server FQDN. To get the server GUID we run a query against the OperationsManager database.

As you can see in the picture, the database query returns a bit more than the GUID. To filter out everything except the GUID we will use two of the data manipulation functions that Opalis have.

We first split the result from the database query into two parts, split by the “;”. Then from the second part, in this example {B3278151-9AC8-5B3B-8924-5F1F7CE27DE7}, we use the MID feature and tells Opalis to get 36 characters starting at position 2. The result when we run this will be three maintenance modes, as shown in the picture below

Because Operations Manager 2007 polls maintenance mode settings only once every 5 minutes, there can be a delay in an object’s scheduled removal from maintenance mode. You can download my example here, 20110211_MM . Remember that you need to edit the Query database object to configure which account to use when query the database.

Please note that this is provided “as is” with no warranties at all.

9 thoughts on “Start Maintenance Mode with Opalis

  1. Hi,

    Thanks for this very good example !

    But I have question: look like Opalis put only 1 object in MaintenanceMode instead of put all objects and their contained objects (I haven’t found this option in the SCOM IP).

    Do you have any information how we can put “all objects and their contained objects” in MaintenanceMode ?

    Thanks

    Julien

  2. hrm… dont think you should build a solution that goes direct into the db, instead try to use the SDK and the objects that already exists. Can you post some more details on what kind of info you want to get from the CI?

  3. You can forward any parameters from SCSM to Opalis, take a look at my opalis example where I create user accounts. The difficult part can be that yo need to know which objects to put into maintenance mode. But you can solve that by running the maintenance mode cmdlet from OPalis, it will but all the objects below the target object into maintenance mode too.

  4. To elaborate on your post, we basically want to put servers in maintenance mode in SCOM from a change request that’s generated in SCSM. Looks like we’ll need to somehow carry over schedulestartdate, scheduledenddate and config items to change. We’re finding the start/end time info but can’t find a way that it would know which systems to put into MM. Any ideas?

  5. I’m looking to work through something similar to this scenario, but actually grabbing the systems from the “CI’s to change” section of a change request. ultimately, pulling the CI information as well as the start and end times to automate the kickoff of a workflow to put the systems into maintenance mode at the appropriate times. Do you have an idea where, in the SCSM db, the CI’s to change information is located?

  6. What if we want to put servers into maintenance mode from a Change Request that’s generated in SCSM? Looks like we’ll need to somehow carry over schedulestartdate, scheduledenddate and config items to change. We’re finding the start/end time info but can’t find a way that it would know which systems to put into MM.

Leave a Reply

Your email address will not be published. Required fields are marked *