Add check commands for NSClient++

fixes #8621
This commit is contained in:
Gunnar Beutner 2015-03-06 13:08:42 +01:00
parent 274c0d1f12
commit 4f41c79a4c
4 changed files with 191 additions and 2 deletions

View 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>

View 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
)

View File

@ -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"
}

20
itl/nscp Normal file
View File

@ -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"