Last active
August 29, 2015 14:17
-
-
Save dlangille/cea9526ef3eb8ee3dfe8 to your computer and use it in GitHub Desktop.
Compare iocage jail version against the host - nagios check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
HOSTVERSION=`/usr/bin/file /bin/sh` | |
JAILS=`/usr/local/sbin/iocage list | /usr/bin/egrep -v '^JID' | /usr/bin/cut -f 2 -w` | |
ERRORS='' | |
for jail in ${JAILS} | |
do | |
JAILVERSION=`/usr/local/sbin/iocage chroot ${jail} 'file /bin/sh'` | |
if [ "${JAILVERSION}" != "${HOSTVERSION}" ] | |
then | |
ERRORS="jail '${jail}' is ${JAILVERSION} ${ERRORS}" | |
fi | |
done | |
if [ "${ERRORS}" == "" ] | |
then | |
echo 'All jails match the host' | |
exit 0 | |
else | |
echo "WARNING: HOST and jails are NOT in sync: host = ${HOSTVERSION} but ${ERRORS}" | |
exit 2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment