Giter Club home page Giter Club logo

gocarbon-gostatsd-grafana-docker's Introduction

go-carbon, gostatsd, grafana with docker-compose

What is this about?

This repository provides docker-compose file for collection and a combination of metric tools including grafana, go-carbon, carbonapi and gostatsd (go version of graphite and statsd). Contributions are very welcome! Feel free to create a pull request or issue about how to improve it.

Components

component link version license
gocarbon https://github.com/go-graphite/go-carbon 0.16.2 MIT
carbonapi https://github.com/go-graphite/carbonapi 0.15.6 MIT
gostatsd https://github.com/atlassian/gostatsd 35.1.0 MIT
grafana https://github.com/grafana/grafana latest GNU Affero GPL v3.0

Architecture

┌───────────────────────┐
│                       │
│                       │
│                       │
│    grafana            │
│    public port 3000   │
│    web interface      │
│                       │
│                       │               ┌─────────────────────┐
│                       ├─────────────► │                     │
└───────────────────────┘ requests      │                     │
                                        │                     │
                                        │    carbonapi        │
                                        │    private port 8081│
                                        │    carbon api       │
┌───────────────────────┐               │                     │
│                       │               │                     │
│                       │ ◄─────────────┤                     │
│                       │  requests     └─────────────────────┘
│    gocarbon           │
│    public port 2003   │
│    carbon receiver    │
│    metric storage     │
│                       │
│                       │
└───────────────────────┘
                  ▲
                  │
            sends │
                  │
┌─────────────────┴─────┐
│                       │
│                       │
│                       │
│    gostatsd           │
│    public port 8125   │
│    statsd receiver    │
│    aggregate and send │
│                       │
│                       │
└───────────────────────┘

Configuration and storage behaviour

The configuration files come with sensible defaults and are pre-configured for running components together, which they're battle-tested on production since 2019.

go-carbon and gostatsd were configured to store and aggregate the metrics with 10 seconds precision. You can change the frequency and history behaviour by configuring storage-schemas.conf file under the config/carbon directory.

Let's take a look at the existing configuration:

# storage-schemas.conf
10s:4d,1m:30d,1h:1y,1d:5y

This means 10 seconds for 4 days, 1 minute for 30 days, 1 hour for 1 year and 1 day for 5 years resulting in 1.01 Megabytes per metric (The first two high-precision archive takes up most of the space). If you're planning to use a different configuration, you can use whisper calculator to calculate how much disk size will be used by carbon. Also, graphite documentation has good tips about how to define retention rates in the right way.

Keep in mind that

  • Changing this file will not affect already-created .wsp files.
  • Carbon implements a fixed-size database. This means time-slots within an archive take up space whether or not a value is stored.

If you're planning to use a different precision rather than 10 seconds, you also have to change the following configuration in the gostatsd.toml file under the config/gostatsd directory.

# gostatsd.toml
flush-interval='10s'

Running

Run the following command to kick the containers

docker compose up -d

Adding the new datasource in grafana

  • Login to grafana (port 3000)
  • Go to Configuration > Data sources
  • Add a new graphite Datasource with the following configuration
  • Save & test

HA ideas

This setup is not designed to be highly available. The possible improvements can be:

  • Adding carbon-c-relay or carbon-relay-ng to the front of the gocarbon(s).
  • gostatsd can be configured as a forwarder for running in front of the gostatsd(s).
  • gocarbon supports receiving metrics from kafka and google pubsub.
  • carbon-clickhouse

gocarbon-gostatsd-grafana-docker's People

Contributors

o avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

11eleven61

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.