FreeNAS and check_mk

Hi,

I’m setting up two FreeNAS Server for Backup and Archiving and I really like FreeNAS 11. Thank good I didn’t have time to update it to FreeNAS Coral. 🙂

But I’m using check_mk for monitoring and I would like to use it to monitor FreeNAS as well. There is a check_mk agent for FreeBSD so the only problem is to run it.

I created this script to run it as a Init/Shutdown Script (both pre-init and post-init) . It will create everything you need, only define the BASEDIR at the beginning and put the check_mk_agent for FreeBSD in this directory. Make sure this script (check_mk_setup) and check_mk_agent are executable.

You also need to make sure inetd is running. I enable tftpd for that. Maybe some other service are possible as well. But I only tested it with tftpd.

#!/usr/local/bin/bash
BASEDIR=/mnt/myzfs/
if grep checkmk /conf/base/etc/inetd.conf &> /dev/null
then
  :
else
  echo checkmk stream tcp nowait root $BASEDIR/check_mk_agent check_mk_agent >> /conf/base/etc/inetd.conf
fi

if grep checkmk /conf/base/etc/services &> /dev/null
then
  :
else
  echo "checkmk 6556/tcp #check_mk" >> /conf/base/etc/services
fi

if grep checkmk /etc/services &> /dev/null
then
  :
else
  echo "checkmk 6556/tcp #check_mk" >> /etc/services
fi

killall -1 inetd

After the next reboot the system can be monitored by check_mk. It even survived the upgrade from FreeNAS 10 to 11.

This entry was posted in Linux, Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

eight + nine =