Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand Down Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ sensu:
install_gems:
- mail
- timeout
- name: aws-sdk
version: 2.2.6
client:
embedded_ruby: true
nagios_plugins: true
# environment is required by sensu
environment: production
redact:
- password
rabbitmq:
host: 10.0.0.1
user: sensu
Expand Down
2 changes: 0 additions & 2 deletions sensu/api_conf.sls
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ include:
- dataset:
api:
host: {{ sensu.api.host }}
password: {{ sensu.api.password }}
port: {{ sensu.api.port }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we leave this in for backwards compatibility? and do some logic to handle when it should or should not be included?

user: {{ sensu.api.user }}

41 changes: 37 additions & 4 deletions sensu/client.sls
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,9 +37,18 @@ sensu_enable_windows_service:
address: {{ sensu.client.address }}
subscriptions: {{ sensu.client.subscriptions }}
safe_mode: {{ sensu.client.safe_mode }}
{% 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 %}
{% endif %}
{% if sensu.client.get("redact") %}
redact: {{ sensu.client.redact }}
{% endif %}
{% if sensu.client.get("environment") %}
environment: {{ sensu.client.environment }}
{% endif %}
- require:
- pkg: sensu

Expand Down Expand Up @@ -88,14 +98,37 @@ 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 %}

{%- 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 %}
31 changes: 14 additions & 17 deletions sensu/server.sls
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -75,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 %}
Expand Down