Server IP : 162.0.209.157 / Your IP : 18.116.118.214 [ Web Server : LiteSpeed System : Linux premium178.web-hosting.com 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64 User : balaoqob ( 2395) PHP Version : 8.0.30 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /lib64/nagios/plugins/nccustom/ |
Upload File : |
#!/bin/sh ## check Kernel Care updates and if patches were applied ## Copyright (c) 2017, Namecheap.com ## Written by Yuri Muravyov <y.muravyov@gmail.com> ## Updated by Bogdan Kukharskiy <bogdan.kukharskiy@namecheap.com> PROGNAME=check_kernel_care REVISION=0.3 PROGNAME=`basename $0` CHECK_UPDATES_STR="The latest patch is applied." CHECK_UPDATES_STR2="This kernel doesn't require any patches." CHECK_PATCHES_STR="kpatch-state: patch is applied" print_revision() { echo $PROGNAME $REVISION } print_usage() { echo "Usage: $PROGNAME [options]" echo " e.g. $PROGNAME" echo echo "Options:" echo -e "\t --help | -h print help" echo -e "\t --version | -V print version" } print_help() { print_revision $PROGNAME $REVISION echo echo "This script checks kernel care state (updates and patches)" echo print_usage echo exit 3 } # parse cmd arguments if [ "$#" -gt 0 ]; then while [ "$#" -gt 0 ]; do case "$1" in '--help'|'-h') print_help exit 3 ;; '--version'|'-V') print_revision $PROGNAME $REVISION exit 3 ;; *) echo "Unknown option!" print_usage exit 3 ;; esac done fi KCARE_UPDATES_CHECK=`sudo /usr/bin/kcarectl --check 2>&1`; KCARE_PATCHES_CHECK=`sudo /usr/bin/kcarectl -i | grep kpatch-state 2>&1`; if [ "$KCARE_UPDATES_CHECK" != "$CHECK_UPDATES_STR" ] && [ "$KCARE_UPDATES_CHECK" != "$CHECK_UPDATES_STR2" ]; then echo "CRITICAL: $KCARE_UPDATES_CHECK" exit 2 elif [ "$KCARE_PATCHES_CHECK" != "$CHECK_PATCHES_STR" ] && [ ${#KCARE_PATCHES_CHECK} != 0 ]; then echo "CRITICAL: $KCARE_PATCHES_CHECK" exit 2 fi echo "OK: $KCARE_UPDATES_CHECK $KCARE_PATCHES_CHECK" exit 0