grafana: add dynamic prometheus datasource
This commit is contained in:
parent
10fbcd5268
commit
6a3f7018e0
1 changed files with 17 additions and 2 deletions
|
@ -48,11 +48,11 @@ job "grafana" {
|
|||
ports = ["http"]
|
||||
|
||||
volumes = [
|
||||
"/storage/nomad/${NOMAD_JOB_NAME}/${NOMAD_TASK_NAME}:/var/lib/grafana"
|
||||
"/storage/nomad/${NOMAD_JOB_NAME}/${NOMAD_TASK_NAME}:/var/lib/grafana",
|
||||
"local/datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
template {
|
||||
data = <<EOH
|
||||
GF_DATABASE_TYPE=postgres
|
||||
|
@ -66,6 +66,21 @@ EOH
|
|||
destination = "local/.env"
|
||||
env = true
|
||||
}
|
||||
template {
|
||||
data = <<EOH
|
||||
apiVersion: 1
|
||||
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
{{- range service "prometheus" }}
|
||||
url: http://prometheus.service.consul:{{ .Port }}{{ end }}
|
||||
isDefault: true
|
||||
editable: false
|
||||
EOH
|
||||
destination = "local/datasources.yml"
|
||||
}
|
||||
}
|
||||
task "db" {
|
||||
driver = "docker"
|
||||
|
|
Loading…
Reference in a new issue