Skip to content

Commit b08405c

Browse files
committed
Upgrade grafana and improve the default configuration, details:
- Upgrade to Grafana 1.6.1. - Make sure we are using StatsD v0.7.1 and not whatever is in master. - Ensure that the flushInterval in StatsD matches the retention period expected by Graphite. - Add aggregation policies to ensure that max, mins and counts are properly aggregated. - Track 50, 75, 90, 95, 98, 99, 99.9, 99.99 and 99.999 percentiles in StatsD.
1 parent 1b0d8ee commit b08405c

File tree

6 files changed

+95
-55
lines changed

6 files changed

+95
-55
lines changed

Dockerfile

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from ubuntu
2-
run echo 'deb http://us.archive.ubuntu.com/ubuntu/ precise universe' >> /etc/apt/sources.list
1+
from ubuntu:14.04
2+
run echo 'deb http://us.archive.ubuntu.com/ubuntu/ trusty universe' >> /etc/apt/sources.list
33
run apt-get -y update
44
run apt-get -y upgrade
55

@@ -8,7 +8,7 @@ run apt-get -y upgrade
88
# Installation #
99
# ---------------- #
1010

11-
# Install all prerequisites
11+
# Install all prerequisites
1212
run apt-get -y install software-properties-common
1313
run add-apt-repository -y ppa:chris-lea/node.js
1414
run apt-get -y update
@@ -21,7 +21,7 @@ run cd ~ && wget https://download.elasticsearch.org/elasticsearch/elasticsea
2121
run cd ~ && dpkg -i elasticsearch-1.1.1.deb && rm elasticsearch-1.1.1.deb
2222

2323
# Install StatsD
24-
run mkdir /src && git clone https://github.com/etsy/statsd.git /src/statsd
24+
run mkdir /src && git clone https://github.com/etsy/statsd.git /src/statsd && cd /src/statsd && git checkout v0.7.1
2525

2626
# Install Whisper, Carbon and Graphite-Web
2727
run pip install Twisted==11.1.0
@@ -32,8 +32,8 @@ run pip install --install-option="--prefix=/var/lib/graphite" --install-opti
3232

3333
# Install Grafana
3434
run mkdir /src/grafana && cd /src/grafana &&\
35-
wget http://grafanarel.s3.amazonaws.com/grafana-1.5.3.tar.gz &&\
36-
tar xzvf grafana-1.5.3.tar.gz --strip-components=1 && rm grafana-1.5.3.tar.gz
35+
wget http://grafanarel.s3.amazonaws.com/grafana-1.6.1.tar.gz &&\
36+
tar xzvf grafana-1.6.1.tar.gz --strip-components=1 && rm grafana-1.6.1.tar.gz
3737

3838

3939
# ----------------- #
@@ -53,6 +53,7 @@ add ./graphite/initial_data.json /var/lib/graphite/webapp/graphite/initial_d
5353
add ./graphite/local_settings.py /var/lib/graphite/webapp/graphite/local_settings.py
5454
add ./graphite/carbon.conf /var/lib/graphite/conf/carbon.conf
5555
add ./graphite/storage-schemas.conf /var/lib/graphite/conf/storage-schemas.conf
56+
add ./graphite/storage-aggregation.conf /var/lib/graphite/conf/storage-aggregation.conf
5657
run mkdir -p /var/lib/graphite/storage/whisper
5758
run touch /var/lib/graphite/storage/graphite.db /var/lib/graphite/storage/index
5859
run chown -R www-data /var/lib/graphite/storage
@@ -62,7 +63,7 @@ run cd /var/lib/graphite/webapp/graphite && python manage.py syncdb --noinpu
6263

6364
# Configure Grafana
6465
add ./grafana/config.js /src/grafana/config.js
65-
add ./grafana/scripted.json /src/grafana/app/dashboards/default.json
66+
#add ./grafana/scripted.json /src/grafana/app/dashboards/default.json
6667

6768
# Configure nginx and supervisord
6869
add ./nginx/nginx.conf /etc/nginx/nginx.conf
@@ -89,4 +90,4 @@ expose 8126
8990
# Run! #
9091
# -------- #
9192

92-
cmd ["/usr/bin/supervisord"]
93+
cmd ["/usr/bin/supervisord"]

grafana/config.js

+46-40
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,57 @@
1-
/** @scratch /configuration/config.js/1
2-
* == Configuration
3-
* config.js is where you will find the core Grafana configuration. This file contains parameter that
4-
* must be set before kibana is run for the first time.
5-
*/
1+
///// @scratch /configuration/config.js/1
2+
// == Configuration
3+
// config.js is where you will find the core Grafana configuration. This file contains parameter that
4+
// must be set before Grafana is run for the first time.
5+
///
66
define(['settings'],
77
function (Settings) {
88

9-
return new Settings({
109

11-
/**
12-
* elasticsearch url:
13-
* For Basic authentication use: http://username:[email protected]:9200
14-
*/
15-
elasticsearch: "/elasticsearch",
16-
17-
/**
18-
* graphite-web url:
19-
* For Basic authentication use: http://username:[email protected]
20-
* Basic authentication requires special HTTP headers to be configured
21-
* in nginx or apache for cross origin domain sharing to work (CORS).
22-
* Check install documentation on github
23-
*/
24-
graphiteUrl: "/graphite",
25-
26-
/**
27-
* Multiple graphite servers? Comment out graphiteUrl and replace with
28-
*
29-
* datasources: {
30-
* data_center_us: { type: 'graphite', url: 'http://<graphite_url>', default: true },
31-
* data_center_eu: { type: 'graphite', url: 'http://<graphite_url>' }
32-
* }
33-
*/
10+
return new Settings({
3411

12+
// datasources, you can add multiple
13+
datasources: {
14+
graphite: {
15+
type: 'graphite',
16+
url: "/graphite",
17+
default: true
18+
}
19+
},
20+
21+
// elasticsearch url
22+
// used for storing and loading dashboards, optional
23+
// For Basic authentication use: http://username:password@domain.com:9200
24+
elasticsearch: '/elasticsearch', //"http://"+window.location.hostname+":9200",
25+
26+
// default start dashboard
3527
default_route: '/dashboard/file/default.json',
3628

37-
/**
38-
* If your graphite server has another timezone than you & users browsers specify the offset here
39-
* Example: "-0500" (for UTC - 5 hours)
40-
*/
41-
timezoneOffset: null,
42-
29+
// Elasticsearch index for storing dashboards
4330
grafana_index: "grafana-dash",
4431

45-
panel_names: [
46-
'text',
47-
'graphite'
48-
]
32+
// timezoneOFfset:
33+
// If you experiance problems with zoom, it is probably caused by timezone diff between
34+
// your browser and the graphite-web application. timezoneOffset setting can be used to have Grafana
35+
// translate absolute time ranges to the graphite-web timezone.
36+
// Example:
37+
// If TIME_ZONE in graphite-web config file local_settings.py is set to America/New_York, then set
38+
// timezoneOffset to "-0500" (for UTC - 5 hours)
39+
// Example:
40+
// If TIME_ZONE is set to UTC, set this to "0000"
41+
//
42+
timezoneOffset: 0000,
43+
44+
// set to false to disable unsaved changes warning
45+
unsaved_changes_warning: true,
46+
47+
// set the default timespan for the playlist feature
48+
// Example: "1m", "1h"
49+
playlist_timespan: "1m",
50+
51+
// Add your own custom pannels
52+
plugins: {
53+
panels: []
54+
}
55+
4956
});
5057
});
51-

graphite/storage-aggregation.conf

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[min]
2+
pattern = \.lower$
3+
xFilesFactor = 0.1
4+
aggregationMethod = min
5+
6+
[max]
7+
pattern = \.upper(_\d+)?$
8+
xFilesFactor = 0.1
9+
aggregationMethod = max
10+
11+
[sum]
12+
pattern = \.sum$
13+
xFilesFactor = 0
14+
aggregationMethod = sum
15+
16+
[count]
17+
pattern = \.count$
18+
xFilesFactor = 0
19+
aggregationMethod = sum
20+
21+
[count_legacy]
22+
pattern = ^stats_counts.*
23+
xFilesFactor = 0
24+
aggregationMethod = sum
25+
26+
[default_average]
27+
pattern = .*
28+
xFilesFactor = 0.3
29+
aggregationMethod = average

graphite/storage-schemas.conf

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[default]
22
pattern = .*
33
retentions = 10s:1d,1m:7d
4-

start

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
docker kill kamon-grafana-dashboard
44
docker rm kamon-grafana-dashboard
55

6-
docker run -d -v /etc/localtime:/etc/localtime:ro -p 80:80 -p 8125:8125/udp -p 8126:8126 --name kamon-grafana-dashboard kamon/grafana_graphite
7-
6+
docker run -d -v /etc/localtime:/etc/localtime:ro -p 80:80 -p 8125:8125/udp -p 8126:8126 --name kamon-grafana-dashboard kamon/grafana_graphite

statsd/config.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
{
2-
flushInterval: 2000,
3-
graphitePort: 2003,
4-
graphiteHost: "127.0.0.1",
52
port: 8125,
63
mgmt_port: 8126,
4+
5+
percentThreshold: [ 50, 75, 90, 95, 98, 99, 99.9, 99.99, 99.999],
6+
7+
graphitePort: 2003,
8+
graphiteHost: "127.0.0.1",
9+
flushInterval: 10000,
10+
711
backends: ['./backends/graphite'],
8-
debug: true
12+
graphite: {
13+
legacyNamespace: false
14+
}
915
}

0 commit comments

Comments
 (0)