|
1 | 1 | # Sensu-Puppet
|
2 | 2 |
|
3 |
| -This module is functional. |
4 | 3 |
|
5 | 4 | Tested with Travis CI
|
6 | 5 |
|
7 | 6 | [](https://travis-ci.org/sensu/sensu-puppet)
|
8 | 7 |
|
| 8 | +## Upgrade note |
| 9 | +Version 0.5.0 is pretty close to 100% incompatible with previous version of the sensu-puppet module due to massive refactoring. |
| 10 | + |
9 | 11 | ## Installation
|
10 | 12 |
|
11 | 13 | $ puppet module install sensu/sensu
|
12 | 14 |
|
13 | 15 | ## Prerequisites
|
| 16 | +- redis server and connectivity to a redis database |
| 17 | +- rabbitmq server, vhost, and credentials |
14 | 18 |
|
15 |
| -### Modules |
| 19 | +### Dependencies |
16 | 20 |
|
17 | 21 | - puppetlabs/apt
|
18 |
| -- puppetlabs/rabbitmq |
19 |
| -- thomasvandoren/redis |
20 | 22 |
|
21 | 23 | See Modulefile for details.
|
22 | 24 |
|
23 | 25 | ### Others
|
24 | 26 |
|
25 |
| -Pluginsync should be enabled. Also, you need ruby json library/gem on all your nodes. |
| 27 | +Pluginsync should be enabled. Also, you need ruby json library/gem on all your nodes. |
| 28 | +[EPEL](http://mirrors.kernel.org/fedora-epel/6/x86_64/rubygem-json-1.4.6-1.el6.x86_64.rpm) |
26 | 29 |
|
27 |
| -## Example |
| 30 | +## Basic Example |
28 | 31 |
|
29 | 32 | ### Sensu Server
|
30 | 33 |
|
@@ -64,6 +67,81 @@ Pluginsync should be enabled. Also, you need ruby json library/gem on all your n
|
64 | 67 | }
|
65 | 68 | }
|
66 | 69 |
|
| 70 | +### Advanced Example (hiera) |
| 71 | +This example includes the sensu class as part of a base class or role and controles sensu on each individual node via hiera. |
| 72 | + |
| 73 | +hiera.yaml |
| 74 | + |
| 75 | + --- |
| 76 | + :hierarchy: |
| 77 | + - %{fqdn} |
| 78 | + - %{datacenter} |
| 79 | + - common |
| 80 | + :backends: |
| 81 | + - yaml |
| 82 | + :yaml: |
| 83 | + :datadir: '/etc/puppet/%{environment}/modules/hieradata' |
| 84 | + |
| 85 | +common.yaml |
| 86 | + |
| 87 | + sensu::dashboard_port: 8090 |
| 88 | + sensu::dashboard_password: mysupersecretpassword |
| 89 | + sensu::install_repo: 'false' |
| 90 | + sensu::purge_config: true |
| 91 | + sensu::rabbitmq_host: 10.31.0.90 |
| 92 | + sensu::rabbitmq_password: password |
| 93 | + sensu::rabbitmq_port: 5672 |
| 94 | + |
| 95 | +sensu-server.foo.com.yaml |
| 96 | + |
| 97 | + sensu::server: true |
| 98 | + |
| 99 | +nosensu.foo.com.yaml |
| 100 | + |
| 101 | + sensu::client: 'false' |
| 102 | + |
| 103 | +site.pp |
| 104 | + |
| 105 | + node default { |
| 106 | + class { 'sensu': } |
| 107 | + ... |
| 108 | + } |
| 109 | + |
| 110 | + |
| 111 | +### Inclusion of sensu monitoring in other modules |
| 112 | +There are a few different patterns that can be used to include sensu monitoring into other modules. One pattern creates a new class that is included as part of the host or node definition and includes a standalone check, for example: |
| 113 | + |
| 114 | +apache/manifests/monitoring/sensu.pp |
| 115 | + |
| 116 | + class apache::monitoring::sensu { |
| 117 | + sensu::check { 'apache-running': |
| 118 | + handlers => 'default', |
| 119 | + command => '/etc/sensu/plugins/check-procs.rb -p /usr/sbin/httpd -w 100 -c 200 -C 1', |
| 120 | + refresh => 1800, |
| 121 | + standalone => true, |
| 122 | + } |
| 123 | + } |
| 124 | + |
| 125 | +Rather than include a standalone check you could also include subscription information and let the sensu server schedule checks for this service as a subscriber: |
| 126 | + |
| 127 | +apache/manifests/monitoring/sensu.pp |
| 128 | + |
| 129 | + class apache::monitoring::sensu { |
| 130 | + sensu::subscription { 'apache' } |
| 131 | + } |
| 132 | + |
| 133 | +If you would like to automatically include the sensu monitoring class as part of your existing module with the ability to support different monitoring platforms, you could do something like: |
| 134 | + |
| 135 | +apache/manifests/service.pp |
| 136 | + |
| 137 | +$monitoring = hiera('monitoring', '') |
| 138 | + |
| 139 | + case $monitoring { |
| 140 | + 'sensu': { include apache::monitoring::sensu } |
| 141 | + 'nagios': { include apache::monitoring::nagios } |
| 142 | + } |
| 143 | + |
| 144 | + |
67 | 145 | ## License
|
68 | 146 |
|
69 | 147 | MIT
|
|
0 commit comments