Merge "Fix namespace handler to preinstall linux.system.pkgs"
diff --git a/.gitreview b/.gitreview
deleted file mode 100644
index 8799235..0000000
--- a/.gitreview
+++ /dev/null
@@ -1,5 +0,0 @@
-[gerrit]
-host=gerrit.mcp.mirantis.net
-port=29418
-project=salt-formulas/linux
-
diff --git a/README.rst b/README.rst
index 7d67889..51e6370 100644
--- a/README.rst
+++ b/README.rst
@@ -234,6 +234,9 @@
           automatic_reboot_time: "02:00"
 
 Linux with cron jobs
+By default it will use name as an identifier, unless identifier key is
+explicitly set or False (then it will use Salt's default behavior which is
+identifier same as command resulting in not being able to change it)
 
 .. code-block:: yaml
 
@@ -243,6 +246,7 @@
         job:
           cmd1:
             command: '/cmd/to/run'
+            identifier: cmd1
             enabled: true
             user: 'root'
             hour: 2
diff --git a/linux/map.jinja b/linux/map.jinja
index 703c9c9..29209b1 100644
--- a/linux/map.jinja
+++ b/linux/map.jinja
@@ -217,6 +217,7 @@
         },
         'free_memory_percentage': {
               'warn': 10.0,
+              'crit': 5.0,
         },
         'load_5': {
               'warn': 3,
diff --git a/linux/meta/collectd.yml b/linux/meta/collectd.yml
index 0bd2b55..d38f1ae 100644
--- a/linux/meta/collectd.yml
+++ b/linux/meta/collectd.yml
@@ -36,6 +36,7 @@
     - tmpfs
     - fusectl
     - cgroup
+    - overlay
   linux_storage_disk:
     plugin: disk
     template: linux/files/collectd_disk.conf
diff --git a/linux/meta/prometheus.yml b/linux/meta/prometheus.yml
index f6f91c2..d2b3d05 100644
--- a/linux/meta/prometheus.yml
+++ b/linux/meta/prometheus.yml
@@ -31,16 +31,26 @@
         summary: 'Free inodes for {{ $labels.path }} too low on {{ $labels.host }}'
         description: 'The disk inodes ({{ $labels.path }}) will be full in less than 8 hours on {{ $labels.host }}.'
       {% endraw %}
-    SystemMemoryAvailableTooLow:
-      {%- set mem_avail_threshold = monitoring.free_memory_percentage.warn|float %}
-      if: avg_over_time(mem_available_percent[5m]) < {{ mem_avail_threshold }}
+    SystemMemoryAvailableLow:
+      {%- set mem_avail_warn_threshold = monitoring.free_memory_percentage.warn|float %}
+      if: avg_over_time(mem_available_percent[5m]) < {{ mem_avail_warn_threshold }}
       {% raw %}
       labels:
         severity: warning
         service: system
       annotations:
+        summary: 'Free memory low on {{ $labels.host }}'
+        description: 'The percentage of free memory is low on node {{ $labels.host }} (current value={{ $value }}%, threshold={% endraw %}{{ mem_avail_warn_threshold }}%).'
+    SystemMemoryAvailableTooLow:
+      {%- set mem_avail_crit_threshold = monitoring.free_memory_percentage.crit|float %}
+      if: avg_over_time(mem_available_percent[5m]) < {{ mem_avail_crit_threshold }}
+      {% raw %}
+      labels:
+        severity: critical
+        service: system
+      annotations:
         summary: 'Free memory too low on {{ $labels.host }}'
-        description: 'The percentage of free memory is too low on node {{ $labels.host }} (current value={{ $value }}%, threshold={% endraw %}{{ mem_avail_threshold }}%).'
+        description: 'The percentage of free memory is too low on node {{ $labels.host }} (current value={{ $value }}%, threshold={% endraw %}{{ mem_avail_crit_threshold }}%).'
     SystemLoad5TooHigh:
       if: system_load5 / system_n_cpus > {{ monitoring.load_5.warn }}
       {% raw %}
@@ -59,7 +69,7 @@
         service: system
       annotations:
         summary: 'Too many received packets dropped on {{ $labels.host }} for interface {{ $labels.interface }}'
-        description: 'The rate of received packets which are dropped is too high on node {{ $labels.host }} for interface {{ $label.interface }} (current value={{ $value }}/sec, threshold={% endraw %}{{ net_rx_dropped_threshold }}/sec)'
+        description: 'The rate of received packets which are dropped is too high on node {{ $labels.host }} for interface {{ $labels.interface }} (current value={{ $value }}/sec, threshold={% endraw %}{{ net_rx_dropped_threshold }}/sec)'
     SystemTxPacketsDroppedTooHigh:
       {%- set net_tx_dropped_threshold = monitoring.tx_packets_dropped_rate.warn %}
       if: rate(net_drop_out[1m]) > {{ net_tx_dropped_threshold }}
@@ -69,7 +79,7 @@
         service: system
       annotations:
         summary: 'Too many transmitted packets dropped on {{ $labels.host }} for interface {{ $labels.interface }}'
-        description: 'The rate of transmitted packets which are dropped is too high on node {{ $labels.host }} for interface {{ $label.interface }} (current value={{ $value }}/sec, threshold={% endraw %}{{ net_tx_dropped_threshold }}/sec)'
+        description: 'The rate of transmitted packets which are dropped is too high on node {{ $labels.host }} for interface {{ $labels.interface }} (current value={{ $value }}/sec, threshold={% endraw %}{{ net_tx_dropped_threshold }}/sec)'
     SystemSwapUsed:
       {%- set swap_used_threshold = monitoring.swap.warn.strip('%')|float %}
       if: avg_over_time(swap_used_percent[1m]) > {{ swap_used_threshold }}
diff --git a/linux/meta/telegraf.yml b/linux/meta/telegraf.yml
index e9d604f..2ff4386 100644
--- a/linux/meta/telegraf.yml
+++ b/linux/meta/telegraf.yml
@@ -1,9 +1,19 @@
 agent:
   input:
     cpu:
-      percpu: true
+      percpu: false
       totalcpu: true
     disk:
+      ignore_fs:
+        - rootfs
+        - sysfs
+        - proc
+        - devtmpfs
+        - devpts
+        - tmpfs
+        - fusectl
+        - cgroup
+        - overlay
     diskio:
     kernel:
     net:
diff --git a/linux/system/job.sls b/linux/system/job.sls
index f0373a4..5037ff7 100644
--- a/linux/system/job.sls
+++ b/linux/system/job.sls
@@ -4,10 +4,13 @@
 {%- for name, job in system.job.iteritems() %}
 
 linux_job_{{ job.command }}:
-  {%- if job.enabled %}
+  {%- if job.enabled|default(True) %}
   cron.present:
     - name: {{ job.command }}
-    - user: {{ job.user }}
+    {%- if job.get('identifier', True) %}
+    - identifier: {{ job.get('identifier', job.get('name', name)) }}
+    {%- endif %}
+    - user: {{ job.user|default("root") }}
     {%- if job.minute is defined %}
     - minute: '{{ job.minute }}'
     {%- endif %}
@@ -23,13 +26,16 @@
     {%- if job.dayweek is defined %}
     - dayweek: '{{ job.dayweek }}'
     {%- endif %}
-    {%- if job.user in system.get('user', {}).keys() %}
+    {%- if job.user|default("root") in system.get('user', {}).keys() %}
     - require:
-      - user: system_user_{{ job.user }}
+      - user: system_user_{{ job.user|default("root") }}
     {%- endif %}
   {%- else %}
   cron.absent:
     - name: {{ job.command }}
+    {%- if job.get('identifier', True) %}
+    - identifier: {{ job.get('identifier', job.get('name', name)) }}
+    {%- endif %}
   {%- endif %}
 
 {%- endfor %}