Home » Opalis » Start Maintenance Mode with Opalis

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 Comments

  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. […] The Stop Maintenance Mode policy is used to stop maintenance mode for machines that was shut down by Opalis earlier. This policy check if the affected machine is in maintenance mode, by checking Windows Computer (1), Health Service (2) and Health Service Watcher (4). We use a SQL query to get the agent watcher ID (3). These are the three objects that Opalis puts into maintenance mode when it shuts down a IIS in this example. Another example of Opalis and maintenance mode here. […]

  3. 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?

  4. 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.

  5. 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?

  6. 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?

  7. 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 comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.