OMD port to Debian/kFreeBSD

FreeBSD turned 20 yesterday – I have a little present!

You’re now able to run – with a little detour – a really modern monitoring environment (OMD) on FreeBSD.


Lets start with the download link:

Wartungsfenster-OMD: omd-1.00_0.wheezy_kfreebsd-amd64.deb

How I got there

I found there’s a howto for running Debian/kFreeBSD on FreeBSD as a JAIL! See the howto from here: kFreeBSD Jails (new window)

So the idea I came up with was:

Debian is a supported distro, so let’s port OMD to run in that jail!

I built a jail mostly via the howto – try it too!
Things that I changed:
The command to launch jails has a “–” bit in it – removed that or it didn’t launch the jail.

My actual script (since I found nothing about running Linux Jails from rc.conf)


ifconfig xn0 alias
mount -t linprocfs linprocfs /srv/jail/debjail/proc
mount -t linsysfs linsysfs /srv/jail/debjail/sys
mount -t tmpfs tmpfs /srv/jail/debjail/run
mount -t devfs devfs /srv/jail/debjail/dev

jail -J /var/run/jail/debjail.jid -c jid=66     \
   name=debjail path=/srv/jail/debjail          \
   host.hostname=debjail ip4.addr= \
   command=/bin/sh  -c "/etc/init.d/rc S && /etc/init.d/rc 2"
   # needed for building deb packages
   jail -m jid=66 allow.sysvipc=1
   # needed for ping
   jail -m jid=66 allow.raw_sockets=1

if [ $? = 0 ]; then

starting the Jail!

Like this the jail should likely launch. You can enter it using jexec 66 /bin/bash. Once inside, add openssh so you can get in from the outside. You’ll also need to configure authentication, namely root access.

To be able to use su inside the jail, make sure you didn’t put it on a filesystem that’s mounted as nosuid (i do that by default, …)

just a normal server, lets build!

(if you just wanna run OMD, you can of course skip this part 🙂
Once SSH and su work, ssh into the jail I checked out the omd sources and started building, using first configure, then make && make pack, and in the last stage set about make deb.
I had to remove most of the perl-modules due to incompletely specified dependencies. Due to that I also had to remove Thruk, Gearman and disable RRDtool’s perl support. Sorry, but after a handfull of perl-related issues I got really sick of it. Fix your shit. Further weirdness was that the Check_MK tarball from git was corrupt. I replaced it with the upstream one.
(The make deb also needed sysvipc support in the jail enabled)

The resulting package is what You found above at the download link.

OMD install

I could install it using gdebi like on a standard distro.

apt-get install gdebi && gdebi omd-1.00_0.wheezy_kfreebsd-amd64.deb

When creating a site (omd config create sitename) I found I had to turn off the tmpdir setting

omd config sitename set TMPFS off

and then I could launch the site.
My setup won’t need TMPFS performance, so I didn’t do anything here. It could be fixable, I’m not sure.

After restarting the main apache,

service apache2 restart

The Check_MK gui greeted me with errors because it tried to find a uuid in /proc but that’s not yet possible on FreeBSD (PR openend: kern/183615).

I made a tiny change to the Check_MK Multisite sources for this. The UUID is used for identifying sessions and so this is _quite_ important to work.

to fix it, change a little piece of the for your site (or actually, in /omd/versions/default)

at line 117 and below:

    116 # Generates a selection id or uses the given one
    117 def selection_id():
    118     if not html.has_var('selection'):
    119         #sel_id = file('/proc/sys/kernel/random/uuid').read().strip()
    120         import commands
    121         sel_id = commands.getoutput("uuid")

(so, instead of reading from /proc, run “uuid”)

for this to work you also need to install uuid using

apt-get install uuid

After this I needed to also enable raw socket support for the jail so ping hosts would work (already in the debjail script)

If you use IPv6, don’t forget to switch to the Icinga monitoring core using

omd config sitename set CORE icinga

Start it using

omd start sitename

and hit the web interface at http://jailname/sitename – user: omdadmin pass: omd

root@debjail:/omd# omd status
Doing 'status' on site freemon:
mkeventd:       running
apache:         running
rrdcached:      running
npcd:           running
icinga:         running
crontab:        running
Overall state:  running

Not a full FreeBSD port, but a bullshit linux system locked into a jail – still – this is getting the job done.

Try it, and, that’s it!

Happy birthday Beastie!


One thought on “OMD port to Debian/kFreeBSD

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s