scheduled-tasksnrpeicinga

Icinga2: How to monitor scheduled tasks via check_tasksched and ignore currently running tasks?


Tried several ways, using default check_tasksched works and checks only enabled ones by default (filter).

Now my problem: running tasks will be notified with "warning" while they're running.


Solution

  • Now after several tries... found a solution:

    Using the filter:

    because 267009 seems to be the code for "running".

    Here's the command-template:

    object CheckCommand "check_tasksched" {
      import "plugin-check-command"
      command = [
        PluginDir + "/check_nrpe",
        "-H", "$address$",
        "-c", "check_tasksched",
        "-a", "filter=$filter$"
      ]
      vars = {
        "filter" = "enabled eq 1 AND not exit_code eq 267009"
        }
    }
    

    Don't forget to set CheckTaskSched = 1 in nsclient.ini.

    Further infos for that command: http://docs.nsclient.org/reference/windows/CheckTaskSched/#check_tasksched_filter_keys