From 8aa8c4e43f9c75417cefa457000f282502a48a40 Mon Sep 17 00:00:00 2001 From: Hunter Satterwhite Date: Mon, 21 Mar 2016 11:58:49 -0400 Subject: [PATCH 1/7] move checks file resource to clients.sls --- sensu/client.sls | 15 +++++++++++++++ sensu/server.sls | 15 --------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sensu/client.sls b/sensu/client.sls index 8637bde..2f0c9a2 100644 --- a/sensu/client.sls +++ b/sensu/client.sls @@ -99,3 +99,18 @@ install_{{ gem }}: - rdoc: False - ri: False {% endfor %} + +{%- if salt['pillar.get']('sensu:checks') %} + +sensu_checks_file: + file.serialize: + - name: {{ sensu.paths.checks_file }} + - dataset: + checks: {{ salt['pillar.get']('sensu:checks') }} + - formatter: json + - require: + - pkg: sensu + - watch_in: + - service: sensu-client + +{%- endif %} diff --git a/sensu/server.sls b/sensu/server.sls index e2668c7..7640e4d 100644 --- a/sensu/server.sls +++ b/sensu/server.sls @@ -15,21 +15,6 @@ include: - watch_in: - service: sensu-server -{%- if salt['pillar.get']('sensu:checks') %} - -sensu_checks_file: - file.serialize: - - name: {{ sensu.paths.checks_file }} - - dataset: - checks: {{ salt['pillar.get']('sensu:checks') }} - - formatter: json - - require: - - pkg: sensu - - watch_in: - - service: sensu-server - -{%- endif %} - {%- if salt['pillar.get']('sensu:handlers') %} sensu_handlers_file: From 83681a511d449c43690a4e688d1c305042812605 Mon Sep 17 00:00:00 2001 From: Hunter Satterwhite Date: Wed, 30 Mar 2016 15:19:11 -0400 Subject: [PATCH 2/7] added redact capability, updated README.md and pillar.example --- README.md | 13 ++++++++++++- pillar.example | 2 ++ sensu/client.sls | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 81ca836..8f1284b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A saltstack formula to install and configure the open source monitoring framewor >Note: See the full [Salt Formulas installation and usage instructions](http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html). This formula only manages Sensu. You are responsible for installing/configuring RabbitMQ and Redis as appropriate. -Sensu can be configured/scaled with the individual states installed on multiple servers. All states are configured via the pillar file. Sane defaults are set in pillar_map.jinja and can be over-written in the pillar. The `sensu.client` state currently supports Ubuntu, CentOS and Windows. The `sensu.server`, `sensu.api` and `sensu.uchiwa` states currently support Ubuntu and CentOS. +Sensu can be configured/scaled with the individual states installed on multiple servers. All states are configured via the pillar file. Sane defaults are set in pillar_map.jinja and can be over-written in the pillar. The `sensu.client` state currently supports Ubuntu, CentOS and Windows. The `sensu.server`, `sensu.api` and `sensu.uchiwa` states currently support Ubuntu and CentOS. Thank you to the SaltStack community for the continued improvement of this formula! @@ -125,6 +125,17 @@ sensu: critical: 99 ``` +If you would like to use the [redact](https://sensuapp.org/docs/latest/clients) feature in your checks you can add a section under client as shown here: + +``` +sensu: + client: + redact: + - password +``` + +This will redact any command token value who's key is defined as "password" from check configurations and logs. Command token substitution should be used in check configurations when redacting sensitive information such as passwords. + If you are adding plugins/checks which have additional gem dependencies. You can add them to the pillar data and they will be installed on your Sensu clients. ``` sensu: diff --git a/pillar.example b/pillar.example index 202407d..ba97187 100644 --- a/pillar.example +++ b/pillar.example @@ -6,6 +6,8 @@ sensu: client: embedded_ruby: true nagios_plugins: true + redact: + - password rabbitmq: host: 10.0.0.1 user: sensu diff --git a/sensu/client.sls b/sensu/client.sls index 2f0c9a2..cd28c7c 100644 --- a/sensu/client.sls +++ b/sensu/client.sls @@ -38,6 +38,9 @@ sensu_enable_windows_service: safe_mode: {{ sensu.client.safe_mode }} {% if sensu.client.get("command_tokens") %} command_tokens: {{ sensu.client.command_tokens }} +{% endif %} +{% if sensu.client.get("redact") %} + redact: {{ sensu.client.redact }} {% endif %} - require: - pkg: sensu From 05fa79bf85771aa29dd90b948a73b5e62b7bbe86 Mon Sep 17 00:00:00 2001 From: Hunter Satterwhite Date: Thu, 28 Apr 2016 07:24:06 -0400 Subject: [PATCH 3/7] Allows keepalive on client to be configured and to be installed gems versions to be locked --- pillar.example | 2 ++ sensu/client.sls | 19 +++++++++++++++++-- sensu/server.sls | 16 ++++++++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/pillar.example b/pillar.example index ba97187..96da782 100644 --- a/pillar.example +++ b/pillar.example @@ -3,6 +3,8 @@ sensu: install_gems: - mail - timeout + - name: aws-sdk + version: 2.2.6 client: embedded_ruby: true nagios_plugins: true diff --git a/sensu/client.sls b/sensu/client.sls index cd28c7c..1bf55f2 100644 --- a/sensu/client.sls +++ b/sensu/client.sls @@ -36,12 +36,16 @@ sensu_enable_windows_service: address: {{ sensu.client.address }} subscriptions: {{ sensu.client.subscriptions }} safe_mode: {{ sensu.client.safe_mode }} +<<<<<<< HEAD {% if sensu.client.get("command_tokens") %} command_tokens: {{ sensu.client.command_tokens }} {% endif %} {% if sensu.client.get("redact") %} redact: {{ sensu.client.redact }} {% endif %} +======= + keepalive: {{ sensu.client.keepalive }} +>>>>>>> 3e357cda916c4c084e832efa3c51cb1b09ca36aa - require: - pkg: sensu @@ -91,17 +95,26 @@ sensu-client: {% set gem_list = salt['pillar.get']('sensu:client:install_gems', []) %} {% for gem in gem_list %} -install_{{ gem }}: +{% if gem is mapping %} +{% set gem_name = gem.name %} +{% else %} +{% set gem_name = gem %} +{% endif %} +install_{{ gem_name }}: gem.installed: - - name: {{ gem }} + - name: {{ gem_name }} {% if sensu.client.embedded_ruby %} - gem_bin: /opt/sensu/embedded/bin/gem {% else %} - gem_bin: None {% endif %} + {% if gem.version is defined %} + - version: {{ gem.version }} + {% endif %} - rdoc: False - ri: False {% endfor %} +<<<<<<< HEAD {%- if salt['pillar.get']('sensu:checks') %} @@ -117,3 +130,5 @@ sensu_checks_file: - service: sensu-client {%- endif %} +======= +>>>>>>> 3e357cda916c4c084e832efa3c51cb1b09ca36aa diff --git a/sensu/server.sls b/sensu/server.sls index 7640e4d..16f185f 100644 --- a/sensu/server.sls +++ b/sensu/server.sls @@ -60,10 +60,22 @@ sensu_handlers_file: {% set gem_list = salt['pillar.get']('sensu:server:install_gems', []) %} {% for gem in gem_list %} -install_{{ gem }}: +{% if gem is mapping %} +{% set gem_name = gem.name %} +{% else %} +{% set gem_name = gem %} +{% endif %} +install_{{ gem_name }}: gem.installed: - - name: {{ gem }} + - name: {{ gem_name }} + {% if sensu.client.embedded_ruby %} - gem_bin: /opt/sensu/embedded/bin/gem + {% else %} + - gem_bin: None + {% endif %} + {% if gem.version is defined %} + - version: {{ gem.version }} + {% endif %} - rdoc: False - ri: False {% endfor %} From e988cc23a5cb41744a0afe302065985f5d8246d9 Mon Sep 17 00:00:00 2001 From: Chris Powell Date: Fri, 29 Apr 2016 09:49:11 -0400 Subject: [PATCH 4/7] Fix the previous merge. --- sensu/client.sls | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/sensu/client.sls b/sensu/client.sls index 1bf55f2..c31f8da 100644 --- a/sensu/client.sls +++ b/sensu/client.sls @@ -21,6 +21,7 @@ sensu_enable_windows_service: - name: 'sc create sensu-client start= delayed-auto binPath= c:\opt\sensu\bin\sensu-client.exe DisplayName= "Sensu Client"' - unless: 'sc query sensu-client' {% endif %} + /etc/sensu/conf.d/client.json: file.serialize: - formatter: json @@ -36,16 +37,15 @@ sensu_enable_windows_service: address: {{ sensu.client.address }} subscriptions: {{ sensu.client.subscriptions }} safe_mode: {{ sensu.client.safe_mode }} -<<<<<<< HEAD -{% if sensu.client.get("command_tokens") %} + {% if sensu.client.get('keepalive') %} + keepalive: {{ sensu.client.keepalive }} + {% endif %} + {% if sensu.client.get("command_tokens") %} command_tokens: {{ sensu.client.command_tokens }} -{% endif %} -{% if sensu.client.get("redact") %} + {% endif %} + {% if sensu.client.get("redact") %} redact: {{ sensu.client.redact }} -{% endif %} -======= - keepalive: {{ sensu.client.keepalive }} ->>>>>>> 3e357cda916c4c084e832efa3c51cb1b09ca36aa + {% endif %} - require: - pkg: sensu @@ -114,7 +114,6 @@ install_{{ gem_name }}: - rdoc: False - ri: False {% endfor %} -<<<<<<< HEAD {%- if salt['pillar.get']('sensu:checks') %} @@ -130,5 +129,3 @@ sensu_checks_file: - service: sensu-client {%- endif %} -======= ->>>>>>> 3e357cda916c4c084e832efa3c51cb1b09ca36aa From 37322c634edbc77396b967f1b58e62a61fb3a1ed Mon Sep 17 00:00:00 2001 From: Sonia Hamilton Date: Mon, 14 Nov 2016 05:01:34 +0000 Subject: [PATCH 5/7] environment req'd on server client config --- pillar.example | 2 ++ sensu/client.sls | 3 +++ 2 files changed, 5 insertions(+) diff --git a/pillar.example b/pillar.example index 96da782..1322dba 100644 --- a/pillar.example +++ b/pillar.example @@ -8,6 +8,8 @@ sensu: client: embedded_ruby: true nagios_plugins: true + # environment is required by sensu + environment: production redact: - password rabbitmq: diff --git a/sensu/client.sls b/sensu/client.sls index c31f8da..51ce241 100644 --- a/sensu/client.sls +++ b/sensu/client.sls @@ -46,6 +46,9 @@ sensu_enable_windows_service: {% if sensu.client.get("redact") %} redact: {{ sensu.client.redact }} {% endif %} + {% if sensu.client.get("environment") %} + environment: {{ sensu.client.environment }} + {% endif %} - require: - pkg: sensu From 88ff79f7fe9c3cb59d9bf188c272368021d5779f Mon Sep 17 00:00:00 2001 From: Sonia Hamilton Date: Mon, 14 Nov 2016 05:51:57 +0000 Subject: [PATCH 6/7] api user/password If both user/password are empty, shouldn't put "password: null" in api.json file. This is a quick HACK to get things working, a proper fix will be required. --- sensu/api_conf.sls | 2 -- 1 file changed, 2 deletions(-) diff --git a/sensu/api_conf.sls b/sensu/api_conf.sls index 720a63c..4e13272 100644 --- a/sensu/api_conf.sls +++ b/sensu/api_conf.sls @@ -14,7 +14,5 @@ include: - dataset: api: host: {{ sensu.api.host }} - password: {{ sensu.api.password }} port: {{ sensu.api.port }} - user: {{ sensu.api.user }} From 7097bb64680701e1810ea5c85b33f514eeaf9534 Mon Sep 17 00:00:00 2001 From: Sonia Hamilton Date: Fri, 13 Jan 2017 02:14:38 +0000 Subject: [PATCH 7/7] CentOS Linux release 7.2.1511 (Core) no fqdn --- sensu/pillar_map.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sensu/pillar_map.jinja b/sensu/pillar_map.jinja index 00c4056..43907c1 100644 --- a/sensu/pillar_map.jinja +++ b/sensu/pillar_map.jinja @@ -3,7 +3,7 @@ 'client': { 'embedded_ruby': False, 'nagios_plugins': False, - 'name': salt['grains.get']('fqdn'), + 'name': salt['grains.get']('id'), 'address': salt['grains.get']('ipv4')[0], 'subscriptions': ['all'], 'safe_mode': False