Fix collectd support
diff --git a/nginx/files/collectd_nginx.conf b/nginx/files/collectd_nginx.conf
index 2a98127..2c55706 100644
--- a/nginx/files/collectd_nginx.conf
+++ b/nginx/files/collectd_nginx.conf
@@ -1,13 +1,7 @@
-{%- from "nginx/map.jinja" import server with context %}
-
 <LoadPlugin nginx>
   Globals false
 </LoadPlugin>
 
-{%- if server.site.nginx_stats_server is defined %}
-
 <Plugin nginx>
-  URL "http://localhost:{{ server.site.nginx_stats_server.host.port }}"
+  URL "{{ plugin.url }}"
 </Plugin>
-
-{%- endif %}
diff --git a/nginx/meta/collectd.yml b/nginx/meta/collectd.yml
index c859306..1db71e1 100644
--- a/nginx/meta/collectd.yml
+++ b/nginx/meta/collectd.yml
@@ -1,6 +1,11 @@
+{%- if pillar.nginx.server is defined %}
+{%- from "nginx/map.jinja" import server with context %}
 
-plugin:
-  nginx_server_status:
+{%- if server.get('enabled', False) and server.get('site', {}).nginx_stats_server is defined %}
+local_plugin:
+  collectd_nginx:
     plugin: nginx
-    execution: local
     template: nginx/files/collectd_nginx.conf
+    url: http://localhost:{{ server.site.nginx_stats_server.host.port }}
+{%- endif %}
+{%- endif %}