]> granicus.if.org Git - icinga2/commitdiff
Add check commands for NSClient++
authorGunnar Beutner <gunnar@beutner.name>
Fri, 6 Mar 2015 12:08:42 +0000 (13:08 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Fri, 6 Mar 2015 12:08:42 +0000 (13:08 +0100)
fixes #8621

doc/7-icinga-template-library.md
itl/CMakeLists.txt
itl/command-nscp-local.conf [new file with mode: 0644]
itl/nscp [new file with mode: 0644]

index 79f1f8a858e3426810f0a58b77a4a2e7dcb034b1..43cec74129c7a97babb6768e533a7e551b4526b3 100644 (file)
@@ -751,6 +751,85 @@ Name            | Description
 users_wgreater  | **Optional.** The user count warning threshold. Defaults to 20.
 users_cgreater  | **Optional.** The user count critical threshold. Defaults to 50.
 
+# <a id="nscp-plugin-check-commands"></a> NSClient++ Check Commands
+
+Icinga 2 can use the `nscp client` command to run arbitrary NSClient++ checks.
+
+You can enable these check commands by adding the following the include directive in your
+[icinga2.conf](5-configuring-icinga-2.md#icinga2-conf) configuration file:
+
+    include <nscp>
+    
+You can also optionally specify an alternative installation directory for NSClient++ by adding
+the NscpPath constant in your [constants.conf](5-configuring-icinga-2.md#constants-conf) configuration
+file:
+
+    const NscpPath = "C:\\Program Files (x86)\\NSClient++"
+
+By default the check commands assume that NSClient++ is installed in "C:\Program Files\NSClient++".
+
+Note that it is not necessary to run NSClient++ as a Windows service for these commands to work.
+
+## <a id="nscp-check-local"></a> nscp-local
+
+Check command object for NSClient++
+
+Custom Attributes:
+
+Name            | Description
+----------------|--------------
+nscp_path       | **Optional.** Can be used to override the NSClient++ on a per-command basis. Defaults to NscpPath.
+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.
+
+## <a id="nscp-check-local"></a> 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.
+
+## <a id="nscp-check-local-memory"></a> 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.
+
+## <a id="nscp-check-local-os-version"></a> nscp-local-os-version
+
+Check command object for the `check_os_version` NSClient++ plugin.
+
+This command has the same custom attributes like the `nscp-local` check command.
+
+## <a id="nscp-check-local-pagefile"></a> nscp-local-pagefile
+
+Check command object for the `check_pagefile` NSClient++ plugin.
+
+This command has the same custom attributes like the `nscp-local` check command.
+
+## <a id="nscp-check-local-process"></a> nscp-local-process
+
+Check command object for the `check_process` NSClient++ plugin.
+
+This command has the same custom attributes like the `nscp-local` check command.
+
+## <a id="nscp-check-local-service"></a> nscp-local-service
+
+Check command object for the `check_service` NSClient++ plugin.
+
+This command has the same custom attributes like the `nscp-local` check command.
+
+## <a id="nscp-check-local-uptime"></a> nscp-local-uptime
+
+Check command object for the `check_uptime` NSClient++ plugin.
+
+This command has the same custom attributes like the `nscp-local` check command.
+
+## <a id="nscp-check-local-version"></a> nscp-local-version
+
+Check command object for the `check_version` NSClient++ plugin.
+
+This command has the same custom attributes like the `nscp-local` check command.
 
 # <a id="snmp-manubulon-plugin-check-commands"></a> SNMP Manubulon Plugin Check Commands
 
@@ -761,7 +840,7 @@ The SNMP manubulon plugin check commands assume that the global constant named `
 is set to the path where the Manubublon SNMP plugins are installed.
 
 You can enable these plugin check commands by adding the following the include directive in your
-configuration [icinga2.conf](5-configuring-icinga-2.md#icinga2-conf) file:
+[icinga2.conf](5-configuring-icinga-2.md#icinga2-conf) configuration file:
 
     include <manubulon>
 
index ee67e7a2ea6730cf949fc546625731757fbe7e76..d1d1e19277227fa076830ccbce3dfe57327ffe35 100644 (file)
@@ -18,6 +18,6 @@
 add_subdirectory(plugins-contrib.d)
 
 install(
-  FILES itl command.conf command-icinga.conf hangman timeperiod.conf plugins command-plugins.conf manubulon command-plugins-manubulon.conf plugins-contrib
+  FILES itl command.conf command-icinga.conf hangman timeperiod.conf plugins command-plugins.conf manubulon command-plugins-manubulon.conf command-nscp-local.conf nscp plugins-contrib
   DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2/include
 )
diff --git a/itl/command-nscp-local.conf b/itl/command-nscp-local.conf
new file mode 100644 (file)
index 0000000..8547a46
--- /dev/null
@@ -0,0 +1,90 @@
+/******************************************************************************
+ * Icinga 2                                                                   *
+ * Copyright (C) 2012-2015 Icinga Development Team (http://www.icinga.org)    *
+ *                                                                            *
+ * 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 2             *
+ * 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.                               *
+ *                                                                            *
+ * You should have received a copy of the GNU General Public License          *
+ * along with this program; if not, write to the Free Software Foundation     *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
+ ******************************************************************************/
+
+if (!globals.contains("NscpPath")) {
+       NscpPath = "C:\\Program Files\\NSClient++"
+}
+
+object CheckCommand "nscp-local" {
+       import  "plugin-check-command"
+
+       command = [ "$nscp_path$\\nscp.exe", "client" ]
+
+       arguments = {
+               "-q" = {
+                       value = "$nscp_query$"
+                       required = true
+               }
+               "-b" = {
+                       set_if = "$nscp_boot$"
+               }
+               "-a" = "$nscp_arguments$"
+       }
+
+       vars.nscp_path = {{ NscpPath }}
+       vars.nscp_boot = true
+}
+
+object CheckCommand "nscp-local-cpu" {
+       import  "nscp-local"
+
+       vars.nscp_query = "check_cpu"
+}
+
+object CheckCommand "nscp-local-memory" {
+       import  "nscp-local"
+
+       vars.nscp_query = "check_memory"
+}
+
+object CheckCommand "nscp-local-os-version" {
+       import  "nscp-local"
+
+       vars.nscp_query = "check_os_version"
+}
+
+object CheckCommand "nscp-local-pagefile" {
+       import  "nscp-local"
+
+       vars.nscp_query = "check_pagefile"
+}
+
+object CheckCommand "nscp-local-process" {
+       import  "nscp-local"
+
+       vars.nscp_query = "check_process"
+}
+
+object CheckCommand "nscp-local-service" {
+       import  "nscp-local"
+
+       vars.nscp_query = "check_service"
+}
+
+object CheckCommand "nscp-local-uptime" {
+       import  "nscp-local"
+
+       vars.nscp_query = "check_uptime"
+}
+
+object CheckCommand "nscp-local-version" {
+       import  "nscp-local"
+
+       vars.nscp_query = "check_version"
+}
diff --git a/itl/nscp b/itl/nscp
new file mode 100644 (file)
index 0000000..2dd975f
--- /dev/null
+++ b/itl/nscp
@@ -0,0 +1,20 @@
+/******************************************************************************
+ * Icinga 2                                                                   *
+ * Copyright (C) 2012-2015 Icinga Development Team (http://www.icinga.org)    *
+ *                                                                            *
+ * 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 2             *
+ * 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.                               *
+ *                                                                            *
+ * You should have received a copy of the GNU General Public License          *
+ * along with this program; if not, write to the Free Software Foundation     *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
+ ******************************************************************************/
+
+include "command-nscp-local.conf"