Updated 8/5 to use systemd unit file.

Recently decided to move my blog to containers and CoreOS for learning and fun. While setting up an HAProxy container on one of my CoreOS hosts I thought about how I would monitor the host. Luckily, smart people have already thought about this. :)

I use Rackpace’s Cloud Monitoring and agent which can be setup on any server in any datacenter or cloud provider. Rackspace hosted servers get a nice GUI and awesome dashboard for the checks and monitoring data, but you could still set it all up on a non Rackspace hosted server using the Cloud Monitoring API and raxmon.

The goods: https://github.com/jayofdoom/rackspace-monitoring-agent-coreos

Next you’ll register the agent so that it can interact with the control panel.

Enter your username and API key. If this is the first time setting up Cloud Monitoring on this server choose Create New Token. Next choose the entitiy, this is usually 1., but choose the option which matches your servers hostname and IP. If it’s a non Rackspace hosted server you’ll have to create a new entity and access the data from the API.

We can use the systemd unit file included in the repo to start the monitoring agent. When you registered the agent it should have created /etc/rackspace-monitoring-agent.cfg with some data Cloud Monitoring needs. We’ll move this file to a location in the directory structure systemd-nspawn creates.

I had to edit the systemd unit file to start the agent with the config file we just moved. Open the rackspace-monitoring-agent.service to edit. Notice I added the -c /etc/rackspace-monitoring-agent.conf.d/rackspace-monitoring-agent.cfg to starting the agent.

Now we’ll copy the unit file and start it up.

From your control panel you should see your real time values, and monitoring data at the dashboard. A few examples.

coreos2

coreos1

This is just an example, as you probably know CoreOS is changing frequently so this solution could change at any time.