]> git.michaelhowe.org Git - packages/n/nagios-plugins-local.git/commitdiff
Merge in check_running_kernel changes
authorMichael Howe <michael@michaelhowe.org>
Wed, 2 Jun 2021 21:21:45 +0000 (22:21 +0100)
committerMichael Howe <michael@michaelhowe.org>
Wed, 2 Jun 2021 21:21:45 +0000 (22:21 +0100)
monitoring-plugins-contri 35.20210511 looks to work; unfortunately
that's not available until bullseye

debian/changelog
plugins/check_running_kernel

index 39ce03d62f63e83fa0d3602b03bbf1000f74430f..152808d4daf0d6972dae72bf4796fd8882146054 100644 (file)
@@ -1,9 +1,10 @@
-nagios-plugins-local (0.22~test.1) UNRELEASED; urgency=medium
+nagios-plugins-local (0.22) unstable; urgency=medium
 
   * New version of check_mqtt, from https://github.com/jpmens/check-mqtt/
     This adds python3 support and works with buster. 
+  * Merge in check_running_kernel changes from 35.20210511 
 
- -- Michael Howe <michael@michaelhowe.org>  Sat, 09 Jan 2021 14:35:02 +0000
+ -- Michael Howe <michael@michaelhowe.org>  Wed, 02 Jun 2021 22:21:26 +0100
 
 nagios-plugins-local (0.21) unstable; urgency=medium
 
index cb0c1097ca86aaf47c7a7e33bcae88cb7a65f8f5..b74e261640115a27e52d187481e7f79ed507ed49 100755 (executable)
@@ -94,7 +94,7 @@ get_avail() {
 
        local imagename=0
        # --no-all-versions show shows only the candidate
-       for vers in $(apt-cache --no-all-versions show ${prefix}-image-${metavers} | sed -n 's/^Depends: //p' | tr ',' '\n' | tr -d ' ' | grep ${prefix}-image | awk '{print $1}' | sort -Vu); do
+       for vers in $(apt-cache --no-all-versions show ${prefix}-image-${metavers} | sed -n 's/^Depends: //p' | sed -e 's/ (.*)$//' | tr ',' '\n' | tr -d ' ' | grep ${prefix}-image | awk '{print $1}' | sort -Vu); do
                if dpkg --compare-versions "1.$vers" gt "1.$imagename"; then
                        imagename=$vers
                fi
@@ -132,8 +132,8 @@ cat_vmlinux() {
        filter="$3"
        hdroff="$4"
 
-       if ! which $filter >/dev/null; then
-               echo "UNKNOWN: filter command '$filter' missing, perhaps install xz-utils?" >&2
+       if ! which ${filter%% *} >/dev/null; then
+               echo "UNKNOWN: filter command '$filter' missing, perhaps install xz-utils, lz4 or lzop?" >&2
                exit $UNKNOWN
        fi
 
@@ -157,7 +157,11 @@ get_image_linux() {
        cat_vmlinux "$image" "\x00\x00\x00\x02\xff"  "xzcat" -1
        cat_vmlinux "$image" "\x00\x00\x00\x04\xff"  "xzcat" -1
        # xz compressed image
-       cat_vmlinux "$image" "\xfd\x37\x7a\x58\x5a " "xzcat"  0
+       cat_vmlinux "$image" "\xfd\x37\x7a\x58\x5a"  "xzcat"  0
+       # lz4 compressed image
+       cat_vmlinux "$image" "\x02\x21\x4c\x18"  "lz4 -dc"  0
+       # lzo compressed image
+       cat_vmlinux "$image" "\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a"  "lzop -dc"  0
 
        echo "ERROR: Unable to extract kernel image." 2>&1
        exit 1
@@ -188,8 +192,8 @@ fi
 
 searched=""
 for on_disk in \
-       $([ -f "/boot/vmlinuz-$(uname -r)" ] && find /boot/ -name 'vmlinuz*' -and -name "vmlinuz-$(uname -r)" -or -name 'vmlinuz*' -and -newer "/boot/vmlinuz-$(uname -r)" | sort -V) \
-       $([ -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 -V); do
+       $([ -f "/boot/vmlinuz-$(uname -r)" ] && find /boot/ -maxdepth 1 -name 'vmlinuz*' -and -name "vmlinuz-$(uname -r)" -or -name 'vmlinuz*' -and -newer "/boot/vmlinuz-$(uname -r)" | sort -V) \
+       $([ -f "/boot/kfreebsd-$(uname -r).gz" ] && find /boot/ -maxdepth 1 -name 'kfreebsd*' -and -name "kfreebsd-$(uname -r).gz" -or -name 'kfreebsd*' -and -newer "/boot/kfreebsd-$(uname -r).gz" | sort -V); do
 
        if [ -e "$on_disk" ]; then
                if [ -z "$STRINGS" ]; then