Monitoring web application
     behaviour with

cucumber-nagios
 Lindsay Holmwood <lindsay@holmwood.id.au>
http://flickr.com/photos/therefromhere/510612621/
# features/google.com.au/search.feature

Feature: google.com.au
  It should be up
  And I should be able to search for thi...
--format pretty
$ bin/cucumber --require bin/common.rb 
               --require features/ 
               features/google.com.au/search.f...
$ bin/cucumber --require bin/common.rb 
               --require features/ 
               features/google.com.au/search.f...
cucumber
cucumber
webrat
cucumber
webrat
mechanize
cucumber
webrat
mechanize
nagios    =>
cucumber-nagios
$ bin/cucumber-nagios features/google.com.au/search.feature

Critical: 0, Warning: 0, 4 okay | passed=4, failed=0, total=4...
how it works
http://flickr.com/photos/sunbeer/931205335/
$ bin/cucumber-nagios 
      features/google.com.au/search.feature
$ bin/cucumber-nagios 
      features/google.com.au/search.feature

$ bin/cucumber --require bin/common.rb 
              ...
$ bin/cucumber-nagios 
      features/google.com.au/search.feature

$ bin/cucumber --require bin/common.rb 
              ...
module Nagios
  class NagiosFormatter
    def initialize(*args)
      @failed = []; @passed = []
    end

    def step_pas...
#!/bin/sh

dirname=$(dirname $0)
feature=$1

$dirname/cucumber --require $dirname/common.rb 
                  --require f...
#!/bin/sh

dirname=$(dirname $0)
feature=$1

$dirname/cucumber --require $dirname/common.rb 
                  --require f...
http://flickr.com/photos/chrisindarwin/3082606450/
Setting up
$ gem sources -a http://gems.github.com/
$ gem sources -a http://gems.github.com/

# gem install auxesis-cucumber-nagios
$ gem sources -a http://gems.github.com/

# gem install auxesis-cucumber-nagios

$ cucumber-nagios-gen project mysite.com
$ gem sources -a http://gems.github.com/

# gem install auxesis-cucumber-nagios

$ cucumber-nagios-gen project mysite.com
...
$ gem sources -a http://gems.github.com/

# gem install auxesis-cucumber-nagios

$ cucumber-nagios-gen project mysite.com
...
$ gem sources -a http://gems.github.com/

# gem install auxesis-cucumber-nagios

$ cucumber-nagios-gen project mysite.com
...
$ gem sources -a http://gems.github.com/

# gem install auxesis-cucumber-nagios

$ cucumber-nagios-gen project mysite.com
...
$ bin/cucumber-nagios-gen feature search
$ bin/cucumber-nagios-gen feature search

$ bin/cucumber-nagios features/search.feature
Quirks
Failure
*IS* an
 option
begin
# foo
rescue
# bar
end
Multiple
Scenarios
 per File
Critical: 1, Warning: 0, 2 okay | passed=2, failed=1, total=3
Critical: 1, Warning: 0, 4 okay | passed=4, failed=1, total=5
Instead of writing boring monitoring
plugins from scratch, you can now
do behavior driven ops!
Instead of writing boring monitoring
plugins from scratch, you can now
do behavior driven ops!

Transform from a grumpy,
m...
developers                                   sysadmins

http://flickr.com/photos/jshappell/1313699764/
building bridges
http://flickr.com/photos/douaireg/2313764485/
http://github.com/auxesis/
                            cucumber-nagios




http://dryicons.com/free-icons/preview/coquette...
Monitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagios
Upcoming SlideShare
Loading in...5
×

Monitoring web application behaviour with cucumber-nagios

6,227

Published on

Setting up monitoring for web applications can be complicated - tests tend to lack expressiveness, or and quite often they don't even test the right problem in the first place.

cucumber-nagios lets a sysadmin write behavioural tests for their web apps in plain English, and outputs the test results in the Nagios plugin format, allowing a sysadmin to be notified by Nagios when their production apps aren't behaving.

Published in: Technology, News & Politics
1 Comment
10 Likes
Statistics
Notes
No Downloads
Views
Total Views
6,227
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
135
Comments
1
Likes
10
Embeds 0
No embeds

No notes for slide

Monitoring web application behaviour with cucumber-nagios

  1. 1. Monitoring web application behaviour with cucumber-nagios Lindsay Holmwood <lindsay@holmwood.id.au>
  2. 2. http://flickr.com/photos/therefromhere/510612621/
  3. 3. # features/google.com.au/search.feature Feature: google.com.au It should be up And I should be able to search for things Scenario: Searching for things When I visit quot;http://www.google.comquot; And I fill in quot;qquot; with quot;wikipediaquot; And I press quot;Google Searchquot; Then I should see quot;www.wikipedia.orgquot;
  4. 4. --format pretty
  5. 5. $ bin/cucumber --require bin/common.rb --require features/ features/google.com.au/search.feature --format pretty
  6. 6. $ bin/cucumber --require bin/common.rb --require features/ features/google.com.au/search.feature Feature: google.com.au It should be up And I should be able to search for things Scenario: Searching for things When I visit quot;http://www.google.comquot; And I fill in quot;qquot; with quot;wikipediaquot; And I press quot;Google Searchquot; Then I should see quot;www.wikipedia.orgquot; 1 scenario 4 steps passed --format pretty
  7. 7. cucumber
  8. 8. cucumber webrat
  9. 9. cucumber webrat mechanize
  10. 10. cucumber webrat mechanize nagios =>
  11. 11. cucumber-nagios
  12. 12. $ bin/cucumber-nagios features/google.com.au/search.feature Critical: 0, Warning: 0, 4 okay | passed=4, failed=0, total=4 cucumber-nagios
  13. 13. how it works http://flickr.com/photos/sunbeer/931205335/
  14. 14. $ bin/cucumber-nagios features/google.com.au/search.feature
  15. 15. $ bin/cucumber-nagios features/google.com.au/search.feature $ bin/cucumber --require bin/common.rb --require features/ --format Nagios::NagiosFormatter features/google.com.au/search.feature
  16. 16. $ bin/cucumber-nagios features/google.com.au/search.feature $ bin/cucumber --require bin/common.rb --require features/ --format Nagios::NagiosFormatter features/google.com.au/search.feature
  17. 17. module Nagios class NagiosFormatter def initialize(*args) @failed = []; @passed = [] end def step_passed(step, name, params) @passed << step end def step_failed(step, name, params) @failed << step end def scenario_executed(scenario) @total = @failed.size + @passed.size message = quot;quot; message += quot;Critical: #{@failed.size}, quot; message += quot;Warning: 0, quot; message += quot;#{@passed.size} okayquot; message += quot; | passed=#{@passed.size))}quot; message += quot;, failed=#{@failed.size))}, total=#{@total}quot;quot; puts message end end end
  18. 18. #!/bin/sh dirname=$(dirname $0) feature=$1 $dirname/cucumber --require $dirname/common.rb --require features/ --format Nagios::NagiosFormatter $feature retval=$? if [ quot;$retvalquot; -eq quot;1quot; ]; then exit 2 else exit $retval fi
  19. 19. #!/bin/sh dirname=$(dirname $0) feature=$1 $dirname/cucumber --require $dirname/common.rb --require features/ --format Nagios::NagiosFormatter $feature retval=$? if [ quot;$retvalquot; -eq quot;1quot; ]; then exit 2 0 good else exit $retval 1 bad fi 2 ugly
  20. 20. http://flickr.com/photos/chrisindarwin/3082606450/
  21. 21. Setting up
  22. 22. $ gem sources -a http://gems.github.com/
  23. 23. $ gem sources -a http://gems.github.com/ # gem install auxesis-cucumber-nagios
  24. 24. $ gem sources -a http://gems.github.com/ # gem install auxesis-cucumber-nagios $ cucumber-nagios-gen project mysite.com
  25. 25. $ gem sources -a http://gems.github.com/ # gem install auxesis-cucumber-nagios $ cucumber-nagios-gen project mysite.com woosh!
  26. 26. $ gem sources -a http://gems.github.com/ # gem install auxesis-cucumber-nagios $ cucumber-nagios-gen project mysite.com woosh! $ cd mysite.com
  27. 27. $ gem sources -a http://gems.github.com/ # gem install auxesis-cucumber-nagios $ cucumber-nagios-gen project mysite.com woosh! $ cd mysite.com $ rake deps
  28. 28. $ gem sources -a http://gems.github.com/ # gem install auxesis-cucumber-nagios $ cucumber-nagios-gen project mysite.com woosh! $ cd mysite.com $ rake deps brr!
  29. 29. $ bin/cucumber-nagios-gen feature search
  30. 30. $ bin/cucumber-nagios-gen feature search $ bin/cucumber-nagios features/search.feature
  31. 31. Quirks
  32. 32. Failure *IS* an option
  33. 33. begin # foo rescue # bar end
  34. 34. Multiple Scenarios per File
  35. 35. Critical: 1, Warning: 0, 2 okay | passed=2, failed=1, total=3 Critical: 1, Warning: 0, 4 okay | passed=4, failed=1, total=5
  36. 36. Instead of writing boring monitoring plugins from scratch, you can now do behavior driven ops!
  37. 37. Instead of writing boring monitoring plugins from scratch, you can now do behavior driven ops! Transform from a grumpy, misanthropic sysadmin to a hipster, agile developer instantly. — Bradley Taylor (http://bit.ly/lWWfE)
  38. 38. developers sysadmins http://flickr.com/photos/jshappell/1313699764/
  39. 39. building bridges http://flickr.com/photos/douaireg/2313764485/
  40. 40. http://github.com/auxesis/ cucumber-nagios http://dryicons.com/free-icons/preview/coquette-part-3-icons-set/
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×