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 234114074..d8b061fa6 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 2036b9522..e59209891 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. + + +#### 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 1be51ef6b..bcecd28a8 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 77ad62391..000000000 --- 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 3b579cb27..a700a6f97 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" +} +