diff --git a/nomad-job/node-exporter.nomad b/nomad-job/node-exporter.nomad new file mode 100644 index 0000000..0963ae8 --- /dev/null +++ b/nomad-job/node-exporter.nomad @@ -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 + } + } + + } +} diff --git a/nomad-job/prometheus.nomad b/nomad-job/prometheus.nomad index 30c0ffb..783e944 100644 --- a/nomad-job/prometheus.nomad +++ b/nomad-job/prometheus.nomad @@ -73,8 +73,13 @@ scrape_configs: relabel_configs: - source_labels: [__meta_consul_node] target_label: machine + - job_name: 'nodeexp' + static_configs: + consul_sd_configs: + - server: 'consul.service.consul:8500' + services: ['node-exporter'] + - EOH