Hello,
I've had a really hard time today trying to monitor WIndows 2008 scheduled tasks. Is there anyone here who got some experience with this?
I've been looking on http://www.nsclient.org/nscp/wiki/Check ... _tasksched for more information, but it seems like there is some infor missing.
nsclient.ini:
[/modules]
CheckTaskSched1 = 1
CheckTaskSched2 = 1
[root@srvnagios01 ~]# /usr/local/nagios/libexec/check_nrpe -H testserver -t 30 -c CheckTaskSched -p 5666 -a "filter=exit_code ne 0" "syntax=%title%: %exit_code%" warn=\>0
OK: All scheduled tasks are good.|'eventlog'=0;0;0
While there is at least one scheduled task that hasn't got a status code of 0.
i thought the problem could be that I use the checktasksched1 or so, but
/usr/local/nagios/libexec/check_nrpe -H testserver -t 30 -c CheckTaskSched2 -p 5666 -a "filter=exit_code ne 0" "syntax=%title%: %exit_code%" warn=\>0
No handler for command: checktasksched2
So he doesn't seem to know checktasksched2..
Any help is welcome..
Monitoring Windows 2008 Scheduled Tasks
Monitoring Windows 2008 Scheduled Tasks
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Monitoring Windows 2008 Scheduled Tasks
Can you post the whole "nsclient.ini" file (hide the sensitive info)?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Monitoring Windows 2008 Scheduled Tasks
Hello,
We solved this problem bij creating a powershell script that outputs it's result to Nagios. Works much better then the checktasksched2 in the nscp software.
For people who are interested, this is the powershell script:
We solved this problem bij creating a powershell script that outputs it's result to Nagios. Works much better then the checktasksched2 in the nscp software.
For people who are interested, this is the powershell script:
Code: Select all
#Scheduled Task Result powershell script
$status = 0;
#First, the script will pull a list of all the scheduled tasks on your computer and push it into a CSV file.
schtasks /query /fo csv -v | ConvertFrom-Csv | ? {$_.HostName -match "^$($Env:Computername)$" -and $_.'Scheduled Task State' -eq "Enabled" -and $_.TaskName -notlike '\Microsoft*' } | % {
if ($_."Last Result" -ne "0") {
echo "Scheduled task $($_.TaskName) exited with result $($_.'Last Result')"
$status = 2
}
}
if ($status -eq 0) {
echo "All OK"
}
exit $status
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Monitoring Windows 2008 Scheduled Tasks
WilliemDH,
Thanks for posting your Powershell script.
It would be a useful addition to exchange.nagios.org if you have a chance to post it there.
Thanks,
-Yancy
Thanks for posting your Powershell script.
It would be a useful addition to exchange.nagios.org if you have a chance to post it there.
Thanks,
-Yancy
Re: Monitoring Windows 2008 Scheduled Tasks
Posted on Exchange. Waiting for approval.
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact: