Added virtlet&kubernetes for telegraf input
Change-Id: Id68957fcb8833e531b0405a6765dd7f57ac78544
Related-Bug: PROD-23900
diff --git a/kubernetes/files/kubernetes_telegraf.conf b/kubernetes/files/kubernetes_telegraf.conf
new file mode 100644
index 0000000..4e68224
--- /dev/null
+++ b/kubernetes/files/kubernetes_telegraf.conf
@@ -0,0 +1,2 @@
+[[inputs.kubernetes]]
+ url = "http://{{ values.host }}:{{ values.port|default('10255') }}"
diff --git a/kubernetes/files/virtlet_telegraf.conf b/kubernetes/files/virtlet_telegraf.conf
new file mode 100644
index 0000000..8d64f20
--- /dev/null
+++ b/kubernetes/files/virtlet_telegraf.conf
@@ -0,0 +1,2 @@
+[[inputs.virtlet]]
+ socket = "{{ values.socket|default('/run/virtlet.sock') }}"
diff --git a/kubernetes/meta/telegraf.yml b/kubernetes/meta/telegraf.yml
index ede028a..3dc0a9d 100644
--- a/kubernetes/meta/telegraf.yml
+++ b/kubernetes/meta/telegraf.yml
@@ -1,5 +1,6 @@
{%- from "kubernetes/map.jinja" import master with context %}
{%- from "kubernetes/map.jinja" import pool with context %}
+{%- from "kubernetes/map.jinja" import common with context %}
{%- if pool.get('enabled', False) %}
{% set network = pool.get('network', {}) %}
@@ -9,9 +10,20 @@
{% endif %}
{% endif %}
+{% set virtlet_enabled = common.get('addons', {}).get('virtlet', {}).get('enabled', False) %}
+
{%- if master.get('enabled', False) or pool.get('enabled', False) %}
agent:
input:
+ {%- if pool.get('enabled', False) %}
+ kubernetes:
+ host: {{ pool.kubelet.address }}
+ template: kubernetes/files/kubernetes_telegraf.conf
+ {%- endif %}
+ {%- if virtlet_enabled and not master.get('enabled', False) %}
+ virtlet:
+ template: kubernetes/files/virtlet_telegraf.conf
+ {%- endif %}
procstat:
process:
{%- if master.get('enabled', False) %}
diff --git a/metadata/service/monitoring.yml b/metadata/service/monitoring.yml
index cbf56a3..884bdd5 100644
--- a/metadata/service/monitoring.yml
+++ b/metadata/service/monitoring.yml
@@ -3,4 +3,3 @@
common:
monitoring:
backend: prometheus
-