Windows Scheduled task monitoring

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
deek
Posts: 194
Joined: Fri Apr 26, 2019 2:01 am

Windows Scheduled task monitoring

Post by deek »

Hi ,
I have configured to monitor Scheduled task for a windows server , but the output expected is not proper .
I have followed this link ( https://support.nagios.com/kb/article/s ... s-788.html ) to set up the monitoring .
Im getting the same output even when the task is completed . Ill share the screenshot of the output im getting .
Capture scheduled.PNG
Command View :
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$

$ARG1$ : check_tasksched
$ARG2$ : -a "filter=title eq 'PDI - Weekly Nexpose Metrics'" 'critical=most_recent_run_time < -30m' empty-state=critical 'empty-syntax=CRITICAL: PDI - Weekly Nexpose Metrics NOT found' 'detail-syntax=${title} is stale more than -30m'
Capture pdi.PNG

Please let me know if there is any other filter that needs to be added in the command line .
Im also attaching nsclient file .
nsclient_Scheduled.txt
You do not have the required permissions to view the files attached to this post.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Windows Scheduled task monitoring

Post by cdienger »

Are you sure the job is running? The screenshot from the Windows system shows the last run time was 8/10 which is what is returned by the check.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
deek
Posts: 194
Joined: Fri Apr 26, 2019 2:01 am

Re: Windows Scheduled task monitoring

Post by deek »

Hi ,

The task is completed and instead of showing a ok status it is in critical state .
Im attaching the screenshot below .

[nagios@abc ~]$ /usr/local/nagios/libexec/check_nrpe -H 172.**.***.*** -t 30 -c check_tasksched -a "filter=title eq 'PDI - Weekly Nexpose Metrics'" 'critical=most_recent_run_time < -30m' empty-state=critical 'empty-syntax=CRITICAL: PDI - Weekly Nexpose Metrics NOT found' 'detail-syntax=${title} is stale more than -30m'
CRITICAL: PDI - Weekly Nexpose Metrics is stale more than -30m|'PDI - Weekly Nexpose Metrics_exit_code'=1;0;0 'PDI - Weekly Nexpose Metrics_most_recent_run_time'=1601991437;0;1602234619
Capture scheduled job.PNG
You do not have the required permissions to view the files attached to this post.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Windows Scheduled task monitoring

Post by WillemDH »

You could also try https://github.com/OutsideIT/check_ms_win_tasks

It might produce better results (with the right parameters)
Nagios XI 5.8.1
https://outsideit.net
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Windows Scheduled task monitoring

Post by cdienger »

What time was the check done at? The -30 would check to see if the job was run withing the last 30 minutes. Try increasing it. For example, -1440m to see if it was run within the last day.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Windows Scheduled task monitoring

Post by ssax »

Thanks for the alternative @WillemDH!

Your command is checking if it hasn't been run in the last 30 minutes, it hasn't so the output is valid.

You would need to change it to something like this:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H **.***.*** -t 30 -c check_tasksched -a "filter=title eq 'PDI - Weekly Nexpose Metrics'" 'critical=exit_code != 0' empty-state=critical 'empty-syntax=CRITICAL: PDI - Weekly Nexpose Metrics NOT found' 'detail-syntax=${title}: exit code: ${exit_code}'
deek
Posts: 194
Joined: Fri Apr 26, 2019 2:01 am

Re: Windows Scheduled task monitoring

Post by deek »

Hi ,

Thanks to both of you for the information . Both the methods are amazing . I was able to get the output :)
Capture pdi.PNG
You do not have the required permissions to view the files attached to this post.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Windows Scheduled task monitoring

Post by scottwilkerson »

deek wrote:Hi ,

Thanks to both of you for the information . Both the methods are amazing . I was able to get the output :)
Capture pdi.PNG
Great!

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked