Merge "Update .travis.yml and .kitchen.yml files for parallel testing"
diff --git a/telegraf/agent.sls b/telegraf/agent.sls
index 603bd37..e082e6d 100644
--- a/telegraf/agent.sls
+++ b/telegraf/agent.sls
@@ -59,7 +59,11 @@
       - service: telegraf_service_agent
     - defaults:
         name: {{ name }}
+{%- if values is mapping %}
         values: {{ values }}
+{%- else %}
+        values: {}
+{%- endif %}
 
 {%- if name in ('ceph', 'docker', 'haproxy') %}
 telegraf_user_in_group_{{ name }}:
@@ -94,7 +98,11 @@
       - service: telegraf_service_agent
     - defaults:
         name: {{ name }}
+{%- if values is mapping %}
         values: {{ values }}
+{%- else %}
+        values: {}
+{%- endif %}
 
 {%- endfor %}
 
diff --git a/telegraf/files/input/_common.conf b/telegraf/files/input/_common.conf
new file mode 100644
index 0000000..7c1e6bf
--- /dev/null
+++ b/telegraf/files/input/_common.conf
@@ -0,0 +1,12 @@
+{%- if values.interval is defined %}
+interval = "{{ values.interval }}"
+{%- endif %}
+{%- if values.name_override is defined %}
+name_override = "{{ values.name_override }}"
+{%- endif %}
+{%- if values.name_prefix is defined %}
+name_prefix = "{{ values.name_prefix }}"
+{%- endif %}
+{%- if values.name_suffix is defined %}
+name_suffix = "{{ values.name_suffix }}"
+{%- endif %}
diff --git a/telegraf/files/input/cpu.conf b/telegraf/files/input/cpu.conf
index e698905..300c56a 100644
--- a/telegraf/files/input/cpu.conf
+++ b/telegraf/files/input/cpu.conf
@@ -1,10 +1,9 @@
 [[inputs.{{ name }}]]
-{%- if values is defined %}
+{%- include 'telegraf/files/input/_common.conf' %}
 {%- if values.totalcpu is defined %}
   totalcpu = {{ values.totalcpu | lower }}
 {%- endif %}
 {%- if values.percpu is defined %}
   percpu = {{ values.percpu | lower }}
 {%- endif %}
-{%- include 'telegraf/files/input/_tags.conf' %}
-{%- endif %}
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/disk.conf b/telegraf/files/input/disk.conf
index 8f210c9..a1b773e 100644
--- a/telegraf/files/input/disk.conf
+++ b/telegraf/files/input/disk.conf
@@ -1,10 +1,9 @@
 [[inputs.{{ name }}]]
-{%- if values is defined %}
+{%- include 'telegraf/files/input/_common.conf' %}
 {%- if values.mount_points is defined%}
   mount_points = {{ values.mount_points }}
 {%- endif %}
 {%- if values.ignore_fs is defined%}
   ignore_fs = {{ values.ignore_fs | json }}
 {%- endif %}
-{%- include 'telegraf/files/input/_tags.conf' %}
-{%- endif %}
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/diskio.conf b/telegraf/files/input/diskio.conf
index f088584..b98435f 100644
--- a/telegraf/files/input/diskio.conf
+++ b/telegraf/files/input/diskio.conf
@@ -1,10 +1,9 @@
 [[inputs.{{ name }}]]
-{%- if values is defined %}
+{%- include 'telegraf/files/input/_common.conf' %}
 {%- if values.devices is defined %}
   devices = {{ values.devices }}
 {%- endif %}
 {%- if values.skip_serial_number is defined %}
   skip_serial_number = {{ values.skip_serial_number | lower }}
 {%- endif %}
-{%- include 'telegraf/files/input/_tags.conf' %}
-{%- endif %}
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/docker.conf b/telegraf/files/input/docker.conf
index eec5d16..d4b8003 100644
--- a/telegraf/files/input/docker.conf
+++ b/telegraf/files/input/docker.conf
@@ -1,5 +1,5 @@
 [[inputs.{{ name }}]]
-{%- if values is defined %}
+{%- include 'telegraf/files/input/_common.conf' %}
 {%- if values.endpoint is defined %}
   endpoint = "{{ values.endpoint }}"
 {%- endif %}
@@ -12,5 +12,4 @@
 {%- if values.total is defined %}
   total = {{ values.total | lower }}
 {%- endif %}
-{%- include 'telegraf/files/input/_tags.conf' %}
-{%- endif %}
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/elasticsearch.conf b/telegraf/files/input/elasticsearch.conf
index 8956a02..f745a95 100644
--- a/telegraf/files/input/elasticsearch.conf
+++ b/telegraf/files/input/elasticsearch.conf
@@ -1,7 +1,8 @@
 [[inputs.elasticsearch]]
+{%- include 'telegraf/files/input/_common.conf' %}
   servers = [{%- for server in values.servers|default([]) %}"{{ server }}"{%- if not loop.last%}, {% endif %} {%- endfor %}]
   http_timeout = "{{ values.http_timeout|default("5s") }}"
   local = {{ values.local|default("true")|lower }}
   cluster_health = {{ values.cluster_heatlh|default("true")|lower }}
   cluster_stats = {{ values.cluster_stats|default("true")|lower }}
-
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/exec.conf b/telegraf/files/input/exec.conf
new file mode 100644
index 0000000..e7ee360
--- /dev/null
+++ b/telegraf/files/input/exec.conf
@@ -0,0 +1,12 @@
+{%- if values.commands is defined %}
+[[inputs.exec]]
+commands = {%- if values.commands is list %}{{ values.commands|json }}{%- else %}[ "{{ values.commands }}" ]{%- endif %}
+{%- if values.timeout is defined %}
+timeout = "{{ values.timeout }}"
+{%- endif %}
+{%- if values.interval is defined %}
+interval = "{{ values.interval }}"
+{%- endif %}
+data_format = "{{ values.data_format|default('influx') }}"
+{%- include 'telegraf/files/input/_filters.conf' %}
+{%- endif %}
diff --git a/telegraf/files/input/generic.conf b/telegraf/files/input/generic.conf
index a502414..78977b4 100644
--- a/telegraf/files/input/generic.conf
+++ b/telegraf/files/input/generic.conf
@@ -1,2 +1,3 @@
 [[inputs.{{ name }}]]
-{%- include 'telegraf/files/input/_tags.conf' %}
+{%- include 'telegraf/files/input/_common.conf' %}
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/haproxy.conf b/telegraf/files/input/haproxy.conf
index e054b0e..77ccbda 100644
--- a/telegraf/files/input/haproxy.conf
+++ b/telegraf/files/input/haproxy.conf
@@ -1,4 +1,4 @@
 [[inputs.haproxy]]
-  servers = [{%- for server in values.servers|default([]) %}"{{ server }}"{%- if not loop.last%}, {% endif %} {%- endfor %}]
-
-{%- include 'telegraf/files/input/_tags.conf' %}
+{%- include 'telegraf/files/input/_common.conf' %}
+servers = [{%- for server in values.servers|default([]) %}"{{ server }}"{%- if not loop.last%}, {% endif %} {%- endfor %}]
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/http_listener.conf b/telegraf/files/input/http_listener.conf
index 41f106b..e7745e6 100644
--- a/telegraf/files/input/http_listener.conf
+++ b/telegraf/files/input/http_listener.conf
@@ -1,6 +1,6 @@
 [[inputs.http_listener]]
- service_address = "{{ values.get('bind', {}).address|default('127.0.0.1') }}:{{ values.get('bind', {}).port|default('8186') }}"
- read_timeout = "{{ values.get('read_timeout', '10s') }}"
- write_timeout = "{{ values.get('write_timeout', '10s') }}"
-
-{%- include 'telegraf/files/input/_tags.conf' %}
+{%- include 'telegraf/files/input/_common.conf' %}
+service_address = "{{ values.get('bind', {}).address|default('127.0.0.1') }}:{{ values.get('bind', {}).port|default('8186') }}"
+read_timeout = "{{ values.get('read_timeout', '10s') }}"
+write_timeout = "{{ values.get('write_timeout', '10s') }}"
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/http_response.conf b/telegraf/files/input/http_response.conf
index 2494fdd..09307e3 100644
--- a/telegraf/files/input/http_response.conf
+++ b/telegraf/files/input/http_response.conf
@@ -1,4 +1,5 @@
 [[inputs.http_response]]
+{%- include 'telegraf/files/input/_common.conf' %}
   {%- for endpoint, parameters in values.iteritems() %}
     {%- if parameters.address is defined %}
   [[inputs.http_response.checks]]
@@ -8,3 +9,4 @@
       {%- endfor %}
     {%- endif %}
   {%- endfor %}
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/influxdb.conf b/telegraf/files/input/influxdb.conf
index f9acde9..7640767 100644
--- a/telegraf/files/input/influxdb.conf
+++ b/telegraf/files/input/influxdb.conf
@@ -1,4 +1,5 @@
 [[inputs.influxdb]]
-  urls = [{%- for server in values.servers|default([]) %}"{{ server.url }}"{%- if not loop.last%}, {% endif %} {%- endfor %}]
-  timeout = "{{ values.timeout|default(5) }}s"
-{%- include 'telegraf/files/input/_tags.conf' %}
+{%- include 'telegraf/files/input/_common.conf' %}
+urls = [{%- for server in values.servers|default([]) %}"{{ server.url }}"{%- if not loop.last%}, {% endif %} {%- endfor %}]
+timeout = "{{ values.timeout|default(5) }}s"
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/memcached.conf b/telegraf/files/input/memcached.conf
index b4cd5e3..27359d1 100644
--- a/telegraf/files/input/memcached.conf
+++ b/telegraf/files/input/memcached.conf
@@ -1,3 +1,4 @@
 [[inputs.memcached]]
-  servers = [{%- for server in values.servers|default([]) %}"{{ server.address }}:{{ server.port }}"{%- if not loop.last%}, {% endif %} {%- endfor %}]
-{%- include 'telegraf/files/input/_tags.conf' %}
+{%- include 'telegraf/files/input/_common.conf' %}
+servers = [{%- for server in values.servers|default([]) %}"{{ server.address }}:{{ server.port }}"{%- if not loop.last%}, {% endif %} {%- endfor %}]
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/mysql.conf b/telegraf/files/input/mysql.conf
index 3d32300..bba011a 100644
--- a/telegraf/files/input/mysql.conf
+++ b/telegraf/files/input/mysql.conf
@@ -1,6 +1,5 @@
-{%- if values.address is defined %}
 [[inputs.mysql]]
-  servers = [ "{{ values.username }}:{{ values.password }}@{{ values.protocol|default("unix") }}({{ values.address }})/" ]
-  interval_slow = "{{ values.interval_slow|default("15m") }}"
-{%- include 'telegraf/files/input/_tags.conf' %}
-{%- endif %}
+{%- include 'telegraf/files/input/_common.conf' %}
+servers = [ "{{ values.username }}:{{ values.password }}@{{ values.protocol|default("unix") }}({{ values.address }})/" ]
+interval_slow = "{{ values.interval_slow|default("15m") }}"
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/net.conf b/telegraf/files/input/net.conf
index a502414..0d62f38 100644
--- a/telegraf/files/input/net.conf
+++ b/telegraf/files/input/net.conf
@@ -1,2 +1,6 @@
-[[inputs.{{ name }}]]
-{%- include 'telegraf/files/input/_tags.conf' %}
+[[inputs.net]]
+{%- include 'telegraf/files/input/_common.conf' %}
+{%- if values.interfaces is defined %}
+interfaces = {%- if values.interfaces is list %}{{ values.interfaces|json }}{%- else %}[ "{{ values.interfaces }}" ]{%- endif %}
+{%- endif %}
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/openstack.conf b/telegraf/files/input/openstack.conf
index 663343e..37ddc60 100644
--- a/telegraf/files/input/openstack.conf
+++ b/telegraf/files/input/openstack.conf
@@ -6,3 +6,4 @@
   identity_endpoint = "{{ values.identity_endpoint }}"
   monitor_agents = {{ values.monitor_agents|default("true")|lower }}
   cpu_ratio = {{ values.cpu_ratio|default(1.0) }}
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/files/input/procstat.conf b/telegraf/files/input/procstat.conf
index 11330ba..934b340 100644
--- a/telegraf/files/input/procstat.conf
+++ b/telegraf/files/input/procstat.conf
@@ -1,6 +1,9 @@
 {%- for item_name, item in values.get('process', {}).iteritems() %}
 {%- if item.get('enabled', True) %}
 [[inputs.{{ name }}]]
+{%- if item.interval is defined %}
+  interval = "{{ item.interval }}"
+{%- endif %}
 {%- if item.pid_file is defined %}
   pid_file = "{{ item.pid_file }}"
 {%- endif %}
diff --git a/telegraf/files/input/zookeeper.conf b/telegraf/files/input/zookeeper.conf
index 205c030..baaa279 100644
--- a/telegraf/files/input/zookeeper.conf
+++ b/telegraf/files/input/zookeeper.conf
@@ -1,2 +1,4 @@
 [[inputs.zookeeper]]
-  servers = ["{{ values.address|default("127.0.0.1") }}:{{ values.port|default(2181) }}"]
+{%- include 'telegraf/files/input/_common.conf' %}
+servers = ["{{ values.address|default("127.0.0.1") }}:{{ values.port|default(2181) }}"]
+{%- include 'telegraf/files/input/_filters.conf' %}
diff --git a/telegraf/remote_agent.sls b/telegraf/remote_agent.sls
index cd87a45..d96d351 100644
--- a/telegraf/remote_agent.sls
+++ b/telegraf/remote_agent.sls
@@ -80,7 +80,11 @@
       - file: config_d_dir_remote_agent_clean
     - defaults:
         name: {{ name }}
+{%- if values is mapping %}
         values: {{ values }}
+{%- else %}
+        values: {}
+{%- endif %}
 
 {%- endif %}
 
@@ -106,7 +110,11 @@
       - file: config_d_dir_remote_agent_clean
     - defaults:
         name: {{ name }}
+{%- if values is mapping %}
         values: {{ values }}
+{%- else %}
+        values: {}
+{%- endif %}
 
 {%- endfor %}