Monitoring web application behaviour with cucumber-nagios
Upcoming SlideShare
Loading in...5
×
 

Monitoring web application behaviour with cucumber-nagios

on

  • 9,577 views

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. ...

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.

Statistics

Views

Total Views
9,577
Views on SlideShare
9,479
Embed Views
98

Actions

Likes
8
Downloads
129
Comments
1

7 Embeds 98

https://extranet.atlassian.com 50
http://www.slideshare.net 37
http://www.slideee.com 4
http://pinterest.com 3
http://www.pinterest.com 2
http://www.lmodules.com 1
http://www.linkedin.com 1
More...

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Monitoring web application behaviour with cucumber-nagios Monitoring web application behaviour with cucumber-nagios Presentation Transcript

  • 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 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;
  • --format pretty
  • $ bin/cucumber --require bin/common.rb --require features/ features/google.com.au/search.feature --format pretty
  • $ 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
  • 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 cucumber-nagios
  • 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 --require features/ --format Nagios::NagiosFormatter features/google.com.au/search.feature
  • $ 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
  • 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
  • #!/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
  • #!/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
  • 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 woosh!
  • $ gem sources -a http://gems.github.com/ # gem install auxesis-cucumber-nagios $ cucumber-nagios-gen project mysite.com woosh! $ cd mysite.com
  • $ gem sources -a http://gems.github.com/ # gem install auxesis-cucumber-nagios $ cucumber-nagios-gen project mysite.com woosh! $ cd mysite.com $ rake deps
  • $ 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!
  • $ 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, misanthropic sysadmin to a hipster, agile developer instantly. — Bradley Taylor (http://bit.ly/lWWfE)
  • 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-part-3-icons-set/