From 2149916cb51aaa536f281974f4c201d1c9f93ede Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 28 May 2020 17:05:49 +0200 Subject: [PATCH] Initial commit --- .gitignore | 1 + tasks/main.yml | 9 +++++ templates/telegraf.conf.j2 | 74 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 .gitignore create mode 100644 tasks/main.yml create mode 100644 templates/telegraf.conf.j2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4dc51e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +vault/ diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..b9508fb --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,9 @@ +- name: Copy telegraf config + template: + follow: yes + src: 'telegraf.conf.j2' + dest: '/etc/telegraf/telegraf.conf' + notify: Run service actions + tags: + - telegraf + - vault diff --git a/templates/telegraf.conf.j2 b/templates/telegraf.conf.j2 new file mode 100644 index 0000000..171192f --- /dev/null +++ b/templates/telegraf.conf.j2 @@ -0,0 +1,74 @@ +[global_tags] + +[agent] + interval = "10s" + round_interval = true + metric_batch_size = 1000 + metric_buffer_limit = 10000 + collection_jitter = "5s" + flush_interval = "30s" + flush_jitter = "0s" + precision = "" + debug = false + quiet = false + logfile = "" + omit_hostname = false + +[[outputs.influxdb]] + urls = ["http://{{ telegraf.outputs.influxdb.host }}:{{ telegraf.outputs.influxdb.port }}"] + database = "{{ telegraf.outputs.influxdb.database }}" + +[[inputs.cpu]] + percpu = true + totalcpu = true + collect_cpu_time = true + report_active = true + +[[inputs.disk]] + ignore_fs = ["tmpfs", "devtmpfs", "devfs", "overlay", "aufs", "squashfs"] + +[[inputs.diskio]] + devices = ["vd*"] + +[[inputs.kernel]] +[[inputs.mem]] +[[inputs.processes]] +[[inputs.swap]] +[[inputs.system]] + +{% for entry in telegraf.inputs.cloudwatch %} +[[inputs.cloudwatch]] + region = "{{ entry.region }}" + access_key = "{{ entry.access_key }}" + secret_key = "{{ entry.secret_key }}" + period = "{{ entry.period }}" + interval = "{{ entry.interval }}" + namespace = "{{ entry.namespace }}" + ratelimit = {{ entry.ratelimit }} + statistic_include = {{ entry.statistic_include }} + cache_ttl = "{{ entry.cache_ttl }}" +{% endfor %} + +[[inputs.redis]] + servers = {{ telegraf.inputs.redis.servers }} + +[[inputs.postgresql]] + address = "{{ telegraf.inputs.postgresql.address }}" + ignored_databases = ["template0", "template1"] + +#[[inputs.haproxy]] +# servers = ["socket:/haproxy/haproxy.sock"] + +[[inputs.unbound]] + server = "localhost:8953" + thread_as_tag = true + +# [[inputs.http_listener_v2]] +# service_address = ":8080" +# methods = ["POST"] +# path = "/" +# data_source = "body" +# data_format = "json" +# json_query = "csp-report" +# json_string_fields = ["document-uri", "referrer", "violated-directive", "original-policy","blocked-uri"] +# json_name_key = "csp_reports"