This repository has been archived by the owner on Oct 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds example prometheus setup (#135)
Fixes #121
- Loading branch information
1 parent
f94c29c
commit 9f574ff
Showing
4 changed files
with
106 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
|
||
set -xeuo pipefail | ||
|
||
if ! curl --retry 5 --retry-connrefused --retry-delay 0 -sf http://grafana:3000/api/dashboards/name/prom; then | ||
curl -sf -X POST -H "Content-Type: application/json" \ | ||
--data-binary '{"name":"prom","type":"prometheus","url":"http://prometheus:9090","access":"proxy","isDefault":true}' \ | ||
http://grafana:3000/api/datasources | ||
fi | ||
|
||
dashboard_id=1598 | ||
last_revision=$(curl -sf https://grafana.com/api/dashboards/${dashboard_id}/revisions | grep '"revision":' | sed 's/ *"revision": \([0-9]*\),/\1/' | sort -n | tail -1) | ||
|
||
echo '{"dashboard": ' > data.json | ||
curl -s https://grafana.com/api/dashboards/${dashboard_id}/revisions/${last_revision}/download >> data.json | ||
echo ', "inputs": [{"name": "DS_PROM", "pluginId": "prometheus", "type": "datasource", "value": "prom"}], "overwrite": false}' >> data.json | ||
curl --retry-connrefused --retry 5 --retry-delay 0 -sf \ | ||
-X POST -H "Content-Type: application/json" \ | ||
--data-binary @data.json \ | ||
http://grafana:3000/api/dashboards/import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
global: | ||
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. | ||
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. | ||
|
||
scrape_configs: | ||
- job_name: 'prometheus' | ||
static_configs: | ||
- targets: ['localhost:9090'] | ||
- job_name: 'zipkin' | ||
scrape_interval: 5s | ||
metrics_path: '/prometheus' | ||
static_configs: | ||
- targets: ['zipkin:9411'] | ||
metric_relabel_configs: | ||
# Response code count | ||
- source_labels: [__name__] | ||
regex: '^counter_status_(\d+)_(.*)$' | ||
replacement: '${1}' | ||
target_label: status | ||
- source_labels: [__name__] | ||
regex: '^counter_status_(\d+)_(.*)$' | ||
replacement: '${2}' | ||
target_label: path | ||
- source_labels: [__name__] | ||
regex: '^counter_status_(\d+)_(.*)$' | ||
replacement: 'http_requests_total' | ||
target_label: __name__ | ||
# Received message count | ||
- source_labels: [__name__] | ||
regex: '(?:gauge|counter)_zipkin_collector_(.*)_([^_]*)' | ||
replacement: '${2}' | ||
target_label: transport | ||
- source_labels: [__name__] | ||
regex: '(?:gauge|counter)_zipkin_collector_(.*)_([^_]*)' | ||
replacement: 'zipkin_collector_${1}' | ||
target_label: __name__ |