[icinga-checkins] icinga.org: icinga2/next: Drop check_kernel in favor of check_running_kernel, add plugin command.

git at icinga.org git at icinga.org
Mon Jun 2 13:36:43 CEST 2014


Module: icinga2
Branch: next
Commit: 9225f7ed00fa545fa1b84897ef67cbc04606a6d3
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=9225f7ed00fa545fa1b84897ef67cbc04606a6d3

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Mon Jun  2 13:34:35 2014 +0200

Drop check_kernel in favor of check_running_kernel, add plugin command.

Refs #6369

---

 .../hosts/localhost => debian/config}/kernel.conf  |    3 +-
 doc/6-configuring-icinga-2.md                      |    8 +++
 etc/icinga2/conf.d/commands.conf                   |    6 --
 etc/icinga2/scripts/check_kernel                   |   65 --------------------
 itl/command-plugins.conf                           |    6 ++
 5 files changed, 15 insertions(+), 73 deletions(-)

diff --git a/etc/icinga2/conf.d/hosts/localhost/kernel.conf b/debian/config/kernel.conf
similarity index 70%
rename from etc/icinga2/conf.d/hosts/localhost/kernel.conf
rename to debian/config/kernel.conf
index 2341140..d8b061f 100644
--- a/etc/icinga2/conf.d/hosts/localhost/kernel.conf
+++ b/debian/config/kernel.conf
@@ -2,6 +2,5 @@ object Service "kernel" {
   import "generic-service"
 
   host_name = "localhost"
-  check_command = "kernel"
+  check_command = "running_kernel"
 }
-
diff --git a/doc/6-configuring-icinga-2.md b/doc/6-configuring-icinga-2.md
index 2036b95..e592098 100644
--- a/doc/6-configuring-icinga-2.md
+++ b/doc/6-configuring-icinga-2.md
@@ -2077,3 +2077,11 @@ nrpe_timeout    | **Optional.** The timeout in seconds.
 Check command for the `check_apt` plugin.
 
 The `apt` check command does not support any vars.
+
+
+#### <a id="plugin-check-command-running-kernel"></a> ups
+
+Check command object for the `check_running_kernel` plugin
+provided by the `nagios-plugins-contrib` package on Debian.
+
+The `running_kernel` check command does not support any vars.
diff --git a/etc/icinga2/conf.d/commands.conf b/etc/icinga2/conf.d/commands.conf
index 1be51ef..bcecd28 100644
--- a/etc/icinga2/conf.d/commands.conf
+++ b/etc/icinga2/conf.d/commands.conf
@@ -1,11 +1,5 @@
 /* Command objects */
 
-object CheckCommand "kernel" {
-  import "plugin-check-command"
-
-  command = [ SysconfDir + "/icinga2/scripts/check_kernel" ]
-}
-
 object NotificationCommand "mail-host-notification" {
   import "plugin-notification-command"
 
diff --git a/etc/icinga2/scripts/check_kernel b/etc/icinga2/scripts/check_kernel
deleted file mode 100755
index 77ad623..0000000
--- a/etc/icinga2/scripts/check_kernel
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/bash
-# Icinga 2
-# Copyright (C) 2012-2014 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 [ -e /etc/debian_version ]; then
-	if [ "$(lsb_release -s -i)" = "Debian" ]; then
-		latest_kernel=$(dpkg-query -W -f='${Version}' linux-image-$(uname -r))
-		current_kernel=$(uname -v | awk '{print $4}')
-
-		if [ "x$latest_kernel" != "x$current_kernel" ]; then
-			echo "A kernel upgrade is available: $(uname -r) ($latest_kernel) - currently running: $(uname -r) ($current_kernel)"
-			exit 2
-		fi
-	else
-		IFS=$'\n'
-		for pkginfo in $(dpkg-query -W -f '${Source}\t${Depends}\n' 'linux-image-*'); do
-			source=$(echo $pkginfo | cut -f1 -d$'\t')
-			if [ "$source" != "linux-meta" -a "$source" != "linux-latest" ]; then
-				continue
-			fi
-
-			depends=$(echo $pkginfo | cut -f2 -d$'\t')
-			IFS=','
-			for depend in $depends; do
-				name=$(echo $depend | awk '{print $1}')
-				if ! echo $name | grep -E linux-image-[0-9] >/dev/null; then
-					continue
-				fi
-				version=$(echo $depend | cut -f3- -d-)
-				if [ "$name" != "linux-image-$(uname -r)" ]; then
-					echo "A kernel upgrade is available: $version - currently running: $(uname -r)"
-					exit 2
-				fi
-			done
-			IFS=$'\n'
-		done
-	fi
-elif [ -e /etc/redhat-release ]; then
-	latest_kernel=`rpm -q --last kernel | head -n 1 | awk '{print $1}' | cut -f2- -d-`
-	current_kernel=`uname -r`
-	if [ "x$latest_kernel" != "x$current_kernel" ]; then
-		echo "A kernel upgrade is available: $latest_kernel - currently running: $current_kernel"
-		exit 2
-	fi
-else
-	echo "Unsupported OS/distribution."
-	exit 3
-fi
-
-echo "Kernel version: `uname -a`"
-exit 0
diff --git a/itl/command-plugins.conf b/itl/command-plugins.conf
index 3b579cb..a700a6f 100644
--- a/itl/command-plugins.conf
+++ b/itl/command-plugins.conf
@@ -453,3 +453,9 @@ object CheckCommand "nrpe" {
 	vars.nrpe_timeout_unknown = false
 }
 
+/* Contrib plugins */
+object CheckCommand "running_kernel" {
+	import "plugin-check-command"
+	command = PluginDir + "/check_running_kernel"
+}
+



More information about the icinga-checkins mailing list