No Description
Matthias Rampke 10d5064631
Update release build config for prometheus/prometheus#5031
3 days ago
.circleci Update release build config for prometheus/prometheus#5031 3 days ago
e2e Fix e2e test extra printing 5 months ago
vendor Bump prometheus/client_golang to v0.9.2 2 months ago
.dockerignore New release process using docker, circleci and a centralized building tool 3 years ago
.gitignore New release process using docker, circleci and a centralized building tool 3 years ago
.golangci.yml Add .golangci.yml 3 weeks ago
.promu.yml *: bump Go version to 1.12 3 weeks ago
.travis.yml *: bump Go version to 1.12 3 weeks ago
CHANGELOG.md changelog for #85 1 month ago
CONTRIBUTING.md Remove AUTHORS.md reference from CONTRIBUTING.md 2 years ago
Dockerfile Do not run as root by default in Docker 1 month ago
LICENSE Initial commit of the Graphite Exporter. 4 years ago
MAINTAINERS.md Make MR maintainer (#35) 1 year ago
Makefile Make sure a binary is built before the e2e test 5 months ago
Makefile.common makefile: update Makefile.common with newer version 5 days ago
NOTICE Initial commit of the Graphite Exporter. 4 years ago
README.md Fix typo in documentation 1 week ago
VERSION Cut release 0.5.0 2 months ago
go.mod Bump prometheus/client_golang to v0.9.2 2 months ago
go.sum Bump prometheus/client_golang to v0.9.2 2 months ago
main.go fix Prometheus HELP text to be consistent 2 months ago
main_test.go Add missing license header to main_test.go 1 month ago

README.md

Graphite Exporter Build Status

CircleCI Docker Repository on Quay Docker Pulls

An exporter for metrics exported in the Graphite plaintext protocol. It accepts data over both TCP and UDP, and transforms and exposes them for consumption by Prometheus.

This exporter is useful for exporting metrics from existing Graphite setups, as well as for metrics which are not covered by the core Prometheus exporters such as the Node Exporter.

Usage

make
./graphite_exporter

Configure existing monitoring to send Graphite plaintext data to port 9109 on UDP or TCP. As a simple demonstration:

echo "test_tcp 1234 $(date +%s)" | nc localhost 9109
echo "test_udp 1234 $(date +%s)" | nc -u -w1 localhost 9109

Metrics will be available on http://localhost:9108/metrics.

To avoid using unbounded memory, metrics will be garbage collected five minutes after they are last pushed to. This is configurable with the --graphite.sample-expiry flag.

Metric Mapping and Configuration

Please note there has been a breaking change in configuration after version 0.2.0. The YAML style config from statsd_exporter is now used. See conversion instructions below

YAML Config

The graphite_exporter can be configured to translate specific dot-separated graphite metrics into labeled Prometheus metrics via YAML configuration file. This file shares syntax and logic with statsd_exporter. Please follow the statsd_exporter documentation for usage information. However, graphite_exporter does not support all parsing features at this time. Any feature based on the ‘timer_type’ option will not function. Otherwise, regex matching, groups, match/drop behavior, should work as expected.

Metrics that don’t match any mapping in the configuration file are translated into Prometheus metrics without any labels and with names in which every non-alphanumeric character except _ and : is replaced with _.

If you have a very large set of metrics you may want to skip the ones that don’t match the mapping configuration. If that is the case you can force this behaviour using the -graphite.mapping-strict-match flag, and it will only store those metrics you really want.

An example mapping configuration:

mappings:
- match: test.dispatcher.*.*.*
  name: dispatcher_events_total
  labels:
    action: $2
    job: test_dispatcher
    outcome: $3
    processor: $1
- match: '*.signup.*.*'
  name: signup_events_total
  labels:
    job: ${1}_server
    outcome: $3
    provider: $2

This would transform these example graphite metrics into Prometheus metrics as follows:

test.dispatcher.FooProcessor.send.success
 => dispatcher_events_total{processor="FooProcessor", action="send", outcome="success", job="test_dispatcher"}

foo_product.signup.facebook.failure
 => signup_events_total{provider="facebook", outcome="failure", job="foo_product_server"}

test.web-server.foo.bar
 => test_web__server_foo_bar{}

Conversion from legacy configuration

If you have an existing config file using the legacy mapping syntax, you may use statsd-exporter-convert to update to the new YAML based syntax. Here we convert the old example synatx:

$ go get -u github.com/bakins/statsd-exporter-convert

$ cat example.conf
test.dispatcher.*.*.*
name="dispatcher_events_total"
processor="$1"
action="$2"
outcome="$3"
job="test_dispatcher"

*.signup.*.*
name="signup_events_total"
provider="$2"
outcome="$3"
job="${1}_server"

$ statsd-exporter-convert example.conf
mappings:
- match: test.dispatcher.*.*.*
  name: dispatcher_events_total
  labels:
    action: $2
    job: test_dispatcher
    outcome: $3
    processor: $1
- match: '*.signup.*.*'
  name: signup_events_total
  labels:
    job: ${1}_server
    outcome: $3
    provider: $2
````

## Using Docker

You can deploy this exporter using the [prom/graphite-exporter][hub] Docker image.

For example:

```bash
docker pull prom/graphite-exporter

docker run -d -p 9108:9108 -p 9109:9109 -p 9109:9109/udp \
        -v ${PWD}/graphite_mapping.conf:/tmp/graphite_mapping.conf \
        prom/graphite-exporter --graphite.mapping-config=/tmp/graphite_mapping.conf