flapjack 0.7.22 → 0.7.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGELOG.md +19 -0
  2. data/bin/flapjack +3 -1
  3. data/bin/flapjack-nagios-receiver +5 -4
  4. data/bin/receive-events +2 -2
  5. data/features/events.feature +101 -95
  6. data/features/notification_rules.feature +36 -4
  7. data/features/steps/notifications_steps.rb +4 -0
  8. data/flapjack.gemspec +3 -2
  9. data/lib/flapjack/coordinator.rb +8 -6
  10. data/lib/flapjack/data/entity_check.rb +20 -13
  11. data/lib/flapjack/data/event.rb +4 -7
  12. data/lib/flapjack/data/notification.rb +63 -45
  13. data/lib/flapjack/filters/acknowledgement.rb +26 -24
  14. data/lib/flapjack/filters/delays.rb +46 -42
  15. data/lib/flapjack/filters/ok.rb +31 -34
  16. data/lib/flapjack/filters/scheduled_maintenance.rb +2 -2
  17. data/lib/flapjack/filters/unscheduled_maintenance.rb +2 -3
  18. data/lib/flapjack/gateways/email.rb +111 -114
  19. data/lib/flapjack/gateways/email/alert.html.erb +11 -11
  20. data/lib/flapjack/gateways/email/alert.text.erb +19 -6
  21. data/lib/flapjack/gateways/sms_messagenet.rb +15 -5
  22. data/lib/flapjack/gateways/web.rb +3 -4
  23. data/lib/flapjack/gateways/web/public/css/flapjack.css +0 -2
  24. data/lib/flapjack/gateways/web/public/img/flapjack-favicon-32-16.ico +0 -0
  25. data/lib/flapjack/gateways/web/public/img/flapjack-favicon-64-32-24-16.ico +0 -0
  26. data/lib/flapjack/gateways/web/public/img/flapjack-transparent-300.png +0 -0
  27. data/lib/flapjack/gateways/web/public/img/flapjack-transparent-350-400.png +0 -0
  28. data/lib/flapjack/gateways/web/views/_head.html.erb +1 -0
  29. data/lib/flapjack/gateways/web/views/index.html.erb +1 -1
  30. data/lib/flapjack/notifier.rb +2 -3
  31. data/lib/flapjack/pikelet.rb +5 -4
  32. data/lib/flapjack/processor.rb +39 -27
  33. data/lib/flapjack/version.rb +1 -1
  34. data/spec/lib/flapjack/data/entity_check_spec.rb +5 -0
  35. data/spec/lib/flapjack/data/event_spec.rb +0 -1
  36. data/spec/lib/flapjack/gateways/email_spec.rb +5 -9
  37. data/spec/lib/flapjack/gateways/sms_messagenet.spec.rb +80 -1
  38. data/spec/lib/flapjack/gateways/web_spec.rb +1 -1
  39. data/spec/lib/flapjack/pikelet_spec.rb +4 -3
  40. data/spec/lib/flapjack/processor_spec.rb +0 -1
  41. metadata +28 -11
  42. data/lib/flapjack/filters/detect_mass_client_failures.rb +0 -44
  43. data/spec/lib/flapjack/filters/detect_mass_client_failures_spec.rb +0 -6
@@ -206,7 +206,7 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
206
206
  with(entity, 'ping', :redis => redis).and_return(entity_check)
207
207
 
208
208
  entity_check.should_receive(:create_scheduled_maintenance).
209
- with(:start_time => start_time.to_i, :duration => duration, :summary => summary)
209
+ with(start_time.to_i, duration, :summary => summary)
210
210
 
211
211
  post "/scheduled_maintenances/#{entity_name_esc}/ping?"+
212
212
  "start_time=1+day+ago&duration=30+minutes&summary=wow"
@@ -44,14 +44,15 @@ describe Flapjack::Pikelet do
44
44
  config.should_receive(:[]).with('logger').and_return(nil)
45
45
  config.should_receive(:[]).with('queue').and_return('email_notif')
46
46
 
47
+ resque_redis = mock('resque_redis')
47
48
  redis = mock('redis')
48
- Flapjack::RedisPool.should_receive(:new).and_return(redis)
49
- Resque.should_receive(:redis=).with( redis )
49
+ Flapjack::RedisPool.should_receive(:new).twice.and_return(resque_redis, redis)
50
+ Resque.should_receive(:redis=).with(resque_redis)
50
51
 
51
52
  Flapjack::Gateways::Email.should_receive(:instance_variable_set).
52
53
  with('@config', config)
53
54
  Flapjack::Gateways::Email.should_receive(:instance_variable_set).
54
- with('@redis_config', redis_config)
55
+ with('@redis', redis)
55
56
  Flapjack::Gateways::Email.should_receive(:instance_variable_set).
56
57
  with('@logger', logger)
57
58
 
@@ -16,7 +16,6 @@ describe Flapjack::Processor, :logger => true do
16
16
  Flapjack::Filters::Ok.should_receive(:new)
17
17
  Flapjack::Filters::ScheduledMaintenance.should_receive(:new)
18
18
  Flapjack::Filters::UnscheduledMaintenance.should_receive(:new)
19
- Flapjack::Filters::DetectMassClientFailures.should_receive(:new)
20
19
  Flapjack::Filters::Delays.should_receive(:new)
21
20
  Flapjack::Filters::Acknowledgement.should_receive(:new)
22
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flapjack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.22
4
+ version: 0.7.25
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-08-09 00:00:00.000000000 Z
14
+ date: 2013-09-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: dante
@@ -274,17 +274,17 @@ dependencies:
274
274
  requirement: !ruby/object:Gem::Requirement
275
275
  none: false
276
276
  requirements:
277
- - - ! '>='
277
+ - - ~>
278
278
  - !ruby/object:Gem::Version
279
- version: '0'
279
+ version: 3.2.14
280
280
  type: :runtime
281
281
  prerelease: false
282
282
  version_requirements: !ruby/object:Gem::Requirement
283
283
  none: false
284
284
  requirements:
285
- - - ! '>='
285
+ - - ~>
286
286
  - !ruby/object:Gem::Version
287
- version: '0'
287
+ version: 3.2.14
288
288
  - !ruby/object:Gem::Dependency
289
289
  name: ice_cube
290
290
  requirement: !ruby/object:Gem::Requirement
@@ -303,6 +303,22 @@ dependencies:
303
303
  version: '0'
304
304
  - !ruby/object:Gem::Dependency
305
305
  name: tzinfo
306
+ requirement: !ruby/object:Gem::Requirement
307
+ none: false
308
+ requirements:
309
+ - - ~>
310
+ - !ruby/object:Gem::Version
311
+ version: 1.0.1
312
+ type: :runtime
313
+ prerelease: false
314
+ version_requirements: !ruby/object:Gem::Requirement
315
+ none: false
316
+ requirements:
317
+ - - ~>
318
+ - !ruby/object:Gem::Version
319
+ version: 1.0.1
320
+ - !ruby/object:Gem::Dependency
321
+ name: tzinfo-data
306
322
  requirement: !ruby/object:Gem::Requirement
307
323
  none: false
308
324
  requirements:
@@ -408,7 +424,6 @@ files:
408
424
  - lib/flapjack/filters/acknowledgement.rb
409
425
  - lib/flapjack/filters/base.rb
410
426
  - lib/flapjack/filters/delays.rb
411
- - lib/flapjack/filters/detect_mass_client_failures.rb
412
427
  - lib/flapjack/filters/ok.rb
413
428
  - lib/flapjack/filters/scheduled_maintenance.rb
414
429
  - lib/flapjack/filters/unscheduled_maintenance.rb
@@ -429,6 +444,10 @@ files:
429
444
  - lib/flapjack/gateways/web/public/css/bootstrap-responsive.min.css
430
445
  - lib/flapjack/gateways/web/public/css/bootstrap.min.css
431
446
  - lib/flapjack/gateways/web/public/css/flapjack.css
447
+ - lib/flapjack/gateways/web/public/img/flapjack-favicon-32-16.ico
448
+ - lib/flapjack/gateways/web/public/img/flapjack-favicon-64-32-24-16.ico
449
+ - lib/flapjack/gateways/web/public/img/flapjack-transparent-300.png
450
+ - lib/flapjack/gateways/web/public/img/flapjack-transparent-350-400.png
432
451
  - lib/flapjack/gateways/web/public/img/flapjack_white_bg_400_353.jpeg
433
452
  - lib/flapjack/gateways/web/public/img/glyphicons-halflings-white.png
434
453
  - lib/flapjack/gateways/web/public/img/glyphicons-halflings.png
@@ -466,7 +485,6 @@ files:
466
485
  - spec/lib/flapjack/data/tag_spec.rb
467
486
  - spec/lib/flapjack/filters/acknowledgement_spec.rb
468
487
  - spec/lib/flapjack/filters/delays_spec.rb
469
- - spec/lib/flapjack/filters/detect_mass_client_failures_spec.rb
470
488
  - spec/lib/flapjack/filters/ok_spec.rb
471
489
  - spec/lib/flapjack/filters/scheduled_maintenance_spec.rb
472
490
  - spec/lib/flapjack/filters/unscheduled_maintenance_spec.rb
@@ -529,7 +547,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
529
547
  version: '0'
530
548
  segments:
531
549
  - 0
532
- hash: 525306744622522205
550
+ hash: 2327642757705601515
533
551
  required_rubygems_version: !ruby/object:Gem::Requirement
534
552
  none: false
535
553
  requirements:
@@ -538,7 +556,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
538
556
  version: '0'
539
557
  segments:
540
558
  - 0
541
- hash: 525306744622522205
559
+ hash: 2327642757705601515
542
560
  requirements: []
543
561
  rubyforge_project:
544
562
  rubygems_version: 1.8.23
@@ -570,7 +588,6 @@ test_files:
570
588
  - spec/lib/flapjack/data/tag_spec.rb
571
589
  - spec/lib/flapjack/filters/acknowledgement_spec.rb
572
590
  - spec/lib/flapjack/filters/delays_spec.rb
573
- - spec/lib/flapjack/filters/detect_mass_client_failures_spec.rb
574
591
  - spec/lib/flapjack/filters/ok_spec.rb
575
592
  - spec/lib/flapjack/filters/scheduled_maintenance_spec.rb
576
593
  - spec/lib/flapjack/filters/unscheduled_maintenance_spec.rb
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'flapjack/filters/base'
4
-
5
- module Flapjack
6
- module Filters
7
-
8
- # * If the service event’s state is a failure, and the total number of failing client checks is
9
- # over a threshold (e.g. 10 checks are failing), then set a meta flag noting the threshold has
10
- # been tripped, and generate an event for this meta check
11
- # * If the service event’s state is ok, and the meta flag is set, and the total number of
12
- # failing client checks is less than a threshold (eg 10), then unset the flag, and generate an
13
- # event for this meta check
14
- class DetectMassClientFailures
15
- include Base
16
-
17
- def block?(event)
18
- client_mass_fail_threshold = 10
19
- timestamp = Time.now.to_i
20
-
21
- if event.service?
22
- client_fail_count = @redis.zcount("failed_checks:#{event.client}", '-inf', '+inf')
23
-
24
- if client_fail_count >= client_mass_fail_threshold
25
- # set the flag
26
- # FIXME: perhaps implement this with tagging
27
- @redis.add("mass_failed_client:#{event.client}", timestamp)
28
- @redis.zadd("mass_failure_events_client:#{event.client}", 0, timestamp)
29
- else
30
- # unset the flag
31
- start_mf = @redis.get("mass_failed_client:#{event.client}")
32
- duration = Time.now.to_i - start_mf.to_i
33
- @redis.del("mass_failed_client:#{event.client}")
34
- @redis.zadd("mass_failure_events_client:#{event.client}", duration, start_mf)
35
- end
36
- end
37
-
38
- result = false
39
- @logger.debug("Filter: DetectMassClientFailures: #{result ? "block" : "pass"}")
40
- result
41
- end
42
- end
43
- end
44
- end
@@ -1,6 +0,0 @@
1
- require 'spec_helper'
2
- require 'flapjack/filters/detect_mass_client_failures'
3
-
4
- describe Flapjack::Filters::DetectMassClientFailures do
5
-
6
- end