add node-exporter

This commit is contained in:
vincent 2022-06-22 16:38:56 +02:00
parent b5f0e38516
commit eab87b2494
2 changed files with 74 additions and 1 deletions

View File

@ -0,0 +1,68 @@
job "node-exporter" {
datacenters = ["homelab","hetzner"]
type = "system"
meta {
forcedeploy = "0"
}
group "node-exporter"{
network {
port "http" {
}
}
service {
name = "node-exporter"
port = "http"
check {
type = "http"
port = "http"
path = "/"
interval = "10s"
timeout = "2s"
success_before_passing = "3"
failures_before_critical = "3"
check_restart {
limit = 3
grace = "60s"
}
}
}
task "node-exporter" {
driver = "docker"
config {
image = "prom/node-exporter"
ports = ["http"]
args = [
"--web.listen-address=:${NOMAD_PORT_http}",
"--path.procfs=/host/proc",
"--path.sysfs=/host/sys",
"--collector.filesystem.ignored-mount-points",
"^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)"
]
mount {
type = "bind"
target = "/host/proc"
source = "/proc"
readonly = true
}
mount {
type = "bind"
target = "/host/sys"
source = "/sys"
readonly = true
}
}
resources {
cpu = 20
memory = 16
}
}
}
}

View File

@ -73,6 +73,11 @@ scrape_configs:
relabel_configs: relabel_configs:
- source_labels: [__meta_consul_node] - source_labels: [__meta_consul_node]
target_label: machine target_label: machine
- job_name: 'nodeexp'
static_configs:
consul_sd_configs:
- server: 'consul.service.consul:8500'
services: ['node-exporter']