]> granicus.if.org Git - icinga2/blobdiff - itl/command-nscp-local.conf
Merge pull request #6058 from gunnarbeutner/feature/clean-up-plugins
[icinga2] / itl / command-nscp-local.conf
index f38e3eb1a3459b753974643a6b26d68d5b530c14..33677fccd104e7ae1237eb05700bd4010c170f77 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * Icinga 2                                                                   *
- * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/)  *
+ * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/)  *
  *                                                                            *
  * This program is free software; you can redistribute it and/or              *
  * modify it under the terms of the GNU General Public License                *
@@ -21,36 +21,48 @@ if (!globals.contains("NscpPath")) {
        NscpPath = dirname(msi_get_component_path("{5C45463A-4AE9-4325-96DB-6E239C034F93}"))
 }
 
-
 object CheckCommand "nscp-local" {
-       import  "plugin-check-command"
-
        command = [ NscpPath + "\\nscp.exe", "client" ]
 
        arguments = {
-               "--log" = "$nscp_log_level$"
-               "--load-all" = { set_if ="$nscp_load_all$" }
+               "--log" = {
+                       value = "$nscp_log_level$"
+                       description = "The log level to use"
+               }
+               "--load-all" = {
+                       set_if ="$nscp_load_all$"
+                       description = "Load all plugins (currently only used with generate)"
+               }
+               "--module" = {
+                       value = "$nscp_modules$"
+                       description = "Specify which NSClient++ modules are required. 'nscp client' just needs 'CheckSystem' by default."
+                       repeat_key = true
+               }
                "-q" = {
                        value = "$nscp_query$"
+                       description = "Run a query with a given name"
                        required = true
                }
                "-b" = {
                        set_if = "$nscp_boot$"
+                       description = "Boot the client before executing command (similar as running the command from test mode)"
                }
                "-a" = {
                        value = "$nscp_arguments$"
-                       skip_key = true
+                       repeat_key = true
+                       description = "List of arguments (arguments gets -- prefixed automatically (--argument foo=bar is the same as setting '--foo bar')"
                }
                "--show-all" = {
                        set_if = "$nscp_showall$"
+                       description = ""
                }
-
        }
 
        vars.nscp_log_level = "critical"
-       vars.nscp_load_all = true
+       vars.nscp_load_all = false
        vars.nscp_boot = true
        vars.nscp_showall = false
+       vars.nscp_modules = [ "CheckSystem" ]
 }
 
 object CheckCommand "nscp-local-cpu" {
@@ -60,6 +72,7 @@ object CheckCommand "nscp-local-cpu" {
                "--time" = {
                        value = "$nscp_cpu_time$"
                        repeat_key = true
+                       description = "The time to check"
                }
                "--warning" = {
                        value = "load>$nscp_cpu_warning$"
@@ -69,7 +82,7 @@ object CheckCommand "nscp-local-cpu" {
                }
                "-a" = {
                        value = "$nscp_cpu_arguments$"
-                       skip_key = true
+                       repeat_key = true
                }
        }
 
@@ -88,9 +101,11 @@ object CheckCommand "nscp-local-memory" {
        arguments += {
                "--type=committed" = {
                        set_if = "$nscp_memory_committed$"
+                       description = "Total memory (RAM+PAGE)"
                }
                "--type=physical" = {
                        set_if = "$nscp_memory_physical$"
+                       description = "Physical memory (RAM)"
                }
                "--warning" = {
                        value = "$nscp_memory_op$ $nscp_memory_warning$"
@@ -100,7 +115,7 @@ object CheckCommand "nscp-local-memory" {
                }
                "-a" = {
                        value = "$nscp_memory_arguments$"
-                       skip_key = true
+                       repeat_key = true
                }
        }
 
@@ -115,7 +130,7 @@ object CheckCommand "nscp-local-memory" {
                }
        }}
 
-       vars.nscp_memory_commited = false
+       vars.nscp_memory_committed = false
        vars.nscp_memory_physical = true
        vars.nscp_memory_free = true
        vars.nscp_memory_warning = {{
@@ -172,7 +187,7 @@ object CheckCommand "nscp-local-service" {
                }
                "-a" = {
                        value = "$nscp_service_arguments$"
-                       skip_key = true
+                       repeat_key = true
                }
        }
 
@@ -196,16 +211,85 @@ object CheckCommand "nscp-local-version" {
        import  "nscp-local"
 
        vars.nscp_query = "check_version"
+       vars.nscp_modules = [ "CheckHelpers" ]
 }
 
 object CheckCommand "nscp-local-disk" {
        import "nscp-local"
 
+       arguments += {
+               "--drive" = {
+                       value = "$nscp_disk_drive$"
+                       repeat_key = true
+               }
+               "--warning" = {
+                       value = "$nscp_disk_op$ $nscp_disk_warning$"
+               }
+               "--critical" = {
+                       value = "$nscp_disk_op$ $nscp_disk_critical$"
+               }
+               "-a" = {
+                       value = "$nscp_disk_arguments$"
+                       repeat_key = true
+               }
+       }
+
        vars.nscp_query = "check_drivesize"
+       vars.nscp_showall = "$nscp_disk_showall$"
+
+       vars.nscp_disk_op = {{
+               if (!macro("$nscp_disk_free$")) {
+                       return "used >"
+               } else {
+                       return "free <"
+               }
+       }}
+
+       vars.nscp_disk_showall = true
+       vars.nscp_disk_free = false
+       vars.nscp_disk_warning = {{
+               if (!macro("$nscp_disk_free$")) { return 80 } else { return 20 }
+       }}
+       vars.nscp_disk_critical = {{
+               if (!macro("$nscp_disk_free$")) { return 90 } else { return 10 }
+       }}
+
+       vars.nscp_modules = [ "CheckDisk" ]
 }
 
 object CheckCommand "nscp-local-counter" {
        import "nscp-local"
 
+       arguments += {
+               "--counter" = {
+                       value = "$nscp_counter_name$"
+                       repeat_key = true
+               }
+               "--warning" = {
+                       value = "value $nscp_counter_op$ $nscp_counter_warning$"
+               }
+               "--critical" = {
+                       value = "value $nscp_counter_op$ $nscp_counter_critical$"
+               }
+               "--perf-syntax" = {
+                       value = "$nscp_counter_perfsyntax$"
+               }
+               "-a" = {
+                       value = "$nscp_counter_arguments$"
+                       repeat_key = true
+               }
+       }
+
+       vars.nscp_counter_op = {{
+               if (!macro("$nscp_counter_less$")) {
+                       return ">"
+               } else {
+                       return "<"
+               }
+       }}
+
        vars.nscp_query = "check_pdh"
+       vars.nscp_showall = "$nscp_counter_showall$"
+       vars.nscp_counter_less = false
+       vars.nscp_counter_perfsyntax = "$nscp_counter_name$"
 }