Skip to content
Snippets Groups Projects
Commit ef228c3d authored by Zuul's avatar Zuul Committed by Gerrit Code Review
Browse files

Merge "Automatically add Prometheus as a Grafana datasource"

parents b5a6bed7 6777c903
No related branches found
No related tags found
No related merge requests found
...@@ -20,3 +20,4 @@ ...@@ -20,3 +20,4 @@
or grafana_conf.changed | bool or grafana_conf.changed | bool
or grafana_container.changed | bool or grafana_container.changed | bool
or grafana_home_dashboard.changed | bool or grafana_home_dashboard.changed | bool
or grafana_prometheus_data_source.changed | bool
...@@ -80,6 +80,26 @@ ...@@ -80,6 +80,26 @@
notify: notify:
- Restart grafana container - Restart grafana container
- name: Configuring Prometheus as data source for Grafana
vars:
service: "{{ grafana_services['grafana'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/grafana/prometheus.yaml"
mode: "0660"
become: true
register: grafana_prometheus_data_source
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
- enable_prometheus | bool
with_first_found:
- "{{ node_custom_config }}/grafana/{{ inventory_hostname }}/prometheus.yaml"
- "{{ node_custom_config }}/grafana/prometheus.yaml"
- "prometheus.yaml.j2"
notify:
- Restart grafana container
- name: Check grafana containers - name: Check grafana containers
kolla_docker: kolla_docker:
action: "compare_container" action: "compare_container"
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
data = /var/lib/grafana data = /var/lib/grafana
logs = /var/log/kolla/grafana logs = /var/log/kolla/grafana
plugins = /var/lib/grafana/plugins plugins = /var/lib/grafana/plugins
provisioning = /etc/grafana/provisioning
[server] [server]
protocol = http protocol = http
......
...@@ -21,6 +21,13 @@ ...@@ -21,6 +21,13 @@
"owner": "root", "owner": "root",
"perm": "0644", "perm": "0644",
"optional": true "optional": true
},
{
"source": "{{ container_config_directory }}/prometheus.yaml",
"dest": "/etc/grafana/provisioning/datasources/prometheus.yaml",
"owner": "root",
"perm": "0644",
"optional": true
} }
], ],
"permissions": [ "permissions": [
......
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
orgId: 1
url: http://{{ kolla_internal_vip_address }}:{{ prometheus_port }}
version: 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment