I am looking for a way to get alerted if any of the scheduled tasks on a group of Windows 2003 servers fail (exit with a status code that is not 0). Scripts, commercial applications, and plug-ins to monitoring tools (like Nagios) are all open for consideration.
ActiveXperts Network Monitor comes up in most search results, but the scheduled task monitoring feature is a small part of a large commercial network monitoring package.
Below is a batch file script that will dump out the scheduled task results to a csv file that can be imported into SQL Server using SSIS.
rem MC: dump the scheduled task results into the specified outfile
@echo off
set outfile=c:\temp\scheduled_tasks.csv
rem MC: the for loop skips over the first blank that schtasks adds to the output
for /f "TOKENS=*" %%A in ('schtasks /query /fo csv /v') do ( echo %%A >> %outfile% )
The downside of this approach is that importing the csv file into a database table, running a query looking for status codes that are not 0, and sending out E-mails with alerts if anything was found seems like a cumbersome setup. I would rather use an existing solution than create a complex custom system from scratch.