Windows Scheduled Task monitoring is easy with Cronitor. Our web dashboard provides you with better visibility into your tasks, and we'll send instant alerts if any goes wrong, including:
- The task does not start on schedule
- The task fails or crashes unexpectedly
- The task runs longer than expected
How to Create a Windows Scheduled Task Monitor
Determine the schedule that your task is running on. This can be found in the Task Scheduler interface. In this example, the task runs every 2 minutes.
From the Cronitor dashboard, click the button to create a new monitor and select Scheduled Task
Add a Complete endpoint not pinged in 2 minutes rule. Optionally, add a Runs for longer than rule to identify tasks that run longer than expected.
Give the monitor a descriptive name like Offsite Backup and add optional tags or notes and hit "Save".
You're done! Your monitor will be assigned a unique ping url and be placed in a pending state. Monitoring will begin when the first ping is received.
Adding Cronitor to your Scheduled Task
On your server, download the CronitorCLI application. We recommend moving the executable to
%SystemDrive%\Program Files\ for system-wide use. From the Task Scheduler, update the scheduled task action you are monitoring to invoke CronitorCLI:
Right click the desired scheduled task, select Properties, select Actions, select the first action listed, click "Edit".
Turn the command being invoked into an argument to
cronitor exec. In this example you see that the
C:\app\bin\collect-statscommand is now being passed as an argument to CronitorCLI. the first argument after exec,
d3x0c1, is the unique key for this monitor, copied from the Cronitor dashboard.
Program/script Arguments Before
exec d3x0c1 C:\app\bin\collect-stats PRODUCTION
Before you are running
C:\app\bin\collect-statsdirectly: After integration you are using CronitorCLI to run the command:
If your scheduled task has multiple actions listed, repeat this step for each action.
If possible, run your task manually from the Task Scheduler to ensure that it works properly. You should see the details from the run on your Cronitor dashboard within a few seconds.
Tip: Cronitor integration can be accomplished without installing CronitorCLI. To do this, move your current command and arguments to a .bat file, and using
curl or similar to ping to your monitor's unique
/run endpoint before your task runs, and ping
/complete after it exits.