Merge branch 'feature/monitoring-syncid' into 'master'

Feature/monitoring syncid

See merge request !5
diff --git a/linux/files/collectd.conf b/linux/files/collectd.conf
index 02c0101..56c3106 100644
--- a/linux/files/collectd.conf
+++ b/linux/files/collectd.conf
@@ -1,3 +1,4 @@
+
 LoadPlugin cpu
 LoadPlugin df
 LoadPlugin disk
@@ -33,7 +34,5 @@
 </Plugin>
 
 <Plugin disk>
-#  Disk "hda"
-#  Disk "/sda[23]/"
   IgnoreSelected true
 </Plugin>
diff --git a/linux/files/collectd_df.conf b/linux/files/collectd_df.conf
new file mode 100644
index 0000000..b7ac768
--- /dev/null
+++ b/linux/files/collectd_df.conf
@@ -0,0 +1,9 @@
+LoadPlugin df
+<Plugin df>
+  {%- for fs_type in plugin.get('fs_types', []) %}
+  FSType {{ fs_type }}
+  {%- endfor %}
+  {%- if plugin.get('ignore_selected', False) %}
+  IgnoreSelected true
+  {%- endif %}
+</Plugin>
diff --git a/linux/files/collectd_disk.conf b/linux/files/collectd_disk.conf
new file mode 100644
index 0000000..50c5288
--- /dev/null
+++ b/linux/files/collectd_disk.conf
@@ -0,0 +1,6 @@
+LoadPlugin disk
+<Plugin disk>
+  {%- if plugin.get('ignore_selected', False) %}
+  IgnoreSelected true
+  {%- endif %}
+</Plugin>
diff --git a/linux/files/sphinx.grain b/linux/files/sphinx.grain
new file mode 100644
index 0000000..e1bf48c
--- /dev/null
+++ b/linux/files/sphinx.grain
@@ -0,0 +1,9 @@
+sphinx_doc:
+{%- for service_name, service in pillar.items() %}
+{%- if service.get('_support', {}).get('sphinx', {}).get('enabled', False) %}
+{%- set grains_fragment_file = service_name+'/meta/sphinx.yml' %}
+  {{ service_name }}:
+{%- macro indent_grains_dict() %}{% include grains_fragment_file %}{% endmacro %}
+{{ indent_grains_dict()|indent(4, true) }}
+{%- endif %}
+{%- endfor %}
\ No newline at end of file
diff --git a/linux/meta/collectd.yml b/linux/meta/collectd.yml
new file mode 100644
index 0000000..2937f6d
--- /dev/null
+++ b/linux/meta/collectd.yml
@@ -0,0 +1,43 @@
+linux_network_interface:
+  plugin: interface
+  interval: 60
+linux_system_cpu:
+  plugin: cpu
+  interval: 60
+linux_system_entropy:
+  plugin: entropy
+  interval: 60
+linux_system_memory:
+  plugin: memory
+  interval: 60
+linux_system_processes:
+  plugin: processes
+  interval: 60
+linux_system_uptime:
+  plugin: uptime
+  interval: 60
+linux_system_users:
+  plugin: users
+  interval: 60
+linux_storage_df:
+  plugin: df
+  interval: 60
+  template: linux/files/collectd_df.conf
+  ignore_selected: true
+  fs_types:
+  - rootfs
+  - sysfs
+  - proc
+  - devtmpfs
+  - devpts
+  - tmpfs
+  - fusectl
+  - cgroup
+linux_storage_disk:
+  plugin: disk
+  interval: 60
+  template: linux/files/collectd_disk.conf
+  ignore_selected: true
+linux_storage_swap:
+  plugin: swap
+  interval: 60
diff --git a/linux/meta/heka.yml b/linux/meta/heka.yml
new file mode 100644
index 0000000..ec9de01
--- /dev/null
+++ b/linux/meta/heka.yml
@@ -0,0 +1,18 @@
+linux_rsyslog_syslog:
+  engine: logstreamer
+  log_directory: /var/log
+  file_match: syslog\.?(?P<Index>\d+)?(.gz)?
+  priority: ["^Index"]
+  decoder: RsyslogDecoder
+linux_rsyslog_auth:
+  engine: logstreamer
+  log_directory: /var/log
+  file_match: auth\.log\.?(?P<Index>\d+)?(.gz)?
+  priority: ["^Index"]
+  decoder: RsyslogDecoder
+linux_rsyslog_kern:
+  engine: logstreamer
+  log_directory: /var/log
+  file_match: kern\.log\.?(?P<Index>\d+)?(.gz)?
+  priority: ["^Index"]
+  decoder: RsyslogDecoder
diff --git a/linux/meta/sensu.yml b/linux/meta/sensu.yml
new file mode 100644
index 0000000..ae4f23b
--- /dev/null
+++ b/linux/meta/sensu.yml
@@ -0,0 +1,36 @@
+local_linux_system_zombie_procs:
+  command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_procs -w 2 -c 7 -s Z"
+  interval: 60
+  occurrences: 3
+  subscribers:
+  - local-linux-system
+local_linux_system_total_procs:
+  command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_procs -w 1500 -c 3000"
+  interval: 60
+  occurrences: 5
+  subscribers:
+  - local-linux-system
+local_linux_system_load:
+  command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_load -r -w 6,4,2 -c 12,8,4"
+  interval: 60
+  occurrences: 1
+  subscribers:
+  - local-linux-system
+local_linux_storage_swap_usage:
+  command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_swap -a -w 50% -c 20%"
+  interval: 60
+  occurrences: 1
+  subscribers:
+  - local-linux-storage
+local_linux_storage_disk_usage:
+  command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_disk -w 15% -c 5% -p / -p /var -p /usr -p /tmp -p /var/log"
+  interval: 60
+  occurrences: 1
+  subscribers:
+  - local-linux-storage
+local_linux_network_fqdn:
+  command: "PATH=$PATH:/etc/sensu/plugins check_fqdn.py -n :::hostname::: -f :::fqdn:::"
+  interval: 60
+  occurrences: 1
+  subscribers:
+  - local-linux-network
diff --git a/linux/meta/sphinx.yml b/linux/meta/sphinx.yml
new file mode 100644
index 0000000..e074199
--- /dev/null
+++ b/linux/meta/sphinx.yml
@@ -0,0 +1,22 @@
+{%- from "linux/map.jinja" import system with context -%}
+{%- from "linux/map.jinja" import network with context -%}
+name: Linux
+role:
+  system:
+    name: System
+    param:
+      name:
+        value: {{ system.name }}
+      kernel:
+        value: {{ grains.kernel }} {{ grains.kernelrelease }}
+      distribution:
+        value: {{ grains.lsb_distrib_description }}
+  network:
+    name: Network
+    param:
+      fqdn:
+        name: FQDN
+        value: {{ network.fqdn }}
+      ip:
+        name: IP Addresses
+        value: {{ grains.ipv4 }}
diff --git a/linux/system/doc.sls b/linux/system/doc.sls
new file mode 100644
index 0000000..fbb63e6
--- /dev/null
+++ b/linux/system/doc.sls
@@ -0,0 +1,20 @@
+{%- from "linux/map.jinja" import system with context %}
+{%- if system.enabled %}
+
+linux_system_doc_grains_dir:
+  file.directory:
+  - name: /etc/salt/grains.d
+  - mode: 700
+  - makedirs: true
+  - user: root
+
+linux_system_doc_grain:
+  file.managed:
+  - name: /etc/salt/grains.d/sphinx
+  - source: salt://linux/files/sphinx.grain
+  - template: jinja
+  - mode: 600
+  - require:
+    - file: linux_system_doc_grains_dir
+
+{%- endif %}
\ No newline at end of file
diff --git a/linux/system/init.sls b/linux/system/init.sls
index f46bf09..b81da9f 100644
--- a/linux/system/init.sls
+++ b/linux/system/init.sls
@@ -36,3 +36,6 @@
 {%- if system.console is defined %}
 - linux.system.console
 {%- endif %}
+{%- if system.doc is defined %}
+- linux.system.doc
+{%- endif %}
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
new file mode 100644
index 0000000..55cb43b
--- /dev/null
+++ b/metadata/service/support.yml
@@ -0,0 +1,11 @@
+parameters:
+  linux:
+    _support:
+      collectd:
+        enabled: true
+      heka:
+        enabled: false
+      sensu:
+        enabled: true
+      sphinx:
+        enabled: true
diff --git a/metadata/service/system/init.yml b/metadata/service/system/init.yml
index 2c3d614..2c4cc9c 100644
--- a/metadata/service/system/init.yml
+++ b/metadata/service/system/init.yml
@@ -1,18 +1,11 @@
 applications:
 - linux
+classes:
+- service.linux.support
 parameters:
   linux:
     system:
       enabled: true
-      logging:
-        heka:
-          enabled: false
-      metering:
-        collectd:
-          enabled: true
-      monitoring:
-        sensu:
-          enabled: true
       user:
         root:
           enabled: true