check_kernel.pl
A Nagios-plugin to check if a machine is running the latest kernel.
It basically compares the output of uname -r
with available /boot/vmlinuz-*
files, so it should be somewhat generic and is supposed to work for most linux based systems. Let me know if it’s not working for you.
The script doesn’t expect any arguments.
current_kernel=$(uname -r)
latest_kernel=$(find /boot/ -name vmlinuz-* | sort -V | tail -1 | sed 's/.*vmlinuz-//')
if [ "$current_kernel" = "$latest_kernel" ]
then
echo "running kernel is $current_kernel"
exit ${STATE_OK}
else
echo "your kernel $current_kernel is outdated, please boot into $latest_kernel"
exit ${STATE_WARNING}
fi
(this is just an excerpt of the actual monitoring script – please look into the file check_kernel.sh)
Please consider to take a look at my general setup notes.
Download:
Shell: check_kernel.sh
(Please take a look at the man-page. Browse bugs and feature requests.)
Leave a comment
There are multiple options to leave a comment:
- send me an email
- submit a comment through the feedback page (anonymously via TOR)
- Fork this repo at GitHub, add your comment to the _data/comments directory and send me a pull request
- Fill the following form and Staticman will automagically create a pull request for you:
2 comments
wrong title on this page: should be check_kernel and not check_mount.pl
Thanks for the note! Should be fixed once CI/CD approved it :)
Cheers, Martin