Page 1 of 1
Windows Scheduled task monitoring
Posted: Thu Sep 03, 2020 5:19 am
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
Re: Windows Scheduled task monitoring
Posted: Thu Sep 03, 2020 1:02 pm
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.
Re: Windows Scheduled task monitoring
Posted: Fri Oct 09, 2020 4:41 am
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
Re: Windows Scheduled task monitoring
Posted: Fri Oct 09, 2020 2:54 pm
by WillemDH
You could also try
https://github.com/OutsideIT/check_ms_win_tasks
It might produce better results (with the right parameters)
Re: Windows Scheduled task monitoring
Posted: Fri Oct 09, 2020 3:26 pm
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.
Re: Windows Scheduled task monitoring
Posted: Fri Oct 09, 2020 3:40 pm
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}'
Re: Windows Scheduled task monitoring
Posted: Mon Oct 12, 2020 1:58 am
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
Re: Windows Scheduled task monitoring
Posted: Mon Oct 12, 2020 7:20 am
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