Skip to content

Instantly share code, notes, and snippets.

@dlangille
Last active January 19, 2019 12:22
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dlangille/36c52dd0c73c43b5e9e0 to your computer and use it in GitHub Desktop.
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
@dsdickinson
Copy link

Great check idea. Thanks!

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