From 765e91dcaf2b9a996e05c4147d797136c9918a0c Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Mon, 21 Sep 2015 10:30:45 +0200 Subject: [PATCH] ITL: Add more parameters for nscp-local check commands nscp-local-cpu, -memory, -disk, -service and -counter fixes #9264 Signed-off-by: Michael Friedrich --- doc/7-icinga-template-library.md | 49 +++++++++++++-- itl/command-nscp-local.conf | 103 +++++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+), 5 deletions(-) diff --git a/doc/7-icinga-template-library.md b/doc/7-icinga-template-library.md index 46ff2773a..dbb35b94c 100644 --- a/doc/7-icinga-template-library.md +++ b/doc/7-icinga-template-library.md @@ -1391,18 +1391,33 @@ nscp_load_all | **Optional.** Whether to load all modules. Defaults to true. nscp_boot | **Optional.** Whether to use the --boot option. Defaults to true. nscp_query | **Required.** The NSClient++ query. Try `nscp client -q x` for a list. nscp_arguments | **Optional.** An array of query arguments. +nscp_showall | **Optional.** Shows more details in plugin output, default to false. ### nscp-local-cpu Check command object for the `check_cpu` NSClient++ plugin. -This command has the same custom attributes like the `nscp-local` check command. +Name | Description +--------------------|------------------ +nscp_cpu_time | **Optional.** Calculate avarage usage for the given time intervals. Value has to be an array, default to [ "1m", "5m", "15m" ]. +nscp_cpu_warning | **Optional.** Threshold for WARNING state in percent, default to 80. +nscp_cpu_critical | **Optional.** Threshold for CRITICAL state in percent, default to 90. +nscp_cpu_arguments | **Optional.** Additional arguments. +nscp_cpu_showall | **Optional.** Shows more details in plugin output, default to false. ### nscp-local-memory Check command object for the `check_memory` NSClient++ plugin. -This command has the same custom attributes like the `nscp-local` check command. +Name | Description +----------------------|------------------ +nscp_memory_committed | **Optional.** Check for committed memory, default to false. +nscp_memory_physical | **Optional.** Check for physical memory, default to true. +nscp_memory_free | **Optional.** Switch between checking free (true) or used memory (false), default to false. +nscp_memory_warning | **Optional.** Threshold for WARNING state in percent or absolut (use MB, GB, ...), default to 80 (free=false) or 20 (free=true). +nscp_memory_critical | **Optional.** Threshold for CRITICAL state in percent or absolut (use MB, GB, ...), default to 90 (free=false) or 10 (free=true). +nscp_memory_arguments | **Optional.** Additional arguments. +nscp_memory_showall | **Optional.** Shows more details in plugin output, default to false. ### nscp-local-os-version @@ -1426,7 +1441,18 @@ This command has the same custom attributes like the `nscp-local` check command. Check command object for the `check_service` NSClient++ plugin. -This command has the same custom attributes like the `nscp-local` check command. +Name | Description +-----------------------|------------------ +nscp_service_name | **Required.** Name of service to check. +nscp_service_type | **Optional.** Type to check, default to state. +nscp_service_ok | **Optional.** State for return an OK, i.e. for type=state running, stopped, ... +nscp_service_otype | **Optional.** Dedicate type for nscp_service_ok, default to nscp_service_state. +nscp_service_warning | **Optional.** State for return an WARNING. +nscp_service_wtype | **Optional.** Dedicate type for nscp_service_warning, default to nscp_service_state. +nscp_service_critical | **Optional.** State for return an CRITICAL. +nscp_service_ctype | **Optional.** Dedicate type for nscp_service_critical, default to nscp_service_state. +nscp_service_arguments | **Optional.** Additional arguments. +nscp_service_showall | **Optional.** Shows more details in plugin output, default to true. ### nscp-local-uptime @@ -1444,13 +1470,26 @@ This command has the same custom attributes like the `nscp-local` check command. Check command object for the `check_drivesize` NSClient++ plugin. -This command has the same custom attributes like the `nscp-local` check command. +Name | Description +-----------------------|------------------ +nscp_disk_drive | **Optional.** Drive character, default to all drives. +nscp_disk_free | **Optional.** Switch between checking free space (free=true) or used space (free=false), default to false. +nscp_disk_warning | **Optional.** Threshold for WARNING in percent or absolut (use MB, GB, ...), default to 80 (used) or 20 percent (free). +nscp_disk_critical | **Optional.** Threshold for CRITICAL in percent or absolut (use MB, GB, ...), default to 90 (used) or 10 percent (free). +nscp_disk_arguments | **Optional.** Additional arguments. +nscp_disk_showall | **Optional.** Shows more details in plugin output, default to true. ### nscp-local-counter Check command object for the `check_pdh` NSClient++ plugin. -This command has the same custom attributes like the `nscp-local` check command. +Name | Description +-----------------------|------------------ +nscp_counter_name | **Required.** Performance counter name. +nscp_counter_warning | **Optional.** WARNING Threshold. +nscp_counter_critical | **Optional.** CRITICAL Threshold. +nscp_counter_arguments | **Optional.** Additional arguments. +nscp_counter_showall | **Optional.** Shows more details in plugin output, default to false. diff --git a/itl/command-nscp-local.conf b/itl/command-nscp-local.conf index f3c474955..f38e3eb1a 100644 --- a/itl/command-nscp-local.conf +++ b/itl/command-nscp-local.conf @@ -21,6 +21,7 @@ if (!globals.contains("NscpPath")) { NscpPath = dirname(msi_get_component_path("{5C45463A-4AE9-4325-96DB-6E239C034F93}")) } + object CheckCommand "nscp-local" { import "plugin-check-command" @@ -40,23 +41,98 @@ object CheckCommand "nscp-local" { value = "$nscp_arguments$" skip_key = true } + "--show-all" = { + set_if = "$nscp_showall$" + } + } vars.nscp_log_level = "critical" vars.nscp_load_all = true vars.nscp_boot = true + vars.nscp_showall = false } object CheckCommand "nscp-local-cpu" { import "nscp-local" + arguments += { + "--time" = { + value = "$nscp_cpu_time$" + repeat_key = true + } + "--warning" = { + value = "load>$nscp_cpu_warning$" + } + "--critical" = { + value = "load>$nscp_cpu_critical$" + } + "-a" = { + value = "$nscp_cpu_arguments$" + skip_key = true + } + } + vars.nscp_query = "check_cpu" + vars.nscp_showall = "$nscp_cpu_showall$" + + vars.nscp_cpu_time = [ "1m", "5m", "15m" ] + vars.nscp_cpu_showall = true + vars.nscp_cpu_warning = 80 + vars.nscp_cpu_critical = 90 } object CheckCommand "nscp-local-memory" { import "nscp-local" + arguments += { + "--type=committed" = { + set_if = "$nscp_memory_committed$" + } + "--type=physical" = { + set_if = "$nscp_memory_physical$" + } + "--warning" = { + value = "$nscp_memory_op$ $nscp_memory_warning$" + } + "--critical" = { + value = "$nscp_memory_op$ $nscp_memory_critical$" + } + "-a" = { + value = "$nscp_memory_arguments$" + skip_key = true + } + } + vars.nscp_query = "check_memory" + vars.nscp_showall = "$nscp_memory_showall$" + + vars.nscp_memory_op = {{ + if (!macro("$nscp_memory_free$")) { + return "used >" + } else { + return "free <" + } + }} + + vars.nscp_memory_commited = false + vars.nscp_memory_physical = true + vars.nscp_memory_free = true + vars.nscp_memory_warning = {{ + if (!macro("$nscp_memory_free$")) { + return 80 + } else { + return 20 + } + }} + vars.nscp_memory_critical = {{ + if (!macro("$nscp_memory_free$")) { + return 90 + } else { + return 10 + } + }} + vars.nscp_memory_showall = false } object CheckCommand "nscp-local-os-version" { @@ -80,7 +156,34 @@ object CheckCommand "nscp-local-process" { object CheckCommand "nscp-local-service" { import "nscp-local" + arguments += { + "--service" = { + value = "$nscp_service_name$" + repeat_key = true + } + "--ok" = { + value = "$nscp_service_otype$='$nscp_service_ok$'" + } + "--warning" = { + value = "$nscp_service_wtype$='$nscp_service_warning$'" + } + "--critical" = { + value = "$nscp_service_ctype$='$nscp_service_critical$'" + } + "-a" = { + value = "$nscp_service_arguments$" + skip_key = true + } + } + vars.nscp_query = "check_service" + vars.nscp_showall = "$nscp_service_showall$" + + vars.nscp_service_showall = true + vars.nscp_service_type = "state" + vars.nscp_service_otype = vars.nscp_service_type + vars.nscp_service_wtype = vars.nscp_service_type + vars.nscp_service_ctype = vars.nscp_service_type } object CheckCommand "nscp-local-uptime" {