simple monitoring solution with grafana, go-carbon and carbonapi
This commit is contained in:
parent
759f971612
commit
68f29949a4
|
@ -0,0 +1,3 @@
|
||||||
|
logs/
|
||||||
|
whisper/
|
||||||
|
grafana/
|
|
@ -0,0 +1,21 @@
|
||||||
|
FROM golang:1.8-alpine
|
||||||
|
|
||||||
|
RUN mkdir -p /go/src
|
||||||
|
|
||||||
|
ADD https://github.com/dgryski/carbonapi/archive/master.zip /tmp/master.zip
|
||||||
|
|
||||||
|
# build carbonapi
|
||||||
|
RUN set -x \
|
||||||
|
&& apk add --update git \
|
||||||
|
&& cd /go/src \
|
||||||
|
&& unzip /tmp/master.zip \
|
||||||
|
&& mv /go/src/carbonapi-master /go/src/carbonapi \
|
||||||
|
&& cd /go/src/carbonapi \
|
||||||
|
&& go-wrapper download \
|
||||||
|
&& go-wrapper install \
|
||||||
|
&& apk del git \
|
||||||
|
&& rm -f /tmp/master.zip \
|
||||||
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
ENTRYPOINT [ "/go/bin/carbonapi" ]
|
|
@ -0,0 +1,74 @@
|
||||||
|
[common]
|
||||||
|
user = ""
|
||||||
|
graph-prefix = "carbon.agents.{host}"
|
||||||
|
metric-endpoint = "local"
|
||||||
|
max-cpu = 2
|
||||||
|
metric-interval = "1m0s"
|
||||||
|
|
||||||
|
[whisper]
|
||||||
|
data-dir = "/data/graphite/whisper/"
|
||||||
|
schemas-file = "/etc/go-carbon/storage-schemas.conf"
|
||||||
|
aggregation-file = ""
|
||||||
|
workers = 2
|
||||||
|
max-updates-per-second = 0
|
||||||
|
sparse-create = false
|
||||||
|
enabled = true
|
||||||
|
|
||||||
|
[cache]
|
||||||
|
max-size = 1000000
|
||||||
|
write-strategy = "max"
|
||||||
|
|
||||||
|
[udp]
|
||||||
|
listen = ":2003"
|
||||||
|
enabled = true
|
||||||
|
log-incomplete = false
|
||||||
|
buffer-size = 0
|
||||||
|
|
||||||
|
[tcp]
|
||||||
|
listen = ":2003"
|
||||||
|
enabled = true
|
||||||
|
buffer-size = 0
|
||||||
|
|
||||||
|
[pickle]
|
||||||
|
listen = ":2004"
|
||||||
|
max-message-size = 67108864
|
||||||
|
enabled = true
|
||||||
|
buffer-size = 0
|
||||||
|
|
||||||
|
[carbonlink]
|
||||||
|
listen = ":7002"
|
||||||
|
enabled = true
|
||||||
|
read-timeout = "30s"
|
||||||
|
|
||||||
|
[carbonserver]
|
||||||
|
listen = ":8080"
|
||||||
|
enabled = true
|
||||||
|
query-cache-enabled = true
|
||||||
|
query-cache-size-mb = 0
|
||||||
|
find-cache-enabled = true
|
||||||
|
buckets = 10
|
||||||
|
max-globs = 100
|
||||||
|
metrics-as-counters = false
|
||||||
|
read-timeout = "1m0s"
|
||||||
|
idle-timeout = "1m0s"
|
||||||
|
write-timeout = "1m0s"
|
||||||
|
scan-frequency = "5m0s"
|
||||||
|
|
||||||
|
[dump]
|
||||||
|
enabled = false
|
||||||
|
path = ""
|
||||||
|
restore-per-second = 0
|
||||||
|
|
||||||
|
[pprof]
|
||||||
|
listen = "localhost:7007"
|
||||||
|
enabled = false
|
||||||
|
|
||||||
|
[[logging]]
|
||||||
|
logger = ""
|
||||||
|
file = ""
|
||||||
|
level = "info"
|
||||||
|
encoding = "mixed"
|
||||||
|
encoding-time = "iso8601"
|
||||||
|
encoding-duration = "seconds"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
[min]
|
||||||
|
pattern = \.lower$
|
||||||
|
xFilesFactor = 0.1
|
||||||
|
aggregationMethod = min
|
||||||
|
|
||||||
|
[max]
|
||||||
|
pattern = \.upper(_\d+)?$
|
||||||
|
xFilesFactor = 0.1
|
||||||
|
aggregationMethod = max
|
||||||
|
|
||||||
|
[sum]
|
||||||
|
pattern = \.sum$
|
||||||
|
xFilesFactor = 0
|
||||||
|
aggregationMethod = sum
|
||||||
|
|
||||||
|
[count]
|
||||||
|
pattern = \.count$
|
||||||
|
xFilesFactor = 0
|
||||||
|
aggregationMethod = sum
|
||||||
|
|
||||||
|
[count_legacy]
|
||||||
|
pattern = ^stats_counts.*
|
||||||
|
xFilesFactor = 0
|
||||||
|
aggregationMethod = sum
|
||||||
|
|
||||||
|
[default_average]
|
||||||
|
pattern = .*
|
||||||
|
xFilesFactor = 0.3
|
||||||
|
aggregationMethod = average
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Documentation
|
||||||
|
# http://graphite.readthedocs.io/en/latest/config-carbon.html#storage-schemas-conf
|
||||||
|
|
||||||
|
# Carbon metrics are kept for 30 days in resolution of 10 seconds.
|
||||||
|
[carbon]
|
||||||
|
pattern = ^carbon\.
|
||||||
|
retentions = 10s:30d
|
||||||
|
|
||||||
|
# User metrics are kept for:
|
||||||
|
# 24 hours in resolution of 5 seconds
|
||||||
|
# 30 days in resolution of 1 minute
|
||||||
|
# 1 year in resolution of 5 minutes
|
||||||
|
[user]
|
||||||
|
pattern = .*
|
||||||
|
retentions = 5s:24h,1m:30d,5m:1y
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
go-carbon:
|
||||||
|
image: go-carbon
|
||||||
|
build:
|
||||||
|
context: ./go-carbon
|
||||||
|
hostname: go-carbon
|
||||||
|
container_name: go-carbon
|
||||||
|
command: -config=/etc/go-carbon/go-carbon.conf
|
||||||
|
volumes:
|
||||||
|
- ./configs:/etc/go-carbon
|
||||||
|
- ./whisper:/data/graphite/whisper/
|
||||||
|
|
||||||
|
carbonapi:
|
||||||
|
image: carbonapi
|
||||||
|
build:
|
||||||
|
context: ./carbonapi
|
||||||
|
hostname: carbonapi
|
||||||
|
container_name: carbonapi
|
||||||
|
command: -z=http://go-carbon:8080 -graphite=go-carbon:2003 -stdout
|
||||||
|
depends_on:
|
||||||
|
- go-carbon
|
||||||
|
|
||||||
|
grafana:
|
||||||
|
image: grafana/grafana
|
||||||
|
hostname: grafana
|
||||||
|
container_name: grafana
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
environment:
|
||||||
|
- GF_SECURITY_ADMIN_PASSWORD=admin
|
||||||
|
volumes:
|
||||||
|
- ./grafana:/var/lib/grafana
|
||||||
|
- ./logs:/var/log/grafana
|
||||||
|
depends_on:
|
||||||
|
- carbonapi
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
FROM golang:1.8-alpine
|
||||||
|
|
||||||
|
RUN mkdir -p /tmp/go-carbon
|
||||||
|
|
||||||
|
ENV GOPATH /tmp/go-carbon/_vendor
|
||||||
|
|
||||||
|
# build carbonapi
|
||||||
|
RUN set -x \
|
||||||
|
&& cd /tmp/go-carbon \
|
||||||
|
&& apk add --update git \
|
||||||
|
&& git clone https://github.com/lomik/go-carbon.git --depth=1 . \
|
||||||
|
&& git submodule init \
|
||||||
|
&& git submodule update --recursive \
|
||||||
|
&& go build github.com/lomik/go-carbon \
|
||||||
|
&& mv go-carbon /sbin/ \
|
||||||
|
&& cd / \
|
||||||
|
&& apk del git \
|
||||||
|
&& rm -f /tmp/$VERSION.zip \
|
||||||
|
&& rm -rf /tmp/go-carbon \
|
||||||
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
|
||||||
|
EXPOSE 2003 2004 7002 7007 2003/udp
|
||||||
|
ENTRYPOINT [ "/sbin/go-carbon" ]
|
Loading…
Reference in New Issue