Merge remote-tracking branch 'origin/master' into stacklight-sync-master
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
index 5f2e84d..43a86c4 100644
--- a/metadata/service/support.yml
+++ b/metadata/service/support.yml
@@ -4,7 +4,7 @@
       collectd:
         enabled: true
       heka:
-        enabled: false
+        enabled: true
       sensu:
         enabled: true
       sphinx:
diff --git a/rabbitmq/files/collectd_rabbitmq.conf b/rabbitmq/files/collectd_rabbitmq.conf
deleted file mode 100644
index 70aa668..0000000
--- a/rabbitmq/files/collectd_rabbitmq.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-LoadPlugin python
-<Plugin python>
-
-  ModulePath "/usr/lib/collectd-plugins/"
-  LogTraces true
-  Interactive false
-  Import rabbitmq
-
-  <Module rabbitmq>
-
-    Username "guest"
-    Password "guest"
-    Realm "RabbitMQ Management"
-    Host "localhost"
-    Port "15672"
-
-    <Ignore "queue">
-      Regex "amq-gen-.*"
-      Regex "tmp-.*"
-    </Ignore>
-
-  </Module>
-
-</Plugin>
\ No newline at end of file
diff --git a/rabbitmq/files/collectd_rabbitmq_info.conf b/rabbitmq/files/collectd_rabbitmq_info.conf
new file mode 100644
index 0000000..fae857f
--- /dev/null
+++ b/rabbitmq/files/collectd_rabbitmq_info.conf
@@ -0,0 +1,8 @@
+Import "rabbitmq_info"
+
+<Module "rabbitmq_info">
+    Host "{{ plugin.host }}"
+    Port "{{ plugin.port }}"
+    Username "{{ plugin.username }}"
+    Password "{{ plugin.password }}"
+</Module>
diff --git a/rabbitmq/meta/collectd.yml b/rabbitmq/meta/collectd.yml
index f52a4fa..eefe46d 100644
--- a/rabbitmq/meta/collectd.yml
+++ b/rabbitmq/meta/collectd.yml
@@ -1,14 +1,13 @@
-plugin:
- # rabbitmq_server_rabbitmq:
-  #  plugin: rabbitmq
-   # interval: 60
-    #template: rabbitmq/files/collectd_rabbitmq.conf
+{%- from "rabbitmq/map.jinja" import server with context %}
+local_plugin:
+  rabbitmq_info:
+    plugin: python
+    template: rabbitmq/files/collectd_rabbitmq_info.conf
+    host: {{ server.management.bind.address }}
+    port: {{ server.management.bind.port }}
+    username: {{ server.admin.name }}
+    password: {{ server.admin.password }}
   collectd_processes:
-    plugin: processes
-    interval: 60
-    template: collectd/files/collectd_processes.conf
     process:
       rabbitmq:
         match: '^[-\.\/a-z0-9]+beam(\.smp)?\ .*/var/lib/rabbitmq.*kernel.*mnesia.*'
-      collectdmon:
-        match: collectdmon
\ No newline at end of file
diff --git a/rabbitmq/meta/heka.yml b/rabbitmq/meta/heka.yml
index a33f56c..b5bbc5e 100644
--- a/rabbitmq/meta/heka.yml
+++ b/rabbitmq/meta/heka.yml
@@ -1,15 +1,19 @@
-{%- if pillar.rabbitmq.server is defined %}
-input:
-  logstreamer_rabbitmq:
-	type: "LogstreamerInput"
-	log_directory: "/var/log/rabbitmq"
-	file_match: 'rabbit@.+\.log\.?(?P<Index>\d+)?(.gz)?'
-	priority: ["^Index"]
-	decoder: "rabbitmq"
-	oldest_duration: "168h"
-decoder:
-  rabbitmq:
-    type: "SandboxDecoder"
-    filename: "lua_modules/decoders/rabbitmq.lua"
-    module_directory: "/usr/share/heka/lua_modules;/usr/share/heka/lua_modules/common"
-{% endif %}
+log_collector:
+  decoder:
+    rabbitmq_log:
+      engine: sandbox
+      module_file: /usr/share/lma_collector/decoders/rabbitmq.lua
+      module_dir: /usr/share/lma_collector/common;/usr/share/heka/lua_modules
+  input:
+    rabbitmq_log:
+      engine: logstreamer
+      log_directory: "/var/log/rabbitmq"
+      file_match: 'rabbit@(?P<Node>.+)\.log$'
+      differentiator: ["rabbitmq.", "Node"]
+      decoder: "rabbitmq_log_decoder"
+      splitter: "rabbitmq_log_splitter"
+  splitter:
+    rabbitmq_log:
+      engine: regex
+      delimiter: '\n\n(=[^=]+====)'
+      delimiter_eol: false