Browse Source

Add telegraf agent to memcached pod

Change-Id: I3791fc071e41d478b80b389c1125f5093e62d8e1
Bartosz Kupidura 2 years ago
parent
commit
2bb2d9432b
2 changed files with 37 additions and 1 deletions
  1. 14
    0
      service/files/telegraf.conf.j2
  2. 23
    1
      service/memcached.yaml

+ 14
- 0
service/files/telegraf.conf.j2 View File

@@ -0,0 +1,14 @@
1
+[agent]
2
+  interval = "15s"
3
+  round_interval = false
4
+  metric_batch_size = 1000
5
+  metric_buffer_limit = 10000
6
+  collection_jitter = "2s"
7
+  hostname = ""
8
+  omit_hostname = false
9
+
10
+[[outputs.prometheus_client]]
11
+  listen = ":{{ telegraf.prometheus_output_port.cont }}"
12
+
13
+[[inputs.memcached]]
14
+  servers = ["{{ network_topology["private"]["address"] }}:{{ memcached.port.cont }}"]

+ 23
- 1
service/memcached.yaml View File

@@ -1,11 +1,33 @@
1
-dsl_version: 0.1.0
1
+dsl_version: 0.4.0
2 2
 service:
3 3
   name: memcached
4 4
   ports:
5 5
     - {{ memcached.port }}
6
+  # {% if telegraf is defined %}
7
+  annotations:
8
+    service:
9
+      prometheus.io/scrape: "true"
10
+      prometheus.io/port: "{{ telegraf.prometheus_output_port.cont }}"
11
+  # {% endif %}
6 12
   containers:
7 13
     - name: memcached
8 14
       image: memcached
9 15
       daemon:
10 16
         command: memcached -v -u memcached -l {{ memcached.address }} -m {{ memcached.ram }} -c {{ memcached.max_connections }}
11 17
         user: memcached
18
+    # {% if telegraf is defined %}
19
+    - name: memcached-telegraf
20
+      image: telegraf
21
+      daemon:
22
+        dependencies:
23
+          - etcd
24
+          - memcached
25
+        command: telegraf --config /etc/telegraf/telegraf.conf --input-filter memcached
26
+        files:
27
+          - telegraf-conf
28
+    # {% endif %}
29
+
30
+files:
31
+  telegraf-conf:
32
+    path: /etc/telegraf/telegraf.conf
33
+    content: telegraf.conf.j2

Loading…
Cancel
Save