• This repository has been archived on 19/Jan/2022
  • Stars
    star
    501
  • Rank 86,063 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 12 years ago
  • Updated over 2 years ago

Reviews

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

Repository Details

Introspective dashboard for Graphite

Descartes

Build Status

dashboard

Purpose

Provide an additional level of insight and collaboration that is neither available nor appropriate for a real-time utility such as Tasseo.

Objectives

Design, build and deploy a dashboard that allows users to correlate multiple metrics in a single chart, review long-term trends across one or more charts, and to collaborate with other users through a combination of annotations and related comment threads. This product should be capable of the following sample tasks:

  • Display complex charts (2+ disparate metrics including transformations)
  • Group related charts into a single view
  • Timeshift charts within the same view
  • Import existing graphs from external sources (e.g. Graphite API)
  • Modify graphs using native interface tooling (i.e. users should not have to use Graphite Composer to make changes)
  • Create new graphs using native interface tooling
  • Add notes (annotations) to charts
  • Add comments associated with specific annotations

Deployment

Descartes stores configuration data in PostgreSQL and Google OpenID state in Redis. It is assumed you have local PostgreSQL and Redis servers running for local development.

Service Dependencies

  • PostgreSQL
  • Redis

Options

  • METRICS_UPDATE_INTERVAL - How frequently to update the list of known metrics from the remote Graphite server. The more often you add new metrics, the lower this value should be. A reasonable default for most installations would be 1h (time strings as understood by Rufus scheduler). If users complain that they don't see new metrics, it means that it hasn't synced since a new metric has been added. You can simply restart Descartes, and optionally lower this value to suit your users' patience threshold, to manually update the metrics list.

  • METRICS_UPDATE_ON_BOOT - Determines whether the list of known metrics should attempt to be loaded from the remote Graphite server at startup. Large metric stores can cause a significant delay here, so some users may wish to disable by setting false here.

  • METRICS_UPDATE_TIMEOUT - The timeout value for downloading the metrics list. Defaults to 300 seconds.

  • USE_SVG - When set to true, will cause Descartes to load SVG output from Graphite instead of the default PNG output. In the future SVG will become the default format, but there is currently a bug in stable Graphite (0.9.10 as of this writing) which causes SVG rendering to fail whenever secondYAxis is enabled on any target in a graph.

  • GRAPH_TEMPLATE - Specify the Graphite graph template to use when rendering graphs.

Sessions and Authorization

The default session cookie should be randomized by setting SESSION_SECRET to a random string.

If your Graphite web server requires Basic Authentication, these credentials can be set using the GRAPHITE_USER and GRAPHITE_PASS environment variables.

Descartes provides organizational authorization using either Google OpenID or GitHub OAuth. The OAUTH_PROVIDER environment variable can be set to either google or github to determine which type to use.

Based on OAUTH_PROVIDER, some additional environment variables must be set:

Google OpenID

  • GOOGLE_OAUTH_DOMAIN

GitHub OAuth

A new GitHub application will need to be registered. The Main and Callback URLs should be the URL of your application.

  • GITHUB_CLIENT_ID
  • GITHUB_CLIENT_SECRET
  • GITHUB_ORG_ID (The name of your organization)

Important: Don't forget to go over to your organization's member page and set yourself as a public member. This can be found at https://github.com/YOUR-ORG?tab=members (replace YOUR-ORG with your actual organization name). Once there, ensure that the button says "Conceal membership". If that's the button you see this means you're already public, otherwise click "Publicize membership".

Graphite Server Configuration

In order to support CORS with JSON instead of JSONP, we need to allow specific headers and allow the cross-domain origin request. The base URL of your Descartes application will need to be allowed as an origin. The following example is suitable for a test Descartes application running on localhost connecting to a remote Graphite/Apache 2.x server. Adjust as necessary for your environment or webserver.

Header set Access-Control-Allow-Origin "http://127.0.0.1:5000"
Header set Access-Control-Allow-Methods "GET, OPTIONS"
Header set Access-Control-Allow-Headers "origin, authorization, accept"
Header set Access-Control-Allow-Credentials true

If your Graphite composer is protected by basic authentication, you have to ensure that the HTTP verb OPTIONS is allowed unauthenticated. This looks like the following for Apache:

<Location />
    AuthName "graphs restricted"
    AuthType Basic
    AuthUserFile /etc/apache2/htpasswd
    <LimitExcept OPTIONS>
      require valid-user
    </LimitExcept>
</Location>

See http://blog.rogeriopvl.com/archives/nginx-and-the-http-options-method/ for an Nginx example.

Local

Descartes uses the Sinatra web framework under Ruby 1.9. Anyone wishing to run Descartes as a local service should be familiar with common Ruby packaging and dependency management utilities such as RVM and Bundler. If you are installing a new Ruby version with RVM, make sure that you have the appropriate OpenSSL development libraries installed before compiling Ruby.

All environment variables can be set from the command-line, although it's suggested to use .env instead. This file will automatically be picked up by foreman, which is also helpful when debugging (e.g. foreman run pry). This file will not be committed (unless you remove or modify .gitignore) so you shouldn't have to worry about accidentally leaking credentials.

$ rvm use 1.9.2
$ bundle install
$ createdb descartes
$ cp .env.example .env
$ $EDITOR .env
$ bundle exec rake db:migrate:up
$ foreman start
$ open http://127.0.0.1:5000

Heroku - The Old Way

$ export DEPLOY=production/staging/you
$ heroku create -r $DEPLOY -s cedar
$ heroku addons:add redistogo -r $DEPLOY
$ heroku addons:add heroku-postgresql:dev -r $DEPLOY
$ heroku config:set -r $DEPLOY OAUTH_PROVIDER=...
$ heroku config:set -r $DEPLOY <auth provider tokens>=...
$ heroku config:set -r $DEPLOY GRAPHITE_URL=...
$ heroku config:set -r $DEPLOY METRICS_UPDATE_INTERVAL=1h
$ heroku config:set -r $DEPLOY SESSION_SECRET...
$ heroku config:set -r $DEPLOY RAKE_ENV=production
$ git push $DEPLOY master
$ heroku run -r $DEPLOY bundle exec rake db:migrate:up
$ heroku scale -r $DEPLOY web=1
$ heroku open -r $DEPLOY

Heroku - The Easy Way

Deploy

Upgrades

Upgrades are typically performed by updating your in-place copy of the Descartes checkout. If you are using a third-party package, please refer to their upgrade documentation.

Migrations

Database upgrades (or downgrades) should use the built-in rake migration targets. For upgrading to the newest version in your development or non-Heroku production environment:

$ bundle exec rake db:migrate:up

If for some reason you need to downgrade to a previous migration target, make sure to set the VERSION number:

$ bundle exec VERSION=3 rake db:migrate:to

If you're running on Heroku, simply prefix the aforementioned commands with heroku run (and any other relevant options).

License

Descartes is distributed under the MIT license. Third-party software libraries included with this project are distributed under their respective licenses.

More Repositories

1

tasseo

Live dashboard for Graphite
JavaScript
1,528
star
2

synthesize

Easy installer for Graphite and StatsD
Python
384
star
3

backstop

HTTP service for submitting metrics to Graphite
Ruby
296
star
4

dusk

Hotspot dashboard for Graphite
JavaScript
191
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
49
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
31
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

slack-catbot

Slack bot for the The Cat API
Ruby
4
star
19

vellup

User Authorization as a Service
Ruby
4
star
20

blogsum

Blog application written with a focus on simplicity and security.
Perl
4
star
21

undeadly-ruby

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

undeadly

Next generation of the OpenBSD Journal website
JavaScript
2
star
23

undeadly-perl

Next generation of the OpenBSD Journal website
Perl
2
star
24

hatchet

PF firewall log parser
JavaScript
1
star
25

skynet

Ruby
1
star