Coder Social home page Coder Social logo

pleasingfungus / shadow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cespare/shadow

0.0 1.0 0.0 396 KB

Expose Graphite metrics with an HTTP API

License: MIT License

Makefile 0.25% Go 86.90% Vim Script 0.03% HTML 3.33% CoffeeScript 4.98% CSS 4.51%

shadow's Introduction

Shadow

Shadow is a small HTTP API to expose your Graphite metrics in a monitorable HTTP format.

Shadow is inspired by Umpire.

Installation

Build from source with the Go tool:

$ go get github.com/cespare/shadow

Usage

Edit the configuration file, then start it up:

$ ./shadow -conf path/to/conf.toml

Shadow responds to queries at /check. The check properties are given in query-string parameters.

  • metric: The graphite metric key. Can be a query that returns multiple keys (e.g., using *, [...], or {...}).
  • range: How far back in the past to consider. The syntax is Go's time.Duration (see the time.ParseDuration documentation for the details). Examples: 30s, 5m, 1h.
  • limit: A comma-separated list of comparisons between an absolute value and an aggregator term. The possible comparators are <, <=, =, >=, and >. The possible aggregator terms are avg, min, max, and sum. Example: limit=min>500,avg>1000,avg<2000.
  • group_limit: This is like limit, except the possible aggregators are count and fraction. group_limit must be given when the target metric returns multiple values. This defines the limits on the number/fraction of successful targets needed for a successful check. Example: group_limit=count>5. There are two aliases, any and all, which can be used instead (e.g., group_limit=all).
  • include_empty_targets: This parameter controls whether Shadow considers targets that come back without any non-null datapoints.

Shadow has a health check that lives at /healthz. This also checks that Graphite is up as part of its health check.

Web UI

Shadow query strings can get somewhat hard to read, especially with all the url character escaping and when you have complex Graphite queries. So, Shadow includes a little web page that helps you construct the query strings. Just go to the root URL (for example, http://localhost:2050). (Note that for Shadow to find its HTML/CSS/JS assets, it must be run from the repository root.)

screenshot

Examples

Suppose you log your web server's requests at web-1.requests.{count,rate}. You can make sure your mean qps doesn't fall below 300 for any 5-minute window:

/check?metric=web-1.requests.rate&range=5m&limit=avg>300

Perhaps you also want to know if the load spikes above 2000 so you can spin up more workers:

/check?metric=web-1.requests.rate&range=5m&limit=avg>300,avg<2000

You have multiple servers, and you want to ensure that none of them have out-of-whack qps:

/check?metric=web-*.requests.rate&range=5m&limit=avg>300,avg<2000&group_limit=all

You're using gost and you want to alert when one of your servers is overloaded:

/check?metric=backend-*.gost.os_stats.load_avg_15.gauge&range=1m&limit=max<0.7&group_limit=all

You have a massive HDFS cluster and you want to know when more than 10% of the machines are running low on disk space:

/check?metric=hdfs-*.gost.os_stats.disk_usage.root_volume.gauge&range=5m&limit=max<0.9&group_limit=fraction>0.9

Advantages over Umpire

  • Handy web UI for constructing queries
  • Easier to deploy (Go vs. Ruby)
  • More thorough error messages
  • Supports group limits
  • Richer bounding functionality

shadow's People

Contributors

cespare avatar dmac avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.