OpsMgr 2007: Scripts may not run when expected

image

We recently saw an issue related to the scheduler function in the Operations Manager 2007 agent.  A customer had written a script to run on the agent that would query a certain LoB application and report state to the Operations Manager database.  Due to certain circumstances, he needed to run the query script within a very short window of time every day.  The UI in the Authoring space of Operations Manager gave the impression that a timed script would run at an exact time every day, but this customer's script was running several minutes late each time.  After discussions with the product team, it was determined that the scheduler module of the Operations Manager agent was never designed to initiate at an exact time and we cannot guarantee the exact time the agent would run the script.  If there is any delay experienced, in most cases it is expected to be less than 1% of the interval between runs.  

Windows Vista and later operating systems have new APIs that can be used by the scheduler to run tasks at an exact time, but there are no plans at this time to change the Operations Manager agent to use two different code paths (one for pre-Vista agents, the other for Vista and later agents).  The design of the scheduler service and choice of Windows APIs currently used was made to improve the overall performance of the agent and lower the memory footprint on the agent.  We have found that most customers do not require exact timing, and that in most cases , running within 1% of the time expected is more than sufficient for the specific task.  If you have a business need to run a response within a very tight window, however, two workarounds have been proposed.

1) The Windows Task Scheduler service can be used to run the script at an exact time.  Task Scheduler uses a completely different timing mechanism.

2) The script can be configured as an agent response to an event, instead of as a timed response.  Windows Task Scheduler can be used to create an event in the agent’s local Event Log on a scheduled basis, and Operations Manager would then be configured to run your script in response to the appearance of this event.

Hope this helps,

Rich Pesenko | Senior Support Escalation Engineer