diff --git a/.fixtures.yml b/.fixtures.yml index b575f76e..a1faabe9 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -48,6 +48,9 @@ fixtures: 'corosync': repo: 'git://github.com/enovance/puppetlabs-corosync.git' ref: '79b61302b07fef30b65a42f3b55229616018aacf' + 'datacat': + repo: 'git://github.com/enovance/puppet-datacat.git' + ref: '6a2017b31a8808de35b89d90b9e2b681ef9a0918' 'firewall': repo: 'git://github.com/enovance/puppetlabs-firewall.git' ref: '6540b31b0ca0727094ddf44436274436d2853d6d' @@ -57,6 +60,9 @@ fixtures: 'elasticsearch': repo: 'git://github.com/enovance/puppet-elasticsearch.git' ref: '6d08442e8382f0f47388d4185122992c2d73cd9b' + 'gcc': + repo: 'git://github.com/enovance/puppetlabs-gcc.git' + ref: '272e6595a2f4824dafa71a2b751960659c05c35d' 'git': repo: 'git://github.com/enovance/puppetlabs-git.git' ref: '0df1f62130a7752c728efb7555f2b07ca178ee5b' @@ -90,9 +96,18 @@ fixtures: 'ntp': repo: 'git://github.com/enovance/puppetlabs-ntp.git' ref: 'eb02ba2937ce86fb609ae41499767244b78ec58d' + 'puppetdbquery': + repo: 'git://github.com/enovance/puppet-puppetdbquery.git' + ref: '89194917744f929bb600c31d7d6f822b529f5f03' + 'redis': + repo: 'git://github.com/enovance/puppet-redis.git' + ref: '1b2b2cea8c9acc08cfa01b42e47fad17f3c4d03d' 'sysctl': repo: 'git://github.com/enovance/puppet-sysctl.git' ref: '4a463384e844f51b270428643a5b8beb3628e854' + 'uchiwa': + repo: 'git://github.com/enovance/yelp-uchiwa.git' + ref: '8eafd8167ff7d4f1cd696e4d098e3e1497c28279' 'inifile': repo: 'git://github.com/enovance/puppetlabs-inifile' ref: 'ae23a4db97d2815ec305d0529912685f07746d3c' @@ -102,6 +117,9 @@ fixtures: 'vcsrepo': repo: 'git://github.com/enovance/puppetlabs-vcsrepo.git' ref: '4592bfd59cd5d4795069798a14b483e16c98c1ff' + 'wget': + repo: 'git://github.com/enovance/puppet-wget.git' + ref: '1c3ea6f1c822a99b52defb87305ea5977cba4293' 'stdlib': repo: 'git://github.com/enovance/puppetlabs-stdlib.git' ref: '8a9b2dfc0e463bec39c00c82c30e0a8a8b7867f3' @@ -120,6 +138,9 @@ fixtures: 'kmod': repo: 'git://github.com/enovance/puppet-kmod.git' ref: 'accc40093e6f8ee9cc472e9eb6ba3bab4bad3a1f' + 'sensu': + repo: 'git://github.com/enovance/sensu-puppet.git' + ref: '4a16ebf3503bfc9ae6192ae3120cb29b9e5c8445' 'ssh': repo: 'git://github.com/enovance/puppet-ssh.git' ref: '10675c0d80511a8cdd514af67b695887fa97ec40' diff --git a/Puppetfile b/Puppetfile index 9eba6415..b2d7aed6 100644 --- a/Puppetfile +++ b/Puppetfile @@ -80,9 +80,15 @@ mod 'corosync', mod 'dnsclient', :git => 'git://github.com/enovance/puppet-module-dnsclient.git', :ref => '4158b30f4660623f98dcdbd1ce9b482556180b57' +mod 'datacat', + :git => 'git://github.com/enovance/puppet-datacat.git', + :ref => '6a2017b31a8808de35b89d90b9e2b681ef9a0918' mod 'elasticsearch', :git => 'git://github.com/enovance/puppet-elasticsearch.git', :ref => '6d08442e8382f0f47388d4185122992c2d73cd9b' +mod 'gcc', + :git => 'git://github.com/enovance/puppetlabs-gcc.git', + :ref => '272e6595a2f4824dafa71a2b751960659c05c35d' mod 'git', :git => 'git://github.com/enovance/puppetlabs-git.git', :ref => '0df1f62130a7752c728efb7555f2b07ca178ee5b' @@ -139,9 +145,15 @@ mod 'ntp', mod 'pacemaker', :git => 'git://github.com/enovance/puppet-pacemaker.git', :ref => '56bbb3580bb7fa62bf57c2ed7a30b938e42b8cc3' +mod 'puppetdbquery', + :git => 'git://github.com/enovance/puppet-puppetdbquery.git', + :ref => '89194917744f929bb600c31d7d6f822b529f5f03' mod 'rabbitmq', :git => 'git://github.com/enovance/puppetlabs-rabbitmq.git', :ref => '25420cb3c26c9a8432ab519d43c094d614d4fec4' +mod 'redis', + :git => 'git://github.com/enovance/puppet-redis.git', + :ref => '1b2b2cea8c9acc08cfa01b42e47fad17f3c4d03d' mod 'rhnreg_ks', :git => 'git://github.com/enovance/puppet-rhnreg_ks.git', :ref => '8fdc051992b44a09f39d3b510d7cd6db5ed5ff66' @@ -151,6 +163,9 @@ mod 'rpcbind', mod 'rsync', :git => 'git://github.com/enovance/puppetlabs-rsync.git', :ref => '7122983d89bf68bc4170415cc03212f6a8a4636e' +mod 'sensu', + :git => 'git://github.com/enovance/sensu-puppet.git', + :ref => '4a16ebf3503bfc9ae6192ae3120cb29b9e5c8445' mod 'ssh', :git => 'git://github.com/enovance/puppet-ssh.git', :ref => '10675c0d80511a8cdd514af67b695887fa97ec40' @@ -168,9 +183,15 @@ mod 'sysctl', mod 'types', :git => 'git://github.com/enovance/puppet-module-types.git', :ref => '4c58ae8b6cdb1a9da3da9654a35375e274019dfb' +mod 'uchiwa', + :git => 'git://github.com/enovance/yelp-uchiwa.git', + :ref => '8eafd8167ff7d4f1cd696e4d098e3e1497c28279' mod 'vswitch', :git => 'git://github.com/enovance/puppet-vswitch.git', :ref => '49dbaff15e8f017dbe365ebf08eb505472b695a1' +mod 'wget', + :git => 'git://github.com/enovance/puppet-wget.git' + :ref => '1c3ea6f1c822a99b52defb87305ea5977cba4293' mod 'xinetd', :git => 'git://github.com/enovance/puppetlabs-xinetd.git', :ref => '7557af0e418d1a587df04fe7d01322ff2473c32e' diff --git a/manifests/messaging.pp b/manifests/messaging.pp index 1414397d..dad5b4b3 100644 --- a/manifests/messaging.pp +++ b/manifests/messaging.pp @@ -41,6 +41,10 @@ class cloud::messaging( # we ensure having an array $array_rabbit_names = any2array($rabbit_names) + Class['rabbitmq'] -> Rabbitmq_vhost <<| |>> + Class['rabbitmq'] -> Rabbitmq_user <<| |>> + Class['rabbitmq'] -> Rabbitmq_user_permissions <<| |>> + # Packaging issue: https://bugzilla.redhat.com/show_bug.cgi?id=1033305 if $::osfamily == 'RedHat' { file {'/usr/sbin/rabbitmq-plugins': diff --git a/manifests/monitoring/agent/sensu.pp b/manifests/monitoring/agent/sensu.pp new file mode 100644 index 00000000..308c7096 --- /dev/null +++ b/manifests/monitoring/agent/sensu.pp @@ -0,0 +1,22 @@ +# +# Copyright (C) 2014 eNovance SAS +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# + +class cloud::monitoring::agent::sensu { + + Package['sensu'] -> Sensu::Plugin <<| |>> + + include ::sensu +} diff --git a/manifests/monitoring/log.pp b/manifests/monitoring/log.pp deleted file mode 100644 index e69de29b..00000000 diff --git a/manifests/monitoring/server/sensu.pp b/manifests/monitoring/server/sensu.pp new file mode 100644 index 00000000..1b2af830 --- /dev/null +++ b/manifests/monitoring/server/sensu.pp @@ -0,0 +1,105 @@ +# +# Copyright (C) 2014 eNovance SAS +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# [*checks*] +# (optionnal) Hash of checks and their respective options +# Defaults to {}. +# Example : +# $checks = { +# 'ntp' => { +# 'command' => '/etc/sensu/plugins/check-ntp.sh'}, +# 'http' => { +# 'command' => '/etc/sensu/plugins/check-http.sh'}, +# } +# +# [*handlers*] +# (optionnal) Hash of handlers and their respective options +# Defaults to {}. +# Example : +# $handlers = { +# 'mail' => { +# 'command' => 'mail -s "Sensu Alert" contact@example.com'}, +# } +# +# [*plugins*] +# (optionnal) Hash of handlers and their respective options +# Defaults to {}. +# Example : +# $plugins = { +# 'http://www.example.com/ntp.sh' => { +# 'type' => 'url', +# 'install_path' => '/etc/sensu/plugins', +# } +# } +# +# [*rabbitmq_user*] +# (optionnal) Rabbitmq user +# Defaults to 'sensu' +# +# [*rabbitmq_password*] +# (optionnal) Rabbitmq_password +# Defaults to 'rabbitpassword' +# +# [*rabbitmq_vhost*] +# (optionnal) Rabbitmq vhost +# Defaults to '/sensu' +# +# [*uchiwa_ip*] +# (optionnal) IP address to bind uchiwa to +# Defaults to '%{::ipaddress}' +class cloud::monitoring::server::sensu ( + $checks = {}, + $handlers = {}, + $plugins = {}, + $rabbitmq_user = 'sensu', + $rabbitmq_password = 'rabbitpassword', + $rabbitmq_vhost = '/sensu', + $uchiwa_ip = $::ipaddress, +) { + + @@rabbitmq_user { $rabbitmq_user : + password => $rabbitmq_password, + } + @@rabbitmq_vhost { $rabbitmq_vhost : + ensure => present, + } + @@rabbitmq_user_permissions { "${rabbitmq_user}@${rabbitmq_vhost}" : + configure_permission => '.*', + read_permission => '.*', + write_permission => '.*', + } + + $rabbitmq_user_realized = query_nodes("Rabbitmq_user['${rabbitmq_user}']") + + if size($rabbitmq_user_realized) >= 1 { + + Service['redis-6379'] -> Service['sensu-api'] -> Service['sensu-server'] -> Service['uchiwa'] + Service['sensu-server'] -> Sensu::Plugin <<| |>> + + + include cloud::monitoring::agent::sensu + include redis + + create_resources('sensu::check', $checks) + create_resources('sensu::handler', $handlers) + create_resources('@@sensu::plugin', $plugins) + + include ::uchiwa + uchiwa::api { 'OpenStack' : + host => $uchiwa_ip, + } + } + +} diff --git a/manifests/monitoring/supervision.pp b/manifests/monitoring/supervision.pp deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/classes/cloud_monitoring_agent_sensu_spec.rb b/spec/classes/cloud_monitoring_agent_sensu_spec.rb new file mode 100644 index 00000000..5c0eb55b --- /dev/null +++ b/spec/classes/cloud_monitoring_agent_sensu_spec.rb @@ -0,0 +1,47 @@ +# +# Copyright (C) 2014 eNovance SAS +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# Unit tests for cloud::monitoring::agent::sensu class +# + +require 'spec_helper' + +describe 'cloud::monitoring::agent::sensu' do + + shared_examples_for 'openstack sensu monitoring agent' do + + it 'include ::sensu' do + should contain_class('sensu') + end + + end + + context 'on Debian platforms' do + let :facts do + { :osfamily => 'Debian' } + end + + it_configures 'openstack sensu monitoring agent' + end + + context 'on RedHat platforms' do + let :facts do + { :osfamily => 'RedHat' } + end + + it_configures 'openstack sensu monitoring agent' + end + +end diff --git a/spec/classes/cloud_monitoring_server_sensu_spec.rb b/spec/classes/cloud_monitoring_server_sensu_spec.rb new file mode 100644 index 00000000..4d16c89a --- /dev/null +++ b/spec/classes/cloud_monitoring_server_sensu_spec.rb @@ -0,0 +1,43 @@ +# +# Copyright (C) 2014 eNovance SAS +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# Unit tests for cloud::monitoring::server::sensu class +# + +require 'spec_helper' + +describe 'cloud::monitoring::server::sensu' do + + shared_examples_for 'openstack sensu monitoring server' do + + end + + context 'on Debian platforms' do + let :facts do + { :osfamily => 'Debian' } + end + + it_configures 'openstack sensu monitoring server' + end + + context 'on RedHat platforms' do + let :facts do + { :osfamily => 'RedHat' } + end + + it_configures 'openstack sensu monitoring server' + end + +end