2

We have SSIS tasks (dtexec) that are executed by Windows Task Manager and monitored by Nagios. Regularly, however, Nagios reports warnings because the exit code is empty (where it should be 0). This appears to happen if the check happens while the task is running (GUI-wise, Task Manager then displays a kind of temporary exit code).

define service{
        use                     generic-service
        host_name               ms.example.com
        service_description     My task name
        retry_interval          10
        check_command           check_schedtask!"TaskName=\\"\\Category\\My task name\\"" "ExitCode=0x0" "Elapsed=1.0:10" "LastEvent"
        contact_groups          
                contacts                Annoyed people
        notification_interval   240
        servicegroups           functional_tasks
}

How can I ignore tasks that are running during the check?

1

You can tell check to return code 3 to nagios when process return NULL()?, which means state is UNKNOWN.

More about codes here: https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/pluginapi.html

2
  • I'm accepting your answer, although a caveat does apply: I'm unable to actually test it myself, because the Nagios configuration in question is outside of my direct control; I've forwarded it to the person/company responsible. – BigSmoke Sep 7 '15 at 7:50
  • I hope this will help, feel free to ask if you have more questions in that case. – Mateusz Pacek Sep 7 '15 at 8:07
1

Or you could use this Powershell script to monitor your scheduled tasks:

http://outsideit.net/check-ms-win-tasks/

The output looks like this:

1 / 11 tasks failed! {Taskname: "check_ms_win_tasks_subfolder_01_task" (Author: F1REBASE\Willem)(Exitcode: -2147023673)(Last runtime: 12/06/2014 11:35:56)} 1 / 11 tasks still running! {Taskname: "SamsungMagician" (Author: SamsungMagician)(Exitcode: 267009)(Last runtime: 06/21/2015 11:37:55)} | 'Total Tasks'=11, 'OK Tasks'=9, 'Failed Tasks'=1, 'Running Tasks'=1

You can monitor all your scheduled tasks on a host with one service and exclude the ones you dont need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.