Add and activate Apache telegraf input

Change-Id: I5b4e72584b41b7a9b480b4343f30b7a6efd83c99
Depends-On: I926da5af7f96e7d40a76626527c2b54c52c6ee01
diff --git a/apache/files/telegraf.conf b/apache/files/telegraf.conf
new file mode 100644
index 0000000..ac24043
--- /dev/null
+++ b/apache/files/telegraf.conf
@@ -0,0 +1,3 @@
+[[inputs.apache]]
+  response_timeout = "{{ values.timeout|default("5s") }}"
+  urls = {{ values.urls|default(["http://localhost/server-status?auto"]) }}
diff --git a/apache/meta/telegraf.yml b/apache/meta/telegraf.yml
new file mode 100644
index 0000000..a58a2e0
--- /dev/null
+++ b/apache/meta/telegraf.yml
@@ -0,0 +1,9 @@
+{%- from "apache/map.jinja" import server with context %}
+{%- if server is defined and server.get('enabled', False) and server.get('bind', {}).get('address') %}
+  {%- set ports = server.get('bind', {}).get('ports', [80]) %}
+agent:
+  input:
+    apache:
+      template: apache/files/telegraf.conf
+      urls: [ "http://{{ server.bind.address|replace('0.0.0.0', '127.0.0.1') }}:{{ ports|sort|first }}/server-status?auto" ]
+{%- endif %}
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
index 52c321a..ee4398e 100644
--- a/metadata/service/support.yml
+++ b/metadata/service/support.yml
@@ -13,3 +13,5 @@
         enabled: true
       grafana:
         enabled: true
+      telegraf:
+        enabled: true