Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Nagios plugin for comparing userland with kernel
#!/bin/sh
#
# Nagios check to compare host and basejail
# Use this freely. Enjoy.
# Copyright Dan Langille <dan@langille.org>
#
HOST=`/usr/bin/file -b /bin/sh`
JAIL=`/usr/bin/file -b /usr/jails/basejail/bin/sh`
if [ "${JAIL}" == "${HOST}" ]
then
echo Host and basejail are in sync
exit 0
else
echo WARNING: Host and basejail are NOT in sync: host = ${HOST}, basejail = ${JAIL}
exit 2
fi
#!/bin/sh
#
# nagios check to compare userland and kernel on FreeBSD 9.3 and later
# use this freely. Enjoy.
# Copyright Dan Langille <dan@langille.org>
#
KERNEL=`uname -K`
USERLAND=`uname -U`
if [ "${KERNEL}" == "${USERLAND}" ]
then
echo Userland and kernel are in sync
exit 0
else
echo WARNING: Userland and kernel are NOT in sync: userland = ${USERLAND}, kernel = ${KERNEL}
exit 2
fi

Great check idea. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment