Page 1 of 1

Windows Scheduled Task

Posted: Fri Dec 27, 2019 1:13 pm
by metsfan2152
Hello I am relatively new to nagios so please bare with me.
I are currently using a ubuntu server as the host. I already have multiple clients machines connected, both linux and windows.
I am currently using just the basic commands that were set up for monitoring such as checking disk space and ping tests.

I am working on trying to monitor to see if a windows scheduled task has failed. Is this possible?
I have followed this article https://support.nagios.com/kb/article.php?id=788 and added those settings on the windows client.

The above command that shows in that post would need to be ran on my Linux host machine to check. Is that correct?

./check_nrpe -H 10.25.14.2 -c check_tasksched -a "filter=title eq 'Test_Task'" 'critical=most_recent_run_time < -5m' empty-state=critical 'empty-syntax=${status}: Test_Task NOT found' 'detail-syntax=${title} is stale more than -5m'

I am just looking for some guidance on where to go as I am very new to this.
Thank you for your help

Re: Windows Scheduled Task

Posted: Fri Dec 27, 2019 1:51 pm
by mbellerue
Hi! Welcome to the forums, and Nagios as a whole!

Yes, the check_nrpe plugin is run on the Nagios server, but NRPE is an agent that is expected to be installed on the client machine. NRPE was also originally developed as a Linux agent. You can use a 3rd party agent like NSClient++ to provide a Windows NRPE agent. There is also NCPA, which is a newer agent that is also cross platform. Since you are using a mix of Linux and Windows systems, I would highly recommend looking into NCPA. However, there is the benefit that NRPE already has a plugin to check Windows scheduled tasks. But both solutions will require some learning and configuration, so make sure to read the docs.
https://www.nagios.org/ncpa/
https://www.nsclient.org/

I would say check out NCPA vs NRPE, and let us know which path you'd like to go down. From there we will definitely be able to get you to where you need to be.

Re: Windows Scheduled Task

Posted: Fri Dec 27, 2019 2:39 pm
by metsfan2152
I am currently using NSClient++ on all of our windows machines.
I have also ran this command "nscp settings --activate-module CheckTaskSched" to add the checktaskschduler to the ini file.
I guess my next question is how to do check like the commands.
Like how can I run something like this ./check_nrpe -H 10.25.14.2 -c check_tasksched -a "filter=title eq 'Test_Task'"
on the linux server to see if the command works?

Can this be done?

Re: Windows Scheduled Task

Posted: Fri Dec 27, 2019 4:02 pm
by mbellerue
Yes, that is exactly how you test the commands. Once you have a good handle on the command that you want to run, you separate the command from the arguments, and create a new command in commands.cfg.