Skip to content

Commit

Permalink
fix(monitoring): define http and grpc listen ports for agent
Browse files Browse the repository at this point in the history
Signed-off-by: Bruce Becker <[email protected]>
  • Loading branch information
brucellino committed Apr 7, 2024
1 parent 290287f commit e17de34
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
42 changes: 27 additions & 15 deletions grafana-agent/grafana-agent.nomad
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand All @@ -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}"]
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions grafana-agent/grafana-agent.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e17de34

Please sign in to comment.