Giter VIP home page Giter VIP logo

check_ms_win_tasks's Introduction

Nagios plugin to check Microsoft Windows 2008 or higher scheduled tasks

Idea

Checks Microsoft Windows enabled scheduled tasks excluding defined folders and task patterns, returning state of tasks
with name, author, exit code and performance data to Nagios.

Screenshots

Tasks 01

Tasks 02

Status

Production ready.

How To

Please check https://outsideit.net/check-ms-win-tasks for more information on how to use this plugin.

Help

In case you find a bug or have a feature request, please make an issue on GitHub.

On Nagios Exchange

https://exchange.nagios.org/directory/Plugins/Operating-Systems/Windows/NRPE/Check-Microsoft-Windows-Scheduled-Tasks/details

Copyright

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details at http://www.gnu.org/licenses/.

check_ms_win_tasks's People

Contributors

aarongorka avatar hipska avatar willemdh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

check_ms_win_tasks's Issues

LastExec (-LE)

--LastExec
What parameters should be used there after -LE?

Name of ok task

Hi how can I can get the name of the ok Tasks like the $RunningTask.Name.
Thanks

Notification for tasks running for long time in Task Scheduler

We have configured the script 'check_ms_win_tasks' to monitor tasks scheduled in the Task Scheduler of our Server. The output of the Script is as expected. It shows Total tasks, OK tasks, Failed tasks, Running tasks correctly. But it is not giving 'Critical Alerts' for the tasks which are running for long time or that are running indefinitely. We want to know how to set 'Critical Alerts' for tasks that are running for long time (more than 5 mins).

Problem with Exitcode:1

Thanks you very much for this, it’s really usefull for me and it’s helping me a lot.

In the other hand, I have a question, I’m having some false positives in tasks that never has started, showing that info, for example:

” {Taskname: “Copia Abril” (Author: DOMAIN\USER)(Exitcode: 1)(Last runtime: 12/30/1899 00:00:00)} {Taskname: “Copia Agost 17″ (Author: DOMAIN\USER)(Exitcode: 1)(Last runtime: 12/30/1899 00:00:00)}” ”

There are some option for ignore scheduled tasks that has never started? there are some tasks, that are started and ended correctly but it returns "Exitcode: 1", so, Nagios show me a fail:

"1 / 2 tasks failed! {Taskname: "Copia Biostar" (Author: DOMAIN\USER)(Exitcode: 1)(Last runtime: 10/13/2016 07:00:00)}"

so, it's possible to admit the exit code: 1 in ok tasks?

Include Folder for whole Path?

Hi,

Thanks for your script! I'm using it to monitor 2 machines and the script works great. However I would like to monitor a third machine - but only the tasks in a special folder (right below the \ root). However it seems that -IF works as a wildcard and I cant get it to JUST report the specific folder. Stepts to reproduce (on Server 2016, I think other OS should have the same default foders under the Microsoft tree):

  • Create a folder named App right below the root
  • Place just 1 Task there and run it one time
  • us -IF "APP"

I get 10 Tasks geported - because there are 9 Tasks under Microsoft\Windows\AppID and other folders that match App. Trying with \APP and so on didn't get the 1 task to display. Maybe I don't see the right way to do this?

Critical state exit code -2147020576

Sometimes this plugin goes to critical state because the exit code of the task is -2147020576. I think this happens when the task is running as it last only a few minutes.

This is the output:

1 / 1 tasks failed! {Taskname: "TASK" (Author: DOMAIN\User)(Exitcode: -2147020576)(Last runtime: 2/12/2018 10:05:01 PM)}

Alert wrong when instance is already running: 0x8004131F

The error: 0x8004131F is alerting all the time however it means that: "Launch request ignored, instance already running", the script entry below will fix this for that specific result:

<                 If ( $ObjTask.LastTaskResult -eq '0'-or $ObjTask.LastTaskResult -eq '0x00041325' -and $ObjTask.Enabled ) {

>                 If ( $ObjTask.LastTaskResult -eq '0x8004131F'-or $ObjTask.LastTaskResult -eq '0'-or $ObjTask.LastTaskResult -eq '0x00041325' -and $ObjTask.Enabled ) {

Assume 'success' for tasks that never ran (yet)

When a task was just created and was still never run, its 'LastRunTime' is set to a date far away in 1989 which means "never". Such task should be assumed "OK" ; its 'LastTaskResult' remains undefined I think.
Line 447, I would add :
-or $ObjTask.LastRunTime -lt (get-date 2000-01-01)
NB: I have not found any "clean" way to get the value of this '1989' date, so I use 2000 which seems reasonable but somewhat 'dirty'.
Thanks for your script
Nicolas

tasks by another users are not visible

There is an issue with the script.
Tasks that run under another user are not included in the checking process, they simply are invisible to the script.

how can one fix this?

Failed to execute check_ms_win_tasks: 87: Incorrect Parameter

Hello,

When I try to execute this command
check_nrpe -H 192.168.0.30 -p 5666 -c check_ms_win_tasks -a '-H 127.0.0.1 -ET Microsoft'

I get : Failed to execute check_ms_win_tasks: 87: Incorrect Parameter

If I add -n:
check_nrpe -H 192.168.0.30 -n -p 5666 -c check_ms_win_tasks -a '-H 127.0.0.1 -ET Microsoft'

I get:
CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected).

What I've done:

Add into NSClient.ini:

[/settings/external scripts/scripts]
check_ms_win_tasks=cmd /c echo scripts/powershell/check_ms_win_tasks.ps1 $ARG1$; exit $LastExitCode | powershell.exe /noprofile -command -

Created a new command in the CCM named "check_ms_win_tasks" with this command "$USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 60 -c check_ms_win_tasks $ARG1$"

Disable UAC and DEP on the Windows Server, allow execution of script with: set-executionpolicy remotesigned.
When I execute the script in local, it works.

Can you help me ?

Thank you !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.