-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added grafana inc datasource and dashboard
- Loading branch information
1 parent
0c06528
commit 32fc6cb
Showing
20 changed files
with
604 additions
and
64 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
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,11 @@ | ||
--- | ||
collectd_name: collectd | ||
collectd_docker_tar: /vagrant/collectd-docker.tar | ||
collectd_service_definition: > | ||
--name collectd | ||
--mode global | ||
--network appnet | ||
--mount type=bind,src=/vagrant/collectd/root/etc/collectd/,dst=/etc/collectd/ | ||
--mount type=bind,src=/vagrant/collectd/root/etc/collectd.d/,dst=/etc/collectd.d/ | ||
--mount type=bind,src=/proc,dst=/mnt/proc,readonly | ||
{{ collectd_name }} |
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,23 @@ | ||
--- | ||
grafana_name: grafana | ||
grafana_user: admin | ||
grafana_password: password | ||
grafana_dashboard_file: templates/dashboard.json.j2 | ||
grafana_datasource_files: | ||
- templates/influxdb_datasource.json.j2 | ||
|
||
influxdb_db_name: riemann-local | ||
influxdb_user: root | ||
influxdb_db_password: password | ||
influxdb_host: http://influxdb | ||
influxdb_port: 8086 | ||
|
||
grafana_service_definition: > | ||
--name {{ grafana_name }} | ||
--network appnet | ||
-p 3001:3000/tcp | ||
--env "GF_SECURITY_ADMIN_PASSWORD={{ grafana_password }}" | ||
--env "CONSUL_SERVICE_PORT=3001" | ||
--log-driver syslog | ||
--log-opt tag={{ docker_syslog_tag }} | ||
grafana/grafana:3.1.0-beta1 |
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,43 @@ | ||
--- | ||
- name: Get existing services | ||
shell: > | ||
docker service ls --filter name={{ grafana_name }} | tail -n +2 | ||
register: grafana_result | ||
|
||
- name: Stopped existing grafana service | ||
become: yes | ||
become_user: root | ||
shell: > | ||
docker service rm {{ grafana_name }} | ||
when: "'{{ grafana_name }}' in grafana_result.stdout" | ||
|
||
- name: Running Grafana service | ||
become: yes | ||
become_user: root | ||
shell: > | ||
docker service create {{ grafana_service_definition }} | ||
- pause: seconds=5 | ||
|
||
- name: Imported Grafana dashboard | ||
uri: | ||
url: http://192.168.77.21:3001/api/dashboards/db | ||
method: POST | ||
user: "{{ grafana_user }}" | ||
password: "{{ grafana_password }}" | ||
body: "{{ lookup('template', grafana_dashboard_file) }}" | ||
status_code: 200 | ||
body_format: json | ||
force_basic_auth: yes | ||
|
||
- name: Imported Grafana datasources | ||
uri: | ||
url: http://192.168.77.21:3001/api/datasources | ||
method: POST | ||
user: "{{ grafana_user }}" | ||
password: "{{ grafana_password }}" | ||
body: "{{ lookup('template', item) }}" | ||
status_code: 200 | ||
body_format: json | ||
force_basic_auth: yes | ||
with_items: "{{ grafana_datasource_files }}" |
Oops, something went wrong.