Logging with Diamond

“Diamonds never lie to me,

For when love’s gone,

They’ll luster on.”  -Shirley Bassey

If you haven’t heard, Diamond is a fantastic Python daemon that lets you collect system metrics. With Diamond, you can collect metrics like CPU, memory, network, i/o, load and disk usage, all in readable form.

Even better, is that all this data can be sent to Logentries where you can take advantage of our powerful search, alerting, and graphing tools! Now, supporting direct integration has never been simpler to send detailed system metrics.

Want to correlate fatal log errors against your system’s memory usage?

Well now you can.

The image below illustrates the power of Logentries search. With the Diamond integration (see details below) you can now  compute the average CPU usage for this server over the past several hours.



With this sort of structured log data, you can even set-up Anomaly Alerts to help alert when certain values change past a certain threshold, compared to a previous value.

With global dashboards, you can track these values over time, and drill down into usage spikes that you see.


CPU Usage Dashboard

CPU Usage Dashboard

Logging with Diamond and Logentries is easy.

Just follow these steps, and you’ll be logging with Diamond in no time.

To install the Diamond Agent on your system, you will first need to make sure you have the correct dependencies installed. First run the following command to install Diamonds dependencies.

sudo apt-get install make pbuilder python-mock python-configobj python-support cdbs

Next lets download the Diamond project folder.

git clone https://github.com/BrightcoveOS/Diamond.git

Once downloaded, navigate to the folder and run the following command to build our debian image:

make builddeb

The output of this should be located in the created build/ directory.

To install the Diamond Agent we run:

sudo dpkg -i build/diamond_VERSION_NUMBER

Where the version number is the specific version that was built.

We now need to configure the Diamond Agent settings:

sudo cp /etc/diamond/diamond.conf.example /etc/diamond/diamond.conf
sudo gedit /etc/diamond/diamond.conf

Now we need to set our handler to start using the LogentriesHandler

handlers = diamond.handler.logentries_diamond.LogentriesDiamondHandler

In the diamond.conf we want to add the following settings where LOGENTRIES_TOKEN is the log token we copied earlier.


Now start the service to start logging system stats to your  Logentries account.

sudo /etc/init.d/diamond start 
Posted in Business Metrics, How To, Log Analysis, Log dashboards, Log Management, Logentries

Leave a Reply