This is an vagrant environment to demonstrate the use of sensu in combination with serverspec.
Clone the repository
git clone https://github.com/sirhopcount/vagrant-sensu-serverspec.git
Install the necessary modules via librarian-puppet
cd vagrant-sensu-serverspec
librarian-puppet install --path=puppet/modules/
Spin up the environment
vagrant up
The sensu-puppet module has two open issues which causes the sensu services not to properly start after the first boot. So you will have to provision the instances again after the first boot.
vagrant provision --provision-with puppet
If everything went as planned you should be able to reach the Sensu Dashboard via:
http://localhost:8080
You can login with the following credentials:
username: admin
password: secret
The Sensu client runs in standalone modus and has one check called rspec_testing. This ruby script executes 3 spec tests located in '/etc/serverspec/spec'. To trigger an event simply do one of the following on the client:
- Disable the apache service
- Change to owner, group or mode of '/etc/apache2/httpd.conf'
- Remove the package 'swaks'
This should trigger an event within 30 seconds.
All credits go to Michael Richardson. He gave a lightning talk about the concept at Monitorama PDX 2014. The script used to execute the spec tests is also written by Michael Richardson.
Adrian van Dongen [email protected]
Author:: Adrian van Dongen (<[email protected]>)
Copyright:: Copyright (c) 2012 Adrian van Dongen
License:: Apache License, Version 2.0
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.