From 99a84d454c33c4b9066bb2d714c64c452584895e Mon Sep 17 00:00:00 2001 From: shockrah Date: Fri, 15 Apr 2022 00:11:06 -0700 Subject: [PATCH] + Trackign host metrics with vector docker container --- docker-host/setup/files/vector.toml | 13 ++++++++++++ docker-host/setup/tasks/vector.yml | 33 +++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 docker-host/setup/files/vector.toml create mode 100644 docker-host/setup/tasks/vector.yml diff --git a/docker-host/setup/files/vector.toml b/docker-host/setup/files/vector.toml new file mode 100644 index 0000000..9808fcf --- /dev/null +++ b/docker-host/setup/files/vector.toml @@ -0,0 +1,13 @@ +[sources.host_metrics] +type = "host_metrics" +collectors = [ "cpu", "disk", "host", "memory", "network" ] +namespace = "leftcoastlab-host" +scrape_interval_secs = 60 + +[sinks.host_metrics_output] +type = "console" +inputs = [ "host_metrics" ] +target = "stdout" + +encoding.codec = "json" + diff --git a/docker-host/setup/tasks/vector.yml b/docker-host/setup/tasks/vector.yml new file mode 100644 index 0000000..3aec912 --- /dev/null +++ b/docker-host/setup/tasks/vector.yml @@ -0,0 +1,33 @@ +--- +- hosts: leftcoastlab + become: yes + tasks: + - name: Include Vars + include_vars: + dir: ../vars + + - name: Ensure /opt/vector/ exists + file: + path: /opt/vector + state: directory + + - name: Copy over Vector config + copy: + src: ../files/vector.toml + dest: /opt/vector/vector.toml + + - name: Start up Vector Container + community.docker.docker_container: + name: vector-host-metrics + image: timberio/vector:latest-alpine + pull: yes + restart_policy: always + recreate: yes + volumes: + - "/opt/vector/vector.toml:/etc/vector/vector.toml" + log_driver: loki + log_options: + loki-url: "http://localhost:{{LOKI_PORT}}/loki/api/v1/push" + + +