From 97567759028618975b6ad3131a5e6b8cf52c9e04 Mon Sep 17 00:00:00 2001 From: Thomas Widhalm Date: Mon, 31 Oct 2016 16:51:58 +0100 Subject: [PATCH] ITL: Add logstash CheckCommand fixes #12755 Signed-off-by: Michael Friedrich --- doc/10-icinga-template-library.md | 21 +++++++ itl/plugins-contrib.d/CMakeLists.txt | 2 +- itl/plugins-contrib.d/logmanagement.conf | 72 ++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 itl/plugins-contrib.d/logmanagement.conf diff --git a/doc/10-icinga-template-library.md b/doc/10-icinga-template-library.md index a49b6aa5a..79e7bd8f3 100644 --- a/doc/10-icinga-template-library.md +++ b/doc/10-icinga-template-library.md @@ -4741,3 +4741,24 @@ glusterfs_disk_warning | **Optional.** Warn if disk usage is above *DISKWARN glusterfs_disk_critical | **Optional.** Return a critical error if disk usage is above *DISKCRIT*. Defaults to 95 (percent). glusterfs_inode_warning | **Optional.** Warn if inode usage is above *DISKWARN*. Defaults to 90 (percent). glusterfs_inode_critical | **Optional.** Return a critical error if inode usage is above *DISKCRIT*. Defaults to 95 (percent). + +### Logmanagement + +This category includes all plugins for services dealing with logfiles and logevents + +#### logstash + +The [logstash](https://github.com/widhalmt/check_logstash) plugin connects to the Node API of Logstash. This feature was introduced with Logstash version 5.0 so the plugin won't work with prior versions of Logstash. The Node API is not activated by default, you will have to reconfigure your Logstash installation for the plugin to connect. + +Name | Description +---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +logstash_hostname | **Optional.** Hostname where Logstash is running. Defaults to `check_address` +logstash_port | **Optional.** Port where Logstash is listening for API requests. Defaults to 9600 +logstash_filedesc_warn | **Optional.** Warning threshold of file descriptor usage in percent. Defaults to 85 (percent). +logstash_filedesc_crit | **Optional.** Critical threshold of file descriptor usage in percent. Defaults to 95 (percent). +logstash_heap_warn | **Optional.** Warning threshold of heap usage in percent. Defaults to 70 (percent). +logstash_heap_crit | **Optional.** Critical threshold of heap usage in percent Defaults to 80 (percent). +logstash_inflight_warn | **Optional.** Warning threshold of inflight events. +logstash_inflight_crit | **Optional.** Critical threshold of inflight events. +logstash_cpu_warn | **Optional.** Warning threshold for cpu usage in percent. +logstash_cpu_crit | **Optional.** Critical threshold for cpu usage in percent. diff --git a/itl/plugins-contrib.d/CMakeLists.txt b/itl/plugins-contrib.d/CMakeLists.txt index 2358b4b1f..1b74b5abb 100644 --- a/itl/plugins-contrib.d/CMakeLists.txt +++ b/itl/plugins-contrib.d/CMakeLists.txt @@ -16,6 +16,6 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. install( - FILES databases.conf icingacli.conf ipmi.conf network-components.conf operating-system.conf virtualization.conf vmware.conf storage.conf web.conf hardware.conf network-services.conf metrics.conf + FILES databases.conf icingacli.conf ipmi.conf logmanagement.conf network-components.conf operating-system.conf virtualization.conf vmware.conf storage.conf web.conf hardware.conf network-services.conf metrics.conf DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2/include/plugins-contrib.d ) diff --git a/itl/plugins-contrib.d/logmanagement.conf b/itl/plugins-contrib.d/logmanagement.conf new file mode 100644 index 000000000..a85f94359 --- /dev/null +++ b/itl/plugins-contrib.d/logmanagement.conf @@ -0,0 +1,72 @@ +/****************************************************************************** + * Icinga 2 * + * Copyright (C) 2012-2016 Icinga Development Team (https://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. * + ******************************************************************************/ + +object CheckCommand "logstash" { + import "plugin-check-command" + command = [ PluginContribDir + "/check_logstash" ] + arguments = { + "-H" = { + value = "$logstash_hostname$" + description = "Hostname where Logstash is running" + } + "-p" = { + value = "$logstash_port$" + description = "Port where Logstash is listening for API requests" + } + "--file-descriptor-threshold-warn" = { + value = "$logstash_filedesc_warn$" + description = "Warning threshold of file descriptor usage in percent" + } + "--file-descriptor-threshold-crit" = { + value = "$logstash_filedesc_crit$" + description = "Critical threshold of file descriptor usage in percent" + } + "--heap-usage-threshold-warn" = { + value = "$logstash_heap_warn$" + description = "Warning threshold of heap usage in percent" + } + "--heap-usage-threshold-crit" = { + value = "$logstash_heap_crit$" + description = "Critical threshold of heap usage in percent" + } + "--inflight-events-warn" = { + value = "$logstash_inflight_warn$" + description = "Warning threshold of inflight events" + } + "--inflight-events-crit" = { + value = "$logstash_inflight_crit$" + description = "Critical threshold of inflight events" + } + "--cpu-usage-threshold-warn" = { + value = "$logstash_cpu_warn$" + description = "Warning threshold for cpu usage in percent" + } + "--cpu-usage-threshold-crit" = { + value = "$logstash_cpu_crit$" + description = "Critical threshold for cpu usage in percent" + } + + } + vars.logstash_hostname = "$check_address$" + vars.logstash_port = 9600 + vars.logstash_filedesc_warn = 85 + vars.logstash_filedesc_crit = 95 + vars.logstash_heap_warn = 70 + vars.logstash_heap_crit = 80 +}