aboutsummaryrefslogtreecommitdiff
path: root/ansible/plays/templates/ops-agent
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2020-09-01 20:10:10 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2020-09-01 20:10:10 +0200
commit6ad4c172d23b88a0e0bace8488e4f53f6ee4ce6e (patch)
tree3ed44554680e965adf6e6453abac32746600d273 /ansible/plays/templates/ops-agent
parente581bb7e3dd37572b739083133ffaf8d0962cb15 (diff)
downloadinfra-6ad4c172d23b88a0e0bace8488e4f53f6ee4ce6e.tar.gz
infra-6ad4c172d23b88a0e0bace8488e4f53f6ee4ce6e.tar.bz2
infra-6ad4c172d23b88a0e0bace8488e4f53f6ee4ce6e.tar.xz
infra-6ad4c172d23b88a0e0bace8488e4f53f6ee4ce6e.zip
ops
Diffstat (limited to 'ansible/plays/templates/ops-agent')
-rw-r--r--ansible/plays/templates/ops-agent/docker-compose.yml27
-rw-r--r--ansible/plays/templates/ops-agent/telegraf.conf55
2 files changed, 82 insertions, 0 deletions
diff --git a/ansible/plays/templates/ops-agent/docker-compose.yml b/ansible/plays/templates/ops-agent/docker-compose.yml
new file mode 100644
index 0000000..c5a4ecc
--- /dev/null
+++ b/ansible/plays/templates/ops-agent/docker-compose.yml
@@ -0,0 +1,27 @@
+version: "3"
+services:
+ telegraf:
+ image: telegraf:1.15
+ privileged: true
+ network_mode: host
+ volumes:
+ - /etc/docker-service/ops-agent/telegraf.conf:/etc/telegraf/telegraf.conf:ro
+ - /var/run/docker.sock:/var/run/docker.sock:ro
+ - /sys:/rootfs/sys:ro
+ - /proc:/rootfs/proc:ro
+ - /etc:/rootfs/etc:ro
+{% for mp in telegraf_extra_mount_points|default([]) %}
+ - {{ mp }}:{{ mp }}:ro
+{% endfor %}
+
+ command:
+ - sh
+ - -c
+ - apt update && apt install -y --install-recommends=no smartmontools; exec telegraf
+ environment:
+ INFLUX_URL: "http://birgitte.vpn.trygvis.io:8086"
+ INFLUX_SKIP_DATABASE_CREATION: "true"
+ HOST_PROC: "/rootfs/proc"
+ HOST_SYS: "/rootfs/sys"
+ HOST_ETC: "/rootfs/etc"
+ HOST_MOUNT_PREFIX: "/rootfs"
diff --git a/ansible/plays/templates/ops-agent/telegraf.conf b/ansible/plays/templates/ops-agent/telegraf.conf
new file mode 100644
index 0000000..a408ef6
--- /dev/null
+++ b/ansible/plays/templates/ops-agent/telegraf.conf
@@ -0,0 +1,55 @@
+[global_tags]
+
+[agent]
+ interval = "10s"
+ round_interval = true
+ metric_batch_size = 1000
+ metric_buffer_limit = 10000
+ collection_jitter = "0s"
+ flush_interval = "10s"
+ flush_jitter = "0s"
+ precision = ""
+ hostname = "{{ ansible_hostname }}"
+ omit_hostname = false
+
+[[inputs.cpu]]
+ percpu = true
+ totalcpu = true
+ collect_cpu_time = false
+ report_active = false
+
+[[inputs.disk]]
+ ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
+
+[[inputs.diskio]]
+[[inputs.kernel]]
+[[inputs.mem]]
+[[inputs.processes]]
+[[inputs.swap]]
+[[inputs.system]]
+[[inputs.docker]]
+
+{% if telegraf_sensors_enable|default(false) %}
+[[inputs.sensors]]
+{% endif %}
+
+{% if telegraf_smart_enable|default(false) %}
+[[inputs.smart]]
+{% set devs=telegraf_smart_devices|default([]) %}
+{% if devs|length > 0 %}
+devices = [
+{% for dev in devs %}
+ "{{ dev }}",
+{% endfor %}
+]
+{% endif %}
+{% endif %}
+
+[[outputs.influxdb]]
+ urls = ["$INFLUX_URL"]
+ skip_database_creation = false
+
+{% set cfg=telegraf_extra_config|default("") %}
+{% if cfg|length > 0%}
+{{ cfg }}
+{% endif %}