Merge branch 'feature/nginx-metrics' into 'master'

Feature/nginx metrics

See merge request !5
diff --git a/README.rst b/README.rst
index a619b27..80bc797 100644
--- a/README.rst
+++ b/README.rst
@@ -176,6 +176,22 @@
               name: gitlab.domain.com
               port: 443
 
+Nginx stats server (required by collectd nginx plugin)
+
+.. code-block::
+
+    nginx:
+      server:
+        enabled: true
+        site:
+          nginx_stats_server:
+            enabled: true
+            type: nginx_stats
+            name: server
+            host:
+              name: 127.0.0.1
+              port: 8888
+
 Read more
 =========
 
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
index 1c1c808..f0b2ed4 100644
--- a/metadata/service/support.yml
+++ b/metadata/service/support.yml
@@ -2,7 +2,7 @@
   nginx:
     _support:
       collectd:
-        enabled: false
+        enabled: true
       heka:
         enabled: false
       sensu:
diff --git a/nginx/files/stats.conf b/nginx/files/stats.conf
new file mode 100644
index 0000000..851a162
--- /dev/null
+++ b/nginx/files/stats.conf
@@ -0,0 +1,14 @@
+{%- set site = salt['pillar.get']('nginx:server:site:'+site_name) %}
+
+server {
+    listen {{ site.host.get("port", 8888) }};
+
+    location / {
+        stub_status on;
+
+        access_log off;
+        allow 127.0.0.1;
+        deny all;
+    }
+}
+
diff --git a/nginx/meta/collectd.yml b/nginx/meta/collectd.yml
index e69de29..74051bb 100644
--- a/nginx/meta/collectd.yml
+++ b/nginx/meta/collectd.yml
@@ -0,0 +1,7 @@
+
+plugin:
+  collectd_nginx:
+    plugin: nginx
+    interval: 60
+    template: collectd/files/collectd_nginx.conf
+
diff --git a/nginx/server/sites.sls b/nginx/server/sites.sls
index 4a0a2c5..dc0eb65 100644
--- a/nginx/server/sites.sls
+++ b/nginx/server/sites.sls
@@ -69,6 +69,8 @@
   - source: salt://nginx/files/redirect.conf
   {%- elif site.type == 'nginx_static' %}
   - source: salt://nginx/files/static.conf
+  {%- elif site.type == 'nginx_stats' %}
+  - source: salt://nginx/files/stats.conf
   {%- else %}
   - source: salt://{{ site.type }}/files/nginx.conf
   {%- endif %}