flapjack 0.7.10 → 0.7.11

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Flapjack Changelog
2
2
 
3
+ # 0.7.11 - 2013-06-11
4
+ - Bug: unknown events not fully treated as problems - no notification delay blocking (second swing) gh-154 (@jessereynolds)
5
+ - Bug: correct jabber alias in example acknowledgement strings (second swing) gh-189 (@jessereynolds)
6
+
3
7
  # 0.7.10 - 2013-06-05
4
8
  - Bug: unknown events not fully treated as problems - no notification delay blocking gh-154 (@jessereynolds)
5
9
 
@@ -26,17 +26,18 @@ def fail(opts)
26
26
  redis = Redis.new(opts[:redis_options])
27
27
  stop_after = opts[:minutes].to_i * 60
28
28
  recover = opts[:recover]
29
+ state = opts[:state] || 'critical'
29
30
  event = {
30
31
  'entity' => opts[:entity] || 'foo-app-01',
31
32
  'check' => opts[:check] || 'HTTP',
32
33
  'type' => 'service',
33
34
  'timestamp' => Time.now.to_i
34
35
  }
35
- failure = event.merge('state' => 'critical', 'summary' => 'Connection refused')
36
- recovery = event.merge('state' => 'ok', 'summary' => '200 OK, 37 ms')
36
+ failure = event.merge('state' => state, 'summary' => 'Simulated check output (test by operator)')
37
+ recovery = event.merge('state' => 'ok', 'summary' => 'Simulated check output (test by operator)')
37
38
  key = "#{event['entity']}:#{event['check']}"
38
39
 
39
- puts "#{Time.now}: sending failure event for #{key}"
40
+ puts "#{Time.now}: sending failure event (#{state}) for #{key}"
40
41
  send_event(failure, :redis => redis)
41
42
 
42
43
  EM.run {
@@ -51,7 +52,7 @@ def fail(opts)
51
52
  end
52
53
 
53
54
  EM.add_periodic_timer(10) do
54
- puts "#{Time.now}: sending failure event for #{key}"
55
+ puts "#{Time.now}: sending failure event (#{state}) for #{key}"
55
56
  send_event(failure, :redis => redis)
56
57
  end
57
58
 
@@ -92,6 +93,10 @@ optparse = OptionParser.new do |opts|
92
93
  options.check = k
93
94
  end
94
95
 
96
+ opts.on("-s", "--state STATE", String, "optional STATE to generate failure events with ('CRITICAL')") do |s|
97
+ options.state = s
98
+ end
99
+
95
100
  end
96
101
  optparse.parse!(ARGV)
97
102
 
@@ -125,7 +130,7 @@ if config_env.nil? || config_env.empty?
125
130
  end
126
131
 
127
132
  options = {:redis_options => redis_options, :minutes => options.minutes,
128
- :entity => options.entity, :check => options.check}
133
+ :entity => options.entity, :check => options.check, :state => options.state}
129
134
  case ARGV[0]
130
135
  when "fail-and-recover"
131
136
  fail(options.merge(:recover => true))
@@ -189,7 +189,12 @@ Feature: events
189
189
  @time
190
190
  Scenario: Quick stream of unknown
191
191
  Given the check is in an ok state
192
- When an unknown event is received
192
+ When a critical event is received
193
+ And 1 minute passes
194
+ And a critical event is received
195
+ Then a notification should be generated
196
+ When 10 minutes passes
197
+ And an unknown event is received
193
198
  Then a notification should not be generated
194
199
  When 60 seconds passes
195
200
  And an unknown event is received
@@ -203,6 +208,27 @@ Feature: events
203
208
  When 10 seconds passes
204
209
  And an unknown event is received
205
210
  Then a notification should not be generated
211
+ When 10 seconds passes
212
+ And an unknown event is received
213
+ Then a notification should not be generated
214
+ When 10 seconds passes
215
+ And an unknown event is received
216
+ Then a notification should not be generated
217
+ When 10 seconds passes
218
+ And an unknown event is received
219
+ Then a notification should not be generated
220
+ When 5 minutes passes
221
+ And an unknown event is received
222
+ Then a notification should be generated
223
+ When 10 seconds passes
224
+ And an unknown event is received
225
+ Then a notification should not be generated
226
+ When 10 seconds passes
227
+ And an unknown event is received
228
+ Then a notification should not be generated
229
+ When 10 seconds passes
230
+ And an unknown event is received
231
+ Then a notification should not be generated
206
232
 
207
233
  @time
208
234
  Scenario: Flapper (down for one minute, up for one minute, repeat)
@@ -305,8 +305,7 @@ module Flapjack
305
305
  end
306
306
 
307
307
  def last_notifications_of_each_type
308
- ln = {:problem => last_problem_notification,
309
- :warning => last_warning_notification,
308
+ ln = {:warning => last_warning_notification,
310
309
  :critical => last_critical_notification,
311
310
  :unknown => last_unknown_notification,
312
311
  :recovery => last_recovery_notification,
@@ -368,7 +368,7 @@ module Flapjack
368
368
  !state.eql?('ok') &&
369
369
  !'acknowledgement'.eql?(type) &&
370
370
  !'test'.eql?(type) ?
371
- "::: flapjack: ACKID #{event['event_count']} " : ''
371
+ "::: #{@config['alias']}: ACKID #{event['event_count']} " : ''
372
372
 
373
373
  type = 'unknown' unless type
374
374
 
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  module Flapjack
4
- VERSION = "0.7.10"
4
+ VERSION = "0.7.11"
5
5
  end
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.10
4
+ version: 0.7.11
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-06-05 00:00:00.000000000 Z
14
+ date: 2013-06-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: dante
@@ -553,7 +553,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
553
553
  version: '0'
554
554
  segments:
555
555
  - 0
556
- hash: 1212130592798831749
556
+ hash: -3678389315543447731
557
557
  required_rubygems_version: !ruby/object:Gem::Requirement
558
558
  none: false
559
559
  requirements:
@@ -562,7 +562,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
562
562
  version: '0'
563
563
  segments:
564
564
  - 0
565
- hash: 1212130592798831749
565
+ hash: -3678389315543447731
566
566
  requirements: []
567
567
  rubyforge_project:
568
568
  rubygems_version: 1.8.23