Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Serverspec and Sensu - Testing and Monitoring collide

20,014 views

Published on

Lightning talk from Sydney DevOps Meetup

Published in: Technology

Serverspec and Sensu - Testing and Monitoring collide

  1. 1. + MICHAEL RICHARDSON - @M_RICHO Testing and Monitoring Collide
  2. 2. WHAT IS IT? RSpec Tests for checking your servers are configured correctly
  3. 3. CM/PROVISIONING TOOL AGNOSTIC
  4. 4. CM/PROVISIONING TOOL AGNOSTIC SERVERS CAN BE BUILT USING • CHEF • PUPPET • CF-ENGINE • ANSIBLE • POWER SHELL • SHELL SCRIPTS • MANUAL HACK • WHAT EVER.
  5. 5. 26 RESOURE TYPES INCLUDING • COMMAND • DEFAULT_GATEWAY • FILE • GROUP • HOST • INTERFACE • IPTABLES • KERNEL_MODULE • PACKAGE • PORT • PROCESS • SERVICE • USER • WINDOWS_REGISTRY_KEY
  6. 6. That’s super fast
  7. 7. WHEN TO RUN SERVERSPEC TESTS? ??
  8. 8. WHEN TO RUN SERVERSPEC TESTS? That’s super useful • When developing config management code (eg puppet/chef) • When validating a node or environment
  9. 9. WHEN TO RUN SERVERSPEC TESTS? Hell yeah. That’s a great idea. • What about every 2 minutes on all hosts via your monitoring tool
  10. 10. WHY? • Fast • Lightweight • Overlaps with traditional monitoring checks • Simplifies monitoring tool config
  11. 11. WE USE SENSU FOR MONITORING It’s • Simple • Extensible • Lightweight • Simple to install on linux and windows. • blah… • blah…
  12. 12. ITERATION 1+ GET SENSU TO JUST RUN THE RSPEC TESTS
  13. 13. ITERATION 1+ RSpec stdout isn’t great to simply pass back to a monitoring tool.
  14. 14. ITERATION 1+ SURE, WE CAN TIDY UP RSPEC STD OUT But now have no idea which tests are failing 
  15. 15. 2 USEFUL FEATURES TO THE RESCUE 1. Rspec JSON output format 2. Sensu-Client has a local socket to accept check results
  16. 16. RSPEC JSON OUTPUT 4 example tests Summary results
  17. 17. SENSU CLIENT SOCKET Send results here Failures appear here
  18. 18. ITERATION 2+
  19. 19. ITERATION 2+ RSpec in json format Send each test result to sensu socket Report summary serverspec results to back to sensu defined check Iterate over rspec results
  20. 20. ITERATION 2+ Summary results Individual test failures
  21. 21. SUMMARY 1. Write tests for your systems 2. Don’t duplicate effort. 3. Run your tests via a monitoring tool
  22. 22. THANK YOU Michael Richardson - @m_richo https://github.com/m-richo/sensu_check-rspec

×