Go to All Forums

Monitor Windows Scheduled Tasks

It would be extremely helpful in a server monitor to be able to monitor scheduled tasks.

 

Useful thresholds on scheduled tasks that I can think of would be

Running Status => x minutes/hours/days

Disabled Status => x minutes/hours/days

Last run time => x minutes/hours/days ago

Error code returned on last run - yes/no

Error code returned on last run => x runs

 

 

Replies (5)

Re: Monitor Windows Scheduled Tasks

You can use custom plugin to monitor the scheduled tasks.

Please find attached ScheduledTask.zip. Please unzip this file and mention the name of the scheduled task to be monitored in the file "ScheduledTask.ps1" and copy paste the ScheduledTask folder into the plugins folder.
Eg: C:\Program Files (x86)\Site24x7\WinAgent\monitoring\Plugins

The scheduled task plugin contains the following metrics :

  • state_value: Current state of the task
  • numberOfMissedRuns : Number of task schedules that were missed from running
  • lastRunBefore : Time of previous schedule tasks performed
  • author : Task's owner
  • state : Description of the task state
  • lastRunTime : Previous date and time of the task scheduled
  • createdon : Task created time
  • errorCode : Error code of previous scheduled tasks

 

Attachments
ScheduledTask.zip
Size: 1.88 KB
Reply 1

Re: Re: Monitor Windows Scheduled Tasks

Thank you.  If we want to monitor a bunch of scheduled tasks on a particular server would we setup an additional PS job for each or is there a way to create a list of tasks in one plugin?

Reply 0

Re: Re: Re: Monitor Windows Scheduled Tasks

Hi,

For each server added, you will be able to monitor one plugin and each plugin can have up to 25 attributes. And, the Scheduled Task plugin that we have provided has around eight attributes. So if you would want to add and monitor multiple job tasks with the same metrics as given in the Scheduled Task plugin, it would exceed the default attribute limit. 

However, if you wish to know and monitor only the name and status of a scheduled task, it is possible to add them as a single plugin monitor.

Please let us know if this helps.

Thanks!

Reply 1

Re: Re: Re: Re: Monitor Windows Scheduled Tasks

Thanks.  It appears that the powershell script uses the command Get-ScheduledTask which doesn't work in windows 2008 R2, which is most of our environment. Do you perhaps have an example that works in a batch file and uses schtasks which does work in windows 2008 R2.

Reply 0

Re: Re: Re: Re: Re: Monitor Windows Scheduled Tasks

You can write a custom plugin to monitor the scheduled tasks. Please find attached ScheduledTask.zip. We have used schtasks command to get data. it will remove the Get-ScheduledTask dependency. So this plugin will work fine in Windows 2008 R2.

  1. Unzip this file
  2. Mention the name of the scheduled task to be monitored in "ScheduledTask.ps1".
  3. Now, copy paste the ScheduledTask folder into the plugins folder.
    Eg: C:\Program Files (x86)\Site24x7\WinAgent\monitoring\Plugins

Performance Metrics:

This plugin contains the following metrics:

  • lastRunBefore : Time of the previous schedule task that was performed
  • author : Task's owner
  • Status : Current state of the task
  • lastRunTime : Date and time of the previous scheduled task
  • Start_Date : The time when the task was initiated
  • errorCode : Error code of the previous scheduled task

Hope this helps. Let us know for further queries.

Thanks!

Attachments
ScheduledTask.zip
Size: 2.08 KB
Reply 0