Check_mk install on FreeBSD

Check_MK is a really nice UI for Nagios and brings lot of improvements to pollers (livecheck, checkmk agents…), but it is written to run on Linux and has not been ported to other Unices.

Whenever you only need a basic setup, you should consider OMD. If you have to get it running on FreeBSD, a very few things to do are required :


You need to have a running nagios like server, able to exec brokers (nagios from the pkg is not able to, icinga is)

pkg install icinga

Python module for apache :

pkg install ap22-mod_python

Check_mk base Install

Download tar.gz from

tar xvzf check_mk-1.2.4.tar.gz
cd check_mk-1.2.4

launch installer with bash (not ./, as bash path is incorrect)


Choose your own settings. Here are mine :

 Executable programs             /app/bin                                
 Check_MK configuration          /usr/local/etc/check_mk                 
 Check_MK software               /app/dist/check_mk/share                
 documentation                   /app/dist/check_mk/doc                  
 check manuals                   /app/dist/check_mk/doc/checks           
 working directory of check_mk   /app/dist/check_mk/lib                  
 extensions for agents           /app/dist/check_mk_agent/lib            
 configuration dir for agents    /usr/local/etc/check_mk                 
 Name of Nagios user             icinga                                  
 User of Apache process          www                                     
 Common group of Nagios+Apache   icinga                                  
 Nagios binary                   /usr/local/bin/icinga                   
 Nagios main configuration file  /usr/local/etc/icinga/icinga.cfg        
 Nagios object directory         /usr/local/etc/icinga/objects/          
 Nagios startskript              /usr/local/etc/rc.d/icinga              
 Nagios command pipe             /var/spool/icinga/rw/icinga.cmd         
 Check results directory         /var/spool/icinga/checkresults          
 Nagios status file              /var/spool/icinga/status.dat            
 Path to check_icmp              /home/cbellot/devels/check_mk/check_mk-1.2.4/z 
 URL Prefix for Web addons       /                                       
 Apache config dir               /usr/local/etc/apache22/Includes/       
 HTTP authentication file        /usr/local/etc/apache22/htpasswd.users    
 HTTP AuthName                   Private Access                           
 PNP4Nagios templates            /app/dist/check_mk/pnp-templates        
 RRD files                       /var/spool/icinga/pnp/rrd                     
 rrdcached socket                /tmp/rrdcached.sock                     
 compile livestatus module       no                                      
 Install Event Console           no                                      

Do not choose livestatus : it does not compile through this installer. See later for its install.

Check_mk is now installed, but a few things need to be changed :

  • python path is wrong in a lot of scripts
    • Either you put a link in /usr/bin for /usr/local/bin/python
    • Either you replace all occurrences of /usr/bin/python by /usr/bin/env python
  • sudo path is also wrong:
    • 'sudo -u root /app/bin/check_mk –automation' to be replaced by '/usr/local/bin/sudo -u root /app/bin/check_mk –automation'
  • some tar arguments are specific to gnu tar
    • –force-local : has to be removed
  • there is a bug in os.popen call for notify plugins execution with recent versions of pyhton
    • os.popen should be replaced by (os.system is deprecated)

I have a patch file that can be applied on the installed check_mk directory.

Fix: /app/bin/check_mk has to be corrected too :

exec env python /app/dist/check_mk/share/modules/ "$@"

I also had a bug with a few settings not begin properly set in the config file :

lib_dir                     = ''
livestatus_unix_socket      = ''
livebackendsdir             = ''
check_mk_automation         = 'sudo -u root /app/bin/check_mk --automation'

It has to be manually set :

lib_dir                     = '/app/dist/check_mk/lib'
livestatus_unix_socket      = '/var/spool/icinga/rw/live'
livebackendsdir             = '/app/dist/check_mk/share/livestatus'
check_mk_automation         = '/usr/local/bin/sudo -u root /app/bin/check_mk --automation'

Livestatus install

It is available in the ports, but you'd rather use the same version as check_mk, from the website.

Download tar.gz file

tar xvzf mk-livestatus-1.2.4.tar.gz
cd mk-livestatus-1.2.4
./configure --prefix=/app/dist/mk-livestatus    # or whatever path you prefer
make install

Enable broker module in nagios/icinga/… in /usr/local/etc/icinga/conf.d/livestatus.cfg file :

define module{
        module_name	mklivestatus
	path		/app/dist/mk-livestatus/lib/mk-livestatus/livestatus.o
        module_type	neb
        args            /var/spool/icinga/rw/live livecheck=/usr/local/lib/mk-livestatus/livecheck num_livecheck_helpers=1 pnp_path=/var/spool/icinga/pnp/rrd/

Create directory :

mkdir -p /var/spool/icinga/rw
chown icinga: /var/spool/icinga/rw

If network access to livestatus is needed:

Add in /etc/inetd.conf :

livestatus stream tcp nowait icinga /usr/libexec/tcpd /app/dist/mk-livestatus/bin/unixcat /var/spool/icingacheckmk/rw/live

Add in /etc/services :

livestatus      6557/tcp # checkmk livestatus
contribs/check_mk_freebsd.txt · Dernière modification: 2014/02/28 15:37 par cbellot