Skip to content
Snippets Groups Projects
Commit fea5a9f8 authored by Hannes Feldt's avatar Hannes Feldt
Browse files

Merge branch 'fix-cs001-monitoring' into 'master'

Fix cs001 monitoring

See merge request !861
parents 0c8d09dd 59589dd2
Branches
No related tags found
1 merge request!861Fix cs001 monitoring
...@@ -35,22 +35,6 @@ job "log-scraping" { ...@@ -35,22 +35,6 @@ job "log-scraping" {
sticky = true sticky = true
} }
service {
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "prometheus"
local_bind_port = 9090
}
upstreams {
destination_name = "loki"
local_bind_port = 3100
}
}
}
}
}
task "vector" { task "vector" {
driver = "docker" driver = "docker"
...@@ -129,7 +113,7 @@ healthchecks.require_healthy = true ...@@ -129,7 +113,7 @@ healthchecks.require_healthy = true
[sinks.loki] [sinks.loki]
type = "loki" type = "loki"
inputs = [ "nomad-flags" ] inputs = [ "nomad-flags" ]
endpoint = "http://localhost:3100" endpoint = "http://loki.service.consul:3100"
encoding.codec = "json" encoding.codec = "json"
healthcheck.enabled = true healthcheck.enabled = true
remove_label_fields = true remove_label_fields = true
...@@ -150,7 +134,7 @@ healthchecks.require_healthy = true ...@@ -150,7 +134,7 @@ healthchecks.require_healthy = true
[sinks.prometheus_remote_write] [sinks.prometheus_remote_write]
type = "prometheus_remote_write" type = "prometheus_remote_write"
inputs = [ "host_metrics", "nomad_metrics", "vector_metrics" ] inputs = [ "host_metrics", "nomad_metrics", "vector_metrics" ]
endpoint = "http://localhost:9090/api/v1/write" endpoint = "http://prometheus.service.consul:9090/api/v1/write"
healthcheck.enabled = false healthcheck.enabled = false
EOF EOF
} }
......
...@@ -8,7 +8,7 @@ job "monitoring" { ...@@ -8,7 +8,7 @@ job "monitoring" {
network { network {
mode = "bridge" mode = "bridge"
port "postgres" { port "postgres" {
to = 5432 static = 5432
} }
} }
...@@ -22,11 +22,7 @@ job "monitoring" { ...@@ -22,11 +22,7 @@ job "monitoring" {
name = "postgres" name = "postgres"
port = "postgres" port = "postgres"
task = "postgres" task = "postgres"
address_mode = "alloc"
connect {
sidecar_service {}
}
} }
task "postgres" { task "postgres" {
...@@ -69,24 +65,6 @@ job "monitoring" { ...@@ -69,24 +65,6 @@ job "monitoring" {
name = "grafana" name = "grafana"
port = "http" port = "http"
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "postgres"
local_bind_port = 5432
}
upstreams {
destination_name = "prometheus"
local_bind_port = 9090
}
upstreams {
destination_name = "loki"
local_bind_port = 3100
}
}
}
}
} }
task "wait-for-db" { task "wait-for-db" {
...@@ -99,7 +77,7 @@ job "monitoring" { ...@@ -99,7 +77,7 @@ job "monitoring" {
config { config {
image = "[[.registry.astron.url]]/postgres:[[.monitoring.db.version]]" image = "[[.registry.astron.url]]/postgres:[[.monitoring.db.version]]"
command = "sh" command = "sh"
args = ["-c", "while ! pg_isready -h localhost; do sleep 1; done"] args = ["-c", "while ! pg_isready -h postgres.service.consul; do sleep 1; done"]
} }
env { env {
PGPASSFILE = "local/pgpass.txt" PGPASSFILE = "local/pgpass.txt"
...@@ -107,9 +85,7 @@ job "monitoring" { ...@@ -107,9 +85,7 @@ job "monitoring" {
template { template {
data = <<EOH data = <<EOH
{{ range service "postgres" }} postgres.service.consul:5432:grafana:postgres:password
localhost:5432:grafana:postgres:password
{{ end }}
EOH EOH
destination = "local/pgpass.txt" destination = "local/pgpass.txt"
perms = "600" perms = "600"
...@@ -138,7 +114,7 @@ localhost:5432:grafana:postgres:password ...@@ -138,7 +114,7 @@ localhost:5432:grafana:postgres:password
GF_SERVER_ROOT_URL = "%(protocol)s://%(domain)s:%(http_port)s/grafana/" GF_SERVER_ROOT_URL = "%(protocol)s://%(domain)s:%(http_port)s/grafana/"
GF_SERVER_SERVE_FROM_SUB_PATH = "true" GF_SERVER_SERVE_FROM_SUB_PATH = "true"
GF_DATABASE_TYPE = "postgres" GF_DATABASE_TYPE = "postgres"
GF_DATABASE_HOST = "localhost:5432" GF_DATABASE_HOST = "postgres.service.consul:5432"
GF_DATABASE_NAME = "grafana" GF_DATABASE_NAME = "grafana"
GF_DATABASE_USER = "postgres" GF_DATABASE_USER = "postgres"
GF_DATABASE_PASSWORD = "password" GF_DATABASE_PASSWORD = "password"
...@@ -157,7 +133,7 @@ localhost:5432:grafana:postgres:password ...@@ -157,7 +133,7 @@ localhost:5432:grafana:postgres:password
access: proxy access: proxy
orgId: 1 orgId: 1
uid: prometheus uid: prometheus
url: http://localhost:9090 url: http://prometheus.service.consul:9090
isDefault: true isDefault: true
EOH EOH
...@@ -173,7 +149,7 @@ localhost:5432:grafana:postgres:password ...@@ -173,7 +149,7 @@ localhost:5432:grafana:postgres:password
access: proxy access: proxy
orgId: 1 orgId: 1
uid: loki uid: loki
url: http://localhost:3100 url: http://loki.service.consul:3100
jsonData: jsonData:
esVersion: 7.10.0 esVersion: 7.10.0
includeFrozen: false includeFrozen: false
...@@ -198,6 +174,7 @@ localhost:5432:grafana:postgres:password ...@@ -198,6 +174,7 @@ localhost:5432:grafana:postgres:password
mode = "bridge" mode = "bridge"
port "prometheus" { port "prometheus" {
static = 9090
to = 9090 to = 9090
} }
} }
...@@ -212,18 +189,7 @@ localhost:5432:grafana:postgres:password ...@@ -212,18 +189,7 @@ localhost:5432:grafana:postgres:password
tags = ["haproxy", "scrape"] tags = ["haproxy", "scrape"]
name = "prometheus" name = "prometheus"
port = "prometheus" port = "prometheus"
address_mode = "alloc"
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "snmp-exporter"
local_bind_port = 9116
}
}
}
}
check { check {
type = "http" type = "http"
...@@ -327,7 +293,7 @@ localhost:5432:grafana:postgres:password ...@@ -327,7 +293,7 @@ localhost:5432:grafana:postgres:password
- source_labels: [__meta_consul_service_address] - source_labels: [__meta_consul_service_address]
target_label: __param_target target_label: __param_target
- target_label: __address__ - target_label: __address__
replacement: "localhost:9116" replacement: "snmp-exporter.service.consul:9116"
- source_labels: [__meta_consul_service] - source_labels: [__meta_consul_service]
target_label: instance # avoid a dynamic ip:port or hostname target_label: instance # avoid a dynamic ip:port or hostname
EOH EOH
...@@ -355,7 +321,7 @@ localhost:5432:grafana:postgres:password ...@@ -355,7 +321,7 @@ localhost:5432:grafana:postgres:password
port "loki" { port "loki" {
to = 3100 to = 3100
# should be activated when fully replaces docker-compose setup # should be activated when fully replaces docker-compose setup
#static = 3100 static = 3100
} }
} }
...@@ -371,9 +337,6 @@ localhost:5432:grafana:postgres:password ...@@ -371,9 +337,6 @@ localhost:5432:grafana:postgres:password
port = "loki" port = "loki"
address_mode = "alloc" address_mode = "alloc"
connect {
sidecar_service {}
}
} }
task "loki" { task "loki" {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment