diff --git a/grafana-agent/grafana-agent.nomad b/grafana-agent/grafana-agent.nomad index 2ea0050..f11ebae 100644 --- a/grafana-agent/grafana-agent.nomad +++ b/grafana-agent/grafana-agent.nomad @@ -1,34 +1,29 @@ variable "graf_agent_rel_url" { description = "Base URL for grafana release packages." + type = string default = "https://github.com/grafana/agent/releases/download" } variable "graf_agent_version" { description = "Grafana Agent version to be used." + type = string default = "0.40.3" } -variable "gcloud_metrics_id" { - description = "Grafana Cloud metrics Id" - default = 988263 -} - -variable "gcloud_logs_id" { - description = "Grafana Cloud Loki Id" - default = 596739 -} - variable "scrape_interval" { description = "Default scrape interval" + type = string default = "60s" } job "grafana-agent" { vault {} + type = "system" group "nodes" { network { port "http" {} port "grpc" {} } + task "agent" { identity { name = "vault" @@ -40,7 +35,24 @@ job "grafana-agent" { service { port = "http" - name = "grafana-agent-${attr.unique.hostname}-http" + name = "grafana-agent-http" + check { + type = "http" + name = "agent_health" + path = "/-/healthy" + interval = "20s" + timeout = "5s" + } + } + + service { + port = "grpc" + name = "grafana-agent-grpc" + check { + type = "tcp" + interval = "20s" + timeout = "5s" + } } env { HOSTNAME = attr.unique.hostname @@ -57,10 +69,10 @@ job "grafana-agent" { } config { command = "local/grafana-agent" - args = ["-config.file", "local/agent.yml"] - } - service { - + args = [ + "-config.file", "local/agent.yml", + "-server.http.address", "${NOMAD_ADDR_http}", + "-server.grpc.address", "${NOMAD_ADDR_grpc}"] } } } diff --git a/grafana-agent/grafana-agent.yml.tmpl b/grafana-agent/grafana-agent.yml.tmpl index f05d3a3..af47570 100644 --- a/grafana-agent/grafana-agent.yml.tmpl +++ b/grafana-agent/grafana-agent.yml.tmpl @@ -49,8 +49,8 @@ integrations: prometheus_remote_write: - basic_auth: password: '{{ .Data.data.api_key }}' - username: '{{ env "GCLOUD_METRICS_ID" }}' - url: '{{ env "GCLOUD_METRICS_URL" }}' + username: '{{ .Data.data.metrics_id }}' + url: '{{ .Data.data.metrics_url }}/api/prom/push' node_exporter: enabled: true # disable unused collectors