Monday, April 2, 2012

Responses that are scheduled by the OpsMgr2007 agent are not run at the specified time

What I've read in the Microsoft Support Site is that in Microsoft System Center Operations Manager 2007, you can configure rules to run a script on a timed basis. The rule can be further authored to synchronize at a specific time each day. However, even when you configure a rule to do this, the script may not run at the exact time that is specified in the dialog box. Instead, there may be a small delay. The delay may be anywhere from several seconds to several minutes, depending on how busy the target Health service is and the interval length between scheduled runs.

I had to create a rule that should raised an event in the application event log once per week at a specific time (the aim was to schedule maintenance mode but that is not important to know right now). When the MP has been tested, I have had a strange behaviour : Write Action was scheduled to run between a range of time and on the server, it has been executed more that 30 minutes after the end of the range time given !!!

Since I couldn't test with the MP first developped to launch maintenance mode by ctaching an event, I've recreated a single MP to reproduice the issue.

Please find my test MY here :


It contains :
- 2 write actions
      - One to create an event 9
      - A second one to create an event 10
- 2 rules based on a System.Scheduler Module to execute the 2 write actions.
To be able to test, the schedule has been configured to run each day (instead of once per week)
     - First rule : create event 9 for critical state of the monitor


     - Second rule : create event 10 for healthy state of the monitor

- 1 monitor based on the 2 events (One for healthy state, one for non healthy state)

Here are the result after on day :
- The monitor went to Critical state (event 9 catch) 4 minutes and 42 seconds after the end date given in the module System Scheduler of the rule

Date and Time:  28/03/2012 03:54:42
Log Name:  Application
Source:  SCOMTest
Event Number:  9
Level:  4
Logging Computer: MyServer
User:  NT AUTHORITY\SYSTEM

- The monitor went to Healthy state (event 10 catch) 4 minutes and 42 seconds after the end date given in the module System Scheduler of the rule

Date and Time:  28/03/2012 04:14:57
Log Name:  Application
Source:  SCOMTest
Event Number:  10
Level:  4
Logging Computer:  MyServer
User:  NT AUTHORITY\SYSTEM

Both schedule have been missed for nearly 5 minutes !! Microsoft explains this is the expected behavior because the scheduler module was designed to minimize the resource effect on the agent and was not intended for real-time accuracy. Even if the Health service agent is heavily taxed, any delays in running the response should be no more than one percent of the time since the last scheduled run.

That means that a delay of more that 14 minutes can be seen while scheduling a daily scripts or write action, 1 hour and 40 minutes if the same script or write action is scheduled once a week !

If you want to run an agent response with more accuracy, here is the workarround given by Microsoft :
  • If the response is a script, the Windows Task Scheduler service can be used to run the script at an exact time. Task Scheduler is a service that uses a completely different timing mechanism.
  • If the response is not a script, or the script cannot be run under Task Scheduler, a rule can be authored to run the response when a custom event is observed on the agent. The Windows Task Scheduler can be used to programmatically create an event in the agent’s local event log on a scheduled basis. The Operations Manager 2007 agent would run the response every time that the Task Scheduler adds this custom event to the event log.
So the only way to have more occuracy is to not use SCOM System Scheduler Module ! What a pitty, it was a good way to be able to execute a script at local time on the different servers ...

Have to find an other way...

This posting is provided "AS IS" with no warranties.

No comments:

Post a Comment