Keep an eye on the local resolver
[mirror/dsa-nagios.git] / dsa-nagios-checks / checks / dsa-check-running-kernel
index 78255f7..cb5168b 100755 (executable)
@@ -6,6 +6,7 @@
 # Copyright 2008,2009 Peter Palfrader
 # Copyright 2009 Stephen Gran
 # Copyright 2010 Uli Martens
+# Copyright 2011 Alexander Reichle-Schmehl
 #
 # Permission is hereby granted, free of charge, to any person obtaining
 # a copy of this software and associated documentation files (the
@@ -159,8 +160,18 @@ for on_disk in \
        "/boot/kfreebsd-`uname -r`.gz"; do
 
        if [ -e "$on_disk" ]; then
+               if [ ! -x "$(which strings)" ]; then
+                       echo "UNKNOWN: 'strings' command missing, perhaps install binutils?"
+                       exit $UNKNOWN
+               fi
                if [ "${on_disk/vmlinu}" != "$on_disk" ]; then
                        on_disk_version="`get_image_linux "$on_disk" | strings | grep 'Linux version' | head -n1`"
+                       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:]\.]\+)//")
+                               fi
+                       fi
                        [ -z "$on_disk_version" ] || break
                        on_disk_version="`cat "$on_disk" | strings | grep 'Linux version' | head -n1`"
                        [ -z "$on_disk_version" ] || break