Article: Tips for Monitoring Tasks That Run for a Long Time

Summary

This article offers tips and techniques for use when you have monitoring tasks or scripts that you want to integrate with FrameFlow but they take a long time to complete.

Monitoring Tasks

Most monitoring tasks are quick checks for CPU usage, ping response times or other similar things. But occasionally you may have tasks that take a very long time to complete. For example you may have a script that checks multiple items or scans large sets of data. For tasks like these it is often better to schedule their execution outside of FrameFlow and then use FrameFlow to check the results.

As an example, here at FrameFlow we run a database integrity check on internal systems each night at 2:00am. The checks are run through a master PowerShell script that calls out to other scripts and utilities and they can take up to an hour to complete.

One option would be to run the script directly using FrameFlow’s PowerShell event monitor but since the task takes so long we would need extend the monitoring timeout to allow it to complete. But even doing so means that it will be in the monitoring queue for a long time and could affect the throughput of our other monitoring tasks.

Using Windows Scheduler

Instead we kick off the script at 2:00am using Window Scheduler. When the script completes it writes any errors to a log file. Back in our FrameFlow monitoring configuration we have a File Event Monitor that checks the log file every day at 4:00am. That gives the script enough time to finish and File Event Monitor looks for errors in the log file. So if any inconsistency is detected, we’re aware of it first thing in the morning.

Summary

For long-running tasks, especially scripting tasks, it’s best to run them through Windows Scheduler and then use FrameFlow’s File Event Monitor to check the results and alert you if the script reported errors.