• Stars
    star
    297
  • Rank 140,075 (Top 3 %)
  • Language
    Ruby
  • License
    Other
  • Created over 12 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

HTTP service for submitting metrics to Graphite

Backstop

Build Status

Backstop is a simple endpoint for submitting metrics to Graphite. It accepts JSON data via HTTP POST and proxies the data to one or more Carbon/Graphite listeners.

Usage

Collectd Metrics

Backstop supports submission of metrics via the Collectd write_http output plugin. A sample client configuration:

<Plugin write_http>
  <URL "https://backstop.example.com/collectd">
    Format "JSON"
    User ""
    Password ""
  </URL>
</Plugin>

GitHub Post-Receive Hooks

Backstop can receive commit data from GitHub post-receive webhooks. Your WebHook URL should consist of the Backstop service URL with the /github endpoint. For example, https://backstop.example.com/github.

All GitHub commit metrics contain the project name, branch information, author email and commit identifier, and are stored with a value of 1. These can then be visualized as annotation-style metrics using Graphite's drawAsInfinite() function. Sample metric:

github.project.refs.heads.master.bob-example-com.10af2cb02eadd4cb1a3e43aa9cae47ef2cd07016 1 1203116237

PagerDuty Incident Webhooks

Backstop can also receive PagerDuty incidents courtesy of Jesse Newland's pagerduty-incident-webhooks project. When deploying pagerduty-incident-webhooks make sure to set PAGERDUTY_WEBHOOK_ENDPOINT to your Backstop service URL with the /pagerduty endpoint. For example, https://backstop.example.com/pagerduty.

Metrics will be stored under the alerts prefix with a value of 1. These can then be visualized as annotation-style metrics using Graphite's drawAsInfinite() function. Sample metric:

alerts.nagios.web1.diskspace 1 1365206103

Custom Metrics

Use the /publish endpoint in conjunction with one of the approved PREFIXES for submitting metrics to Backstop. In most environments it makes sense to use distinct prefixes for normal (e.g. gauge, counters, etc) metrics vs annotation (event-style) metrics. PREFIXES is defined as a comma-delimited list of prefix strings. For example:

export PREFIXES='test,app1,app2'

Sending Metrics

Here is a basic example for posting an application metric to the custom prefix.

RestClient.post("https://backstop.example.com/publish/custom",
   [{:metric => key, :value => value, :measure_time => Time.now.to_i}].to_json)

Sending Annotations

Here is an example for posting a software release announcement to the note prefix.

RestClient.post("https://backstop.example.com/publish/note",
   [{:metric => "foobar.release", :value => "v214", :measure_time => Time.now.to_i}].to_json)

Using with Hosted Graphite

Graphite hosting service Hosted Graphite requires metrics to be submitted with an API key prepended to the metric. To use their service, just define the API_KEY environment variable.

Deployment

Backstop supports optional Basic Authentication through Rack::Auth::Basic. Simply set BACKSTOP_AUTH to your colon-delimited credentials (e.g. user:pass). Multiple credentials can be set, as long as they are comma-separated (e.g user1:pass1,user2:pass2).

The CARBON_URLS variable must be set to one or more valid destinations. Examples:

export CARBON_URLS="carbon://10.10.10.10:2003,carbon://10.10.20.10:2003"

Local

The following instructions assume a working Ruby installation with the bundler gem already installed on your system.

$ git clone https://github.com/obfuscurity/backstop.git
$ cd backstop
$ bundle install
$ export CARBON_URLS=...
$ export PREFIXES=...
$ export BACKSTOP_AUTH=... (optional)
$ foreman start

Heroku

$ heroku create
$ heroku config:add CARBON_URLS=...
$ heroku config:add PREFIXES=...
$ heroku config:add BACKSTOP_AUTH=... (optional)
$ git push heroku master

License

Backstop is distributed under a 3-clause BSD license.

Thanks

Thanks to Michael Gorsuch (@gorsuch) for his work on the collectd parser and the "Mitt" application that preceded Backstop.

More Repositories

1

tasseo

Live dashboard for Graphite
JavaScript
1,527
star
2

descartes

Introspective dashboard for Graphite
JavaScript
502
star
3

synthesize

Easy installer for Graphite and StatsD
Python
384
star
4

dusk

Hotspot dashboard for Graphite
JavaScript
190
star
5

mater

Status Board to Graphite bridge
Ruby
83
star
6

therry

Simple service for searching Graphite metrics
Ruby
56
star
7

ledbetter

Script that scrapes alert statistics from Nagios and reports them to Graphite
Ruby
52
star
8

food-recipes

Honest-to-goodness "real food" recipes
Elixir
51
star
9

graphite-scripts

Scripts that gather and submit data to Graphite/Carbon
Shell
48
star
10

nagios-scripts

Custom scripts written for Nagios
Perl
38
star
11

evenflow

sFlow to Graphite bridge
Ruby
32
star
12

lipstick

Dashboard for unifying Nagios data across multiple sites
Ruby
29
star
13

judy

Bespoke service for reviewing CFP submissions
HTML
25
star
14

fortune-rants

Rants from your favorite online personalities.
18
star
15

arigato

Migrate your Graphite metrics to Librato Metrics
Python
9
star
16

heroku-static-site

Example for creating a barebones static site on Heroku
PHP
6
star
17

netflowdashboard

NetFlow Dashboard for real-time analysis of network traffic.
Perl
6
star
18

blogsum

Blog application written with a focus on simplicity and security.
Perl
5
star
19

slack-catbot

Slack bot for the The Cat API
Ruby
4
star
20

vellup

User Authorization as a Service
Ruby
4
star
21

undeadly-ruby

Next generation of the OpenBSD Journal website (Ruby version)
Ruby
2
star
22

undeadly-perl

Next generation of the OpenBSD Journal website
Perl
2
star
23

undeadly

Next generation of the OpenBSD Journal website
JavaScript
2
star
24

hatchet

PF firewall log parser
JavaScript
1
star
25

skynet

Ruby
1
star