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

Feature/monitoring syncid

See merge request !7
diff --git a/linux/files/sphinx.grain b/linux/files/sphinx.grain
index 63413ab..6fc2931 100644
--- a/linux/files/sphinx.grain
+++ b/linux/files/sphinx.grain
@@ -1,9 +1,10 @@
-sphinx_doc:
+{%- set grains = {'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) }}
+{%- macro load_grains_file() %}{% include grains_fragment_file %}{% endmacro %}
+{%- set grains_yaml = load_grains_file()|load_yaml %}
+{%- set _dummy = grains.sphinx.doc.update({ service_name: grains_yaml.doc }) %}
 {%- endif %}
 {%- endfor %}
+{{ grains|yaml(False) }}
\ No newline at end of file
diff --git a/linux/meta/collectd.yml b/linux/meta/collectd.yml
index 2937f6d..1c7a7db 100644
--- a/linux/meta/collectd.yml
+++ b/linux/meta/collectd.yml
@@ -1,43 +1,44 @@
-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
+plugin:
+  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
index ec9de01..7157ca3 100644
--- a/linux/meta/heka.yml
+++ b/linux/meta/heka.yml
@@ -1,18 +1,19 @@
-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
+input:
+  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
index ae4f23b..ad65970 100644
--- a/linux/meta/sensu.yml
+++ b/linux/meta/sensu.yml
@@ -1,36 +1,37 @@
-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
+check:
+  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
index e074199..9075c8a 100644
--- a/linux/meta/sphinx.yml
+++ b/linux/meta/sphinx.yml
@@ -1,22 +1,23 @@
 {%- 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 }}
+doc:
+  name: Linux
+  role:
+    system:
+      name: System
+      param:
+        name:
+          value: {{ system.name }}
+        kernel:
+          value: {{ salt['grains.item']('kernel')['kernel'] }} {{ salt['grains.item']('kernelrelease')['kernelrelease'] }}
+        distribution:
+          value: {{ salt['grains.item']('lsb_distrib_description')['lsb_distrib_description'] }}
+    network:
+      name: Network
+      param:
+        fqdn:
+          name: FQDN
+          value: {{ network.fqdn }}
+        ip:
+          name: IP Addresses
+          value: {{ salt['grains.item']('ipv4')['ipv4'] }}
diff --git a/linux/system/doc.sls b/linux/system/doc.sls
index fbb63e6..55480ea 100644
--- a/linux/system/doc.sls
+++ b/linux/system/doc.sls
@@ -17,4 +17,14 @@
   - require:
     - file: linux_system_doc_grains_dir
 
+linux_system_doc_validity_check:
+  pkg.installed:
+  - name: python-yaml 
+  cmd.wait:
+  - name: python -c "import yaml; stream = file('/etc/salt/grains.d/sphinx', 'r'); yaml.load(stream); stream.close()"
+  - require:
+    - pkg: linux_system_doc_validity_check
+  - watch:
+    - file: linux_system_doc_grain
+
 {%- endif %}
\ No newline at end of file