diff --git a/grafana/README.md b/grafana/README.md new file mode 100644 index 0000000..e8e6e60 --- /dev/null +++ b/grafana/README.md @@ -0,0 +1,18 @@ +GRAFANA_VERSION=6.6.1 +if [ ! -d grafana-${GRAFANA_VERSION} ];then + wget https://dl.grafana.com/oss/release/grafana-${GRAFANA_VERSION}.linux-amd64.tar.gz + tar xzf grafana-${GRAFANA_VERSION}.linux-amd64.tar.gz + rm -f grafana-${GRAFANA_VERSION}.linux-amd64.tar.gz +fi + +sed -i '' -e 's|^http_port = 3000$|http_port = 8080|' grafana-${GRAFANA_VERSION}/conf/defaults.ini + +PROMETHEUS_HOST=$(cf curl /v2/apps/$(cf app prometheus --guid)/stats | jq -r '.["0"].stats.uris[0]') +cat provisioning/datasources/datasources.yaml | sed -e "s|http://prometheus:9090|https://${PROMETHEUS_HOST}|g" > grafana-${GRAFANA_VERSION}/conf/provisioning/datasources/datasources.yaml + +wget https://github.com/making/prometheus-kustomize/raw/master/base/grafana/probe-https-summary.json -P provisioning/dashboards/Blackbox/ +wget https://github.com/making/prometheus-kustomize/raw/master/base/grafana/spring-boot.json -P provisioning/dashboards/Micrometer/ + +cp -r provisioning/dashboards/* grafana-${GRAFANA_VERSION}/conf/provisioning/dashboards/ + +cf push grafana -m 128m -b binary_buildpack -p ./grafana-${GRAFANA_VERSION} --random-route -c "./bin/grafana-server -config=./conf/defaults.ini" \ No newline at end of file diff --git a/grafana/provisioning/dashboards/Blackbox/.gitignore b/grafana/provisioning/dashboards/Blackbox/.gitignore new file mode 100644 index 0000000..94a2dd1 --- /dev/null +++ b/grafana/provisioning/dashboards/Blackbox/.gitignore @@ -0,0 +1 @@ +*.json \ No newline at end of file diff --git a/grafana/provisioning/dashboards/Micrometer/.gitignore b/grafana/provisioning/dashboards/Micrometer/.gitignore new file mode 100644 index 0000000..94a2dd1 --- /dev/null +++ b/grafana/provisioning/dashboards/Micrometer/.gitignore @@ -0,0 +1 @@ +*.json \ No newline at end of file diff --git a/grafana/provisioning/dashboards/dashboards.yaml b/grafana/provisioning/dashboards/dashboards.yaml new file mode 100644 index 0000000..fd1a6c7 --- /dev/null +++ b/grafana/provisioning/dashboards/dashboards.yaml @@ -0,0 +1,20 @@ +apiVersion: 1 +providers: +- name: Micrometer + orgId: 1 + folder: Micrometer + type: file + disableDeletion: false + editable: true + allowUiUpdates: true + options: + path: /home/vcap/app/conf/provisioning/dashboards/Micrometer +- name: Blackbox + orgId: 1 + folder: Blackbox + type: file + disableDeletion: false + editable: true + allowUiUpdates: true + options: + path: /home/vcap/app/conf/provisioning/dashboards/Blackbox \ No newline at end of file diff --git a/grafana/provisioning/datasources/datasources.yaml b/grafana/provisioning/datasources/datasources.yaml new file mode 100644 index 0000000..b8c9cf5 --- /dev/null +++ b/grafana/provisioning/datasources/datasources.yaml @@ -0,0 +1,10 @@ +apiVersion: 1 +datasources: +- name: prometheus + type: prometheus + access: proxy + org_id: 1 + url: http://prometheus:9090 + is_default: true + editable: true + read_only: false \ No newline at end of file