[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 11/14: Enhance check_running_kernel.

Bernd Zeimetz bernd at bzed.de
Fri Jan 13 13:26:50 UTC 2017


This is an automated email from the git hooks/post-receive script.

bzed pushed a commit to branch master
in repository pkg-nagios-plugins-contrib.

commit fbd854d195095ec256195a042e65e422b97136bd
Author: Bernd Zeimetz <bernd at bzed.de>
Date:   Fri Jan 13 11:40:29 2017 +0100

    Enhance check_running_kernel.
    
    Support Ubuntu and CentOS, also warn about missing filter utils.
    
    Thanks: Jonas Meurer
    Closes: #780098
---
 .../dsa/check_running_kernel_jessie_centos_fix     | 42 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 43 insertions(+)

diff --git a/debian/patches/dsa/check_running_kernel_jessie_centos_fix b/debian/patches/dsa/check_running_kernel_jessie_centos_fix
new file mode 100644
index 0000000..6dd9436
--- /dev/null
+++ b/debian/patches/dsa/check_running_kernel_jessie_centos_fix
@@ -0,0 +1,42 @@
+--- a/dsa/checks/dsa-check-running-kernel
++++ b/dsa/checks/dsa-check-running-kernel
+@@ -129,6 +129,11 @@
+ 	filter="$3"
+ 	hdroff="$4"
+ 
++	if ! which $filter >/dev/null; then
++		echo "UNKNOWN: filter command '$filter' missing, perhaps install xz-utils?" >&2
++		exit $UNKNOWN
++	fi
++
+ 	get_offset "$image" $header | head -n 5 | while read off; do
+ 		(if [ "$off" != 0 ]; then
+ 		   dd ibs="$((off+hdroff))" skip=1 count=0
+@@ -180,9 +185,8 @@
+ 
+ searched=""
+ for on_disk in \
+-	"/boot/vmlinuz-`uname -r`"\
+-	"/boot/vmlinux-`uname -r`"\
+-	"/boot/kfreebsd-`uname -r`.gz"; do
++	$([ -f "/boot/vmlinuz-$(uname -r)" ] && find /boot/ -name 'vmlinuz*' -and -name "vmlinuz-$(uname -r)" -or -name 'vmlinuz*' -and -newer "/boot/vmlinuz-$(uname -r)" | sort) \
++	$([ -f "/boot/kfreebsd-$(uname -r).gz" ] && find /boot/ -name 'kfreebsd*' -and -name "kfreebsd-$(uname -r).gz" -or -name 'kfreebsd*' -and -newer "/boot/kfreebsd-$(uname -r).gz" | sort); do
+ 
+ 	if [ -e "$on_disk" ]; then
+ 		if [ -z "$STRINGS" ]; then
+@@ -194,12 +198,12 @@
+ 			if [ -x /usr/bin/lsb_release ] ; then
+ 				vendor=$(lsb_release -i -s)
+ 				if [ -n "$vendor" ] && [ "xDebian" != "x$vendor" ] ; then
+-					on_disk_version=$( echo $on_disk_version|sed -e "s/ ($vendor [[:alnum:]\.-]\+ [[:alnum:]\.]\+)//")
++					on_disk_version=$( echo $on_disk_version|sed -e "s/ ($vendor [[:alnum:]\.-]\+ [[:alnum:]\.-]\+)//")
+ 				fi
+ 			fi
+-			[ -z "$on_disk_version" ] || break
++			[ -z "$on_disk_version" ] || continue
+ 			on_disk_version="`cat "$on_disk" | $STRINGS | grep 'Linux version' | head -n1`"
+-			[ -z "$on_disk_version" ] || break
++			[ -z "$on_disk_version" ] || continue
+ 
+ 			echo "UNKNOWN: Failed to get a version string from image $on_disk"
+ 			exit $UNKNOWN
diff --git a/debian/patches/series b/debian/patches/series
index dc90707..ca6f2f8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
+dsa/check_running_kernel_jessie_centos_fix
 check_ajp/return_critical_on_failed_connection
 check_backuppc/use_nagios_plugins
 check_bgpstate/epn

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-plugins-contrib.git



More information about the Pkg-nagios-changes mailing list