Merge branch 'master' of github.com:tcpcloud/salt-formula-rabbitmq into stacklight
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
index 1bd7620..9ff0c47 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..ad1a997
--- /dev/null
+++ b/rabbitmq/files/collectd_rabbitmq_info.conf
@@ -0,0 +1,8 @@
+{%- from "rabbitmq/map.jinja" import server with context %}
+
+Import "rabbitmq_info"
+
+<Module "rabbitmq_info">
+  Password "{{ plugin.username }}"
+  Username "{{ plugin.password }}"
+</Module>
diff --git a/rabbitmq/meta/collectd.yml b/rabbitmq/meta/collectd.yml
index f52a4fa..d3832d1 100644
--- a/rabbitmq/meta/collectd.yml
+++ b/rabbitmq/meta/collectd.yml
@@ -1,14 +1,12 @@
+{%- from "rabbitmq/map.jinja" import server with context %}
 plugin:
- # rabbitmq_server_rabbitmq:
-  #  plugin: rabbitmq
-   # interval: 60
-    #template: rabbitmq/files/collectd_rabbitmq.conf
+  rabbitmq_info:
+    plugin: python
+    execution: local
+    template: rabbitmq/files/collectd_rabbitmq_info.conf
+    username: {{ server.admin.username }}
+    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..90cd4ae 100644
--- a/rabbitmq/meta/heka.yml
+++ b/rabbitmq/meta/heka.yml
@@ -1,15 +1,51 @@
-{%- 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_service:
+      engine: sandbox
+      module_file: /usr/share/lma_collector/decoders/rabbitmq.lua
+      module_dir: /usr/share/lma_collector_modules;/usr/share/heka/lua_modules
+      config:
+        include_full_notification: false
+  input:
+    rabbitmq_log_stream:
+      engine: logstreamer
+      log_directory: "/var/log/rabbitmq"
+      file_match: 'rabbit@(?P<Node>.+)\.log$'
+      differentiator: ["rabbitmq.", "Node"]
+      decoder: "rabbitmq_decoder"
+      splitter: "rabbitmq_splitter"
+  splitter:
+    rabbitmq_splitter:
+      engine: token
+      delimiter: '\n\n(=[^=]+====)'
+      delimiter_eol: false
+metric_collector:
+  filter:
+    rabbitmq_service_status:
+      engine: sandbox
+      module_file: /usr/share/lma_collector/filters/afd.lua
+      module_dir: /usr/share/lma_collector_modules;/usr/share/heka/lua_modules
+      preserve_data: false
+      message_matcher: "(Type == 'metric' || Type == 'heka.sandbox.metric') && (Fields[name] == 'rabbitmq_check')"
+      ticker_interval: 10
+      config:
+        afd_type: 'service'
+        afd_file: 'lma_alarms_rabbitmq_service_check'
+        afd_cluster_name: 'rabbitmq-service'
+        afd_logical_name: 'check'
+        activate_alerting: true
+        enable_notification: false
+    rabbitmq_cluster_disk:
+      engine: sandbox
+      module_file: /usr/share/lma_collector/filters/afd.lua
+      module_dir: /usr/share/lma_collector_modules;/usr/share/heka/lua_modules
+      preserve_data: false
+      message_matcher: "(Type == 'metric' || Type == 'heka.sandbox.metric') && (Fields[name] == 'rabbitmq_remaining_disk')"
+      ticker_interval: 10
+      config:
+        afd_type: 'service'
+        afd_file: 'lma_alarms_rabbitmq_cluster_disk'
+        afd_cluster_name: 'rabbitmq-cluster'
+        afd_logical_name: 'disk'
+        activate_alerting: true
+        enable_notification: false