Creating an HTPC Stack With Docker Things, Part 2

This is a continuation of my previous post: Create an HTPC Stack With Docker Things. I will introduce docker-compose to bring up an environment with both containers used previously, sabnzbd and sickbeard.

I installed docker-compose using the instructions found here: Install Compose. I am using Mac OS X.

First make sure boot2docker is running, boot2docker up. Then create the following file named docker-compose.yml.

  image: maxexcloo/sickbeard 
   - "8081:8081"
   - "sickbeard"
  image: maxexcloo/sabnzbd
   - "8080:8080"
   - "sabnzbd"

This is setting up the environment with two images, exposing the ports the application will run on and naming the image to something meaningful. each directive in the yml file map to the same docker run command.

Once this file has been created, simply run docker-compose up, and the images will be started.


  • create a github repo for application configs.
  • map a local directory for configs.
  • add the local config directory to the yml.
  • more things…

Remove all unused Docker images

Running out of disk space on your Docker host? Here is a quick one liner to remove all unused Docker images:

docker images -q |xargs docker rmi

It will error on images that a running container is using, and won’t delete it.

I found this little gem in the Docker forums here:

Docker forums

Creating an HTPC Stack With Docker Things


This will be a mess until I figure it all out. In this article, I will demonstrate using tools such as packer, docker client, docker-machine to build out a Docker host with an HTPC stack. The following applications will be used:

  • Sickbeard
  • Sabnzbd+
  • HTPC Manager
  • Plex
  • Transmission web interface
  • Couch Potato

I will be using the latest Ubuntu 14.04 server distribution. This is being developed on Mac OSX Yosemite 10.10.2.

This is a WIP and will be complete when it is complete. Some of these tools I have not used yet and am learning as I go!

Expect many changes as I figure this out!


You will need the following tools to start:

This article assumes you have installed, and are familiar with the above tools.

I have created a root directory named htpc where all project files will reside.

The Docker Host

First create a new Docker host with the docker-machine command:

docker-machine create --driver virtualbox htpc

Now, point your docker client at the new Docker host:

$(docker-machine env htpc)

Sickbeard container

Docker hub contains thousands of community made images. Searching the hub for a Sickbeard image returns many results. I chose maxexcloo/sickbeard for this example. It is Debian based. First, we need to pull the image.

docker pull maxexcloo/sickbeard

Now run it:

docker $(docker-machine config htpc) run -d -p 8081:8081 --name="sickbeard" maxexcloo/sickbeard

This command will expose port 8081 and run the image in daemon mode (detached).

the –name”” argument provides a nice name that will show up in the NAME column from the output of docker ps. If this argument is not suppled, a random name will be generated.

We are almost finished. To find the IP of the Docker host:

docker-machine ip

Finally, you can point your browser at http://<docker host ip>:8081.


As with Sickbeard, this container will be run similarly.

docker pull maxexcloo/sabnzbd

docker $(docker-machine config htpc) run -d -p 8080:8080 –name=”sabnzbd” maxexcloo/sabnzbd

Running docker ps will show something like this:

CONTAINER ID        IMAGE                        COMMAND                CREATED             STATUS              PORTS                    NAMES
b432e5cbf6df        maxexcloo/sabnzbd:latest     "/bin/sh -c /config/   5 seconds ago       Up 4 seconds>8080/tcp   pensive_ritchie     
dbcd9f132908        maxexcloo/sickbeard:latest   "/bin/sh -c /config/   5 minutes ago       Up 5 minutes>8081/tcp   suspicious_tesla

We now have a Docker host running two images!

Further Thoughts

If this all works out as intended, possibly use vagrant-managed-servers to build out a server that already has an OS on it.

Make my own images.


Up and running chef-solo instance using Vagrant

This will describe a quick and easy way to get a chef-solo instance up and running using Vagrant. This document is intended for learning Chef and not intended for production use.

I am using Mac OS X for this tutorial. I am sure it is simiar for Windows and Linux.


  • Oracle Virtual Box – Download
  • Vagrant – Download
  • Working knowledge of Vagrant

 Setting It Up

Create a directory for the Vagrantfile and I named mine chef_solo. Change into that directory and create a Vagrantfile with the following:

Vagrant.configure("2") do |config| = "ubuntu/trusty64"
  config.vm.provision :shell, path: ""

This will spin up an Ubuntu server 14.04 64 bit instance and run

Now edit and add the following:

#!/usr/bin/env bash

apt-get update
apt-get install -y curl
curl -L | bash
chef-solo -v

Once the VM is up and running, will apply updates, install curl, download and install chef-solo using the Omnibus installer, and print out the version of Chef.

Chef-solo up and running

Now simply run vagrant up and your chef-solo instance will be installed.

Icinga Monitoring System

After many installations of Icinga, I finally decided to cobble together the documentation that I use and add it to a central location. Links to the original documents are found throughout this post. This document provides instructions on setting up the Icinga monitoring system. It will go over the following:

  • Icinga and IDOUtils
  • Icinga Web
  • PNP4Nagios
  • Icinga Mobile


  • Ubuntu Server 14.04 LTS 64 Bit
  • 2GB RAM
  • 2 CPU
  • 60 GB HDD

Icinga and IDOUtils

The installation of the following software will be covered in this section:

  • Icinga Core
  • Icinga Classic UI (the “CGIs”)
  • Icinga IDOUtils
    • Mysql or Postgresql as database
  • Icinga Docs

Icinga Core

This document describes the procedure for installing Icinga core using the official packages. There is also documentation for installing the package maintainer version (PPA) which may be more up to date.

The following command will install all required packages:

sudo apt-get install icinga icinga-doc icinga-idoutils mysql-server libdbd-mysql mysql-client

This installation will use MySQL as the database server. Postgress can also be used, but will not be covered in this document.


The following command will install the Nagios plugins.

sudo apt-get install nagios-plugins


Enable IDO2DB

Edit the following file:


change the following line:




Then restart the ido2db service:

sudo service ido2db start

check to see if it is enabled on startup:

sh -x /etc/init.d/ido2db start | grep IDO2DB




Copy the example configuration file into the Icinga configuration directory:

sudo cp /usr/share/doc/icinga-idoutils/examples/idoutils.cfg-sample /etc/icinga/modules/idoutils.cfg

Restart Icinga with:

sudo service icinga restart

Check the logfile (/var/log/icinga/icinga.log) to see if the module has been loaded and connected to IDO2DB:

[1399482608] idomod: IDOMOD 1.10.3 (02-11-2014) Copyright(c) 2005-2008 Ethan Galstad, Copyright(c) 2009-2013 Icinga Development Team (
[1399482608] idomod: Successfully connected to data sink. 0 queued items to flush.
[1399482608] Event broker module 'IDOMOD' version '1.10.3' from '/usr/lib/icinga/' initialized successfully.

Enable External Commands

This may have been enabled during the package installation. To check, do the following:

See if:


exists in /etc/icinga/icinga.cfg

If it is set to 0, change it to 1 as above and do the following:

sudo service icinga stop
sudo dpkg-statoverride --update --add nagios www-data 2710 /var/lib/icinga/rw
sudo dpkg-statoverride --update --add nagios nagios 751 /var/lib/icinga
sudo service icinga start

Classic UI Authentication

Users can be added to access the portal with the following command:

sudo htpasswd /etc/icinga/htpasswd.users <username>


PNP is an addon for the Nagios Network Monitoring System. PNP provides easy to use, easy to configure RRDTools based performance charts feeded by the performance data output of the Nagios Plugins.” –

This document covers installing PNP for Icinga.


  • Icinga running
  • Icinga Classic UI or Icinga Web running


First, ensure the system is up to date with:

sudo apt-get update

Then install the pnp4nagios package:

sudo apt-get install --no-install-recommends pnp4nagios

without –no-install-recommends, icinga will be installed as a dependancy if not already installed. Icinga installation was covered in the previous section.

Enable RRDCached in PNP4Nagios

“rrdcached is a daemon that receives updates to existing RRD files, accumulates them and, if enough have been received or a defined time has passed, writes the updates to the RRD file. A flush command may be used to force writing of values to disk, so that graphing facilities and similar can work with up-to-date data.” –

General purpose – decrease I/O, increase performance.


Install the software with the following command:

sudo apt-get install rrdcached

Now, add it to system init:

sudo update-rc.d rrdcached defaults

RRDCACHED Configuration

Create the cache directory:

sudo mkdir -p /var/cache/rrdcached

Add the nagios user to the www-data group with:

sudo usermod -aG www-data nagios

Now the nagios user account can write to web directories.

Edit the configuration file, /etc/default/rrcached and add the following line:

OPTS="-w 1800 -z 1800 -j /var/cache/rrdcached -s nagios -m 0660 -l unix:/var/run/rrdcached.sock"

Now, restart the service:

sudo service rrdcached restart

PNP4Nagios Configuration for RRDCACHED

Add the following line to /etc/pnp4nagios/process_perfdata.cfg

RRD_DAEMON_OPTS = unix:/var/run/rrdcached.sock

Then modify the following line in /etc/pnp4nagios/config.php

$conf['RRD_DAEMON_OPTS'] = 'unix:/var/run/rrdcached.sock';

Also, change the nagios_base  in config.php to the following:

$conf[‘nagios_base’] = “/cgi-bin/icinga”;

Restart Services

sudo service rrdcached restart


sudo service apache2 restart

Enable PNP4Nagios in Icinga


Add performance data in icinga.cfg. Edit /etc/icinga/icinga.cfg and add the following lines:

# performance data







Add commands to /etc/icinga/commands.cfg:

# pnp4nagios
define command{
        command_name    pnp-bulknpcd-service
        command_line    /bin/mv /var/spool/pnp4nagios/nagios/service-perfdata /var/spool/pnp4nagios/npcd/service-perfdata.$TIMET$

define command{
        command_name    pnp-bulknpcd-host
        command_line    /bin/mv /var/spool/pnp4nagios/nagios/host-perfdata /var/spool/pnp4nagios/npcd/host-perfdata.$TIMET$

Web Configuration

Edit the /etc/apache2/conf-available/pnp4nagios.conf file and change to the following:

        AuthName "Icinga Access"
        AuthType Basic
        AuthUserFile /etc/icinga/htpasswd.users

Then restart apache with service apache2 reload.

Enable NPCD

Edit /etc/default/npcd and edit the fllowin gline to look like:


Then restart the service with:

sudo service npcd start

Integration Into Icinga

Create the file /etc/icinga/objects/pnptemplates.cfg

define host {
        name       pnp-hst
        register   0
        action_url /pnp4nagios/graph?host=$HOSTNAME$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=_HOST_

define service {
        name       pnp-svc
        register   0
        action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=$SERVICEDESC$

Then use them in host and service configurations:

define host{
        name                            generic-host
        use                             pnp-hst

define service{
        name                            generic-service
        use                             pnp-svc

Copy the ssi file to the web UI:

sudo cp /usr/share/doc/pnp4nagios/examples/ssi/status-header.ssi /usr/share/icinga/htdocs/ssi/status-header.ssi
sudo chmod 644 /usr/share/icinga/htdocs/ssi/status-header.ssi

then reload icinga for the changes to take effect:

sudo service icinga reload

Apache2 on Ubuntu 14.04 LTS

I am just poking around the latest LTS from Canonical. It looks like the Apache configs have a new directory hierarchy. There are now conf-available and conf-enabled directories. A small intellectual jump, before looking things up, led me to the command a2enconf. How nice! I wonder if this will complicate things…