thenayr / dashing-newrelic

Open source New Relic widgets for the Dashing framework
MIT License
31 stars 5 forks source link

Customisable New Relic widgets for Dashing

Description

This is a suite of widgets to help monitor your web applications performance using New Relic. There are four included widgets but you can easily add new widgets for any metric returned by the New Relic API.

The widgets are all designed for maximum visibility from a distance. All the widgets contain a maximum of 60 points of data at any given time. The chart will start on the right of the chart and fill over time to be the full width of the widget. Historical data stored by dashing will be used if available.

Neutral colours are used for behaving values, and high contrast yellow and red for warning and errors respectively. The widgets are responsive and react to changes in the values returned. There are three possible colors, neutral (green), yellow and red.

Dependencies

The following gems are required:

Place them inside the Dashing Gemfile:

## Gemfile
gem 'newrelic_api'
gem 'activeresource'

Then bundle install

Using the New Relic widgets

These widgets are designed for quick and easy usage. First copy the widget, assets, job, and lib folders into place. The assets folder contains a background image for the widgets.

Now copy over the config.yml into the root directory of your Dashing application. Be sure to replace the following options inside of the config file with your own New Relic information:

:newrelic:
  :api_key: "xxxxxxxxxxxxxxx"
  :app_name: 'Your App Name'

IMPORTANT If your app name has any special characters in it, you will need to escape them in the name. For example: 'My app \(production\)'

These config options get loaded in each of the separate job files.

Now you only need to add the widgets into your dashboard:

Customize responsive (color changing) widgets

You can customise the thresholds for the point at which the widgets change colours. This is done by changing the data-green and data-yellow attributes of the HTML you added to the dashboard above.

Any value between data-green and data-yellow will be yellow. If data-green is larger than data-yellow, then anything above data-green will be green, and anything below data-yellow will be red, and vice-versa.

Adding more widgets

You can easily add new widgets using any value returned by the New Relic API. Follow this example to add a 'CPU' widget:

Metrics available from API

As of 5 July 2014, the following metrics are available from the API on the free usage tier (take care to maintain spaces/capitalisation/etc):