From 40b2323bbb13e030b60a0efc28b9224d80a82214 Mon Sep 17 00:00:00 2001 From: Bartosz Kupidura Date: Tue, 24 Jan 2017 12:22:44 +0100 Subject: [PATCH] Add telegraf agent to mariadb pod Change-Id: I5d730e9ad792735ef33d29fa33916f5b7d7c2b06 --- service/files/telegraf.conf.j2 | 27 +++++++++++++++++++++++++++ service/mariadb.yaml | 23 ++++++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 service/files/telegraf.conf.j2 diff --git a/service/files/telegraf.conf.j2 b/service/files/telegraf.conf.j2 new file mode 100644 index 0000000..4757ce8 --- /dev/null +++ b/service/files/telegraf.conf.j2 @@ -0,0 +1,27 @@ +[agent] + interval = "15s" + round_interval = false + metric_batch_size = 1000 + metric_buffer_limit = 10000 + collection_jitter = "2s" + hostname = "" + omit_hostname = false + +[[outputs.prometheus_client]] + listen = ":{{ telegraf.prometheus_output_port.cont }}" + +[[inputs.mysql]] + servers = ["root:{{ db.root_password }}@tcp({{ network_topology["private"]["address"] }}:{{ mariadb.port.cont }})/"] + table_schema_databases = [] + gather_table_schema = true + gather_process_list = true + gather_info_schema_auto_inc = false + gather_slave_status = false + gather_binary_logs = true + gather_table_io_waits = true + gather_table_lock_waits = true + gather_index_io_waits = true + gather_event_waits = true + gather_file_events_stats = true + gather_perf_events_statements = true + interval_slow = "10m" diff --git a/service/mariadb.yaml b/service/mariadb.yaml index 3a34b88..7169437 100644 --- a/service/mariadb.yaml +++ b/service/mariadb.yaml @@ -1,8 +1,14 @@ -dsl_version: 0.1.0 +dsl_version: 0.4.0 service: name: {{ service.database }} ports: - {{ mariadb.port }} + # {% if telegraf is defined %} + annotations: + service: + prometheus.io/scrape: "true" + prometheus.io/port: "{{ telegraf.prometheus_output_port.cont }}" + # {% endif %} containers: - name: mariadb image: mariadb @@ -28,6 +34,18 @@ service: - mariadb-readiness - mariadb-bootstrap - mariadb-security-reset.expect + # {% if telegraf is defined %} + - name: mariadb-telegraf + image: telegraf + daemon: + dependencies: + - etcd + - mariadb + command: telegraf --config /etc/telegraf/telegraf.conf --input-filter mysql + files: + - telegraf-conf + # {% endif %} + files: mariadb-my-cnf: path: /etc/mysql/my.cnf @@ -44,3 +62,6 @@ files: path: /opt/ccp/bin/mariadb-security-reset.expect content: mariadb-security-reset.expect perm: "755" + telegraf-conf: + path: /etc/telegraf/telegraf.conf + content: telegraf.conf.j2