CHips L MINI SHELL

CHips L pro

Current Path : /proc/3/task/3/root/proc/3/task/3/cwd/opt/zabbix_scripts/oldscripts/
Upload File :
Current File : //proc/3/task/3/root/proc/3/task/3/cwd/opt/zabbix_scripts/oldscripts/check_kernel_updates.sh

#!/bin/sh
# Plugin to check for outdated kernel using Kernel Care

# Variable Declaration
STATUS_OK=0
STATUS_WARNING=1
STATUS_CRITICAL=2


if [[ -x /usr/bin/kcarectl ]]; then
	/usr/bin/kcarectl --info | grep -q "patch is applied"
	if [ $? == 0 ]; then
		echo "OK: Kernelcare patch is applied"
		exit $STATUS_OK
	else
		echo "WARNING: Kernelcare patch is not applied"
		exit $STATUS_WARNING
	fi
else
	LOAD_KERNEL=$(uname -r | cut -d'-' -f2 | cut -d'.' -f 1-4)
	AVAIL_KERNEL=$(yum info kernel | grep Release | tail -1 | awk '{print $3}')
	if [ "$LOAD_KERNEL" != "$AVAIL_KERNEL" ]; then
		yum --quiet check-update kernel > /dev/null
		if [ $? == 0 ]; then
			echo "WARNING: Latest Kernel installed but reboot pending"
			exit $STATUS_WARNING
		else
			echo "CRITICAL: Kernel is outdated and kernelcare not installed"
			exit $STATUS_CRITICAL
		fi
	else
		echo "OK: Kernel is on the latest version"
		exit $STATUS_OK
	fi
fi

Copyright 2K16 - 2K18 Indonesian Hacker Rulez