flapjack 0.7.12 → 0.7.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
1
  ## Flapjack Changelog
2
2
 
3
+ # 0.7.13 - 2013-06-18
4
+ - Bug: test notifications are blocked by notification rules gh-188 (@jessereynolds)
5
+ - Bug: unscheduled maintenances does not prevent alerts for checks with colons in their name gh-208 (@jessereynolds)
6
+
3
7
  # 0.7.12 - 2013-06-12
4
8
  - Feature: auto-generate a general notification rule for contacts that don't have any gh-199 (@ali-graham)
5
9
  - Bug: no recovery for unknown for contact with notification rules gh-203 (@jessereynolds)
@@ -0,0 +1,21 @@
1
+ @events
2
+ Feature: events and check names
3
+ Flapjack must handle weird characters in check names in events
4
+
5
+ Background:
6
+ Given an entity 'foo-app-01.example.com' exists
7
+
8
+ @time
9
+ Scenario: acknowledgements for checks with colons
10
+ Given the check is check 'Disk C: Utilisation' on entity 'foo-app-01.example.com'
11
+ And the check is in an ok state
12
+ When a warning event is received
13
+ Then a notification should not be generated
14
+ When 1 minute passes
15
+ And a warning event is received
16
+ Then a notification should be generated
17
+ When an acknowledgement event is received
18
+ Then a notification should be generated
19
+ When 1 minute passes
20
+ And a warning event is received
21
+ Then a notification should not be generated
@@ -260,6 +260,50 @@ Feature: Notification rules on a per contact basis
260
260
  Then 0 email alerts should be queued for vera@example.com
261
261
  Then 1 sms alert should be queued for +61400000003
262
262
 
263
+ @time
264
+ Scenario: Test notifications behave like a critical notification
265
+ Given the check is check 'ping' on entity 'foo'
266
+ And the check is in an ok state
267
+ When a test event is received
268
+ Then 1 email alert should be queued for malak@example.com
269
+ And 1 sms alert should be queued for +61400000001
270
+ @time
271
+ Scenario: Critical straight after test
272
+ Given the check is check 'ping' on entity 'foo'
273
+ And the check is in an ok state
274
+ When a test event is received
275
+ Then 1 email alert should be queued for malak@example.com
276
+ And 1 sms alert should be queued for +61400000001
277
+ When 10 seconds passes
278
+ And a critical event is received
279
+ Then 1 email alert should be queued for malak@example.com
280
+ And 1 sms alert should be queued for +61400000001
281
+ When 40 seconds passes
282
+ And a critical event is received
283
+ Then 2 email alert should be queued for malak@example.com
284
+ And 2 sms alert should be queued for +61400000001
285
+
286
+ Scenario: Unknown event during unscheduled maintenance
287
+ Given the check is check 'ping' on entity 'foo'
288
+ And the check is in an ok state
289
+ When an unknown event is received
290
+ And 1 minute passes
291
+ And an unknown event is received
292
+ Then 1 email alert should be queued for malak@example.com
293
+ And 1 sms alert should be queued for +61400000001
294
+ When 6 minutes passes
295
+ And an acknowledgement event is received
296
+ Then 2 email alerts should be queued for malak@example.com
297
+ And 2 sms alerts should be queued for +61400000001
298
+ When 6 minutes passes
299
+ And an unknown event is received
300
+ Then 2 email alerts should be queued for malak@example.com
301
+ And 2 sms alerts should be queued for +61400000001
302
+ When 1 minute passes
303
+ And an unknown event is received
304
+ Then 2 email alerts should be queued for malak@example.com
305
+ And 2 sms alerts should be queued for +61400000001
306
+
263
307
  @time
264
308
  Scenario: A blackhole rule on an entity should override another matching entity specific rule
265
309
 
@@ -118,7 +118,18 @@ def submit_acknowledgement(entity, check)
118
118
  'entity' => entity,
119
119
  'check' => check,
120
120
  'client' => 'clientx',
121
- # 'acknowledgement_id' =>
121
+ }
122
+ submit_event(event)
123
+ end
124
+
125
+ def submit_test(entity, check)
126
+ event = {
127
+ 'type' => 'action',
128
+ 'state' => 'test_notifications',
129
+ 'summary' => "test notification for all contacts interested in #{entity}",
130
+ 'entity' => entity,
131
+ 'check' => check,
132
+ 'client' => 'clientx',
122
133
  }
123
134
  submit_event(event)
124
135
  end
@@ -224,6 +235,13 @@ When /^an acknowledgement .*is received(?: for check '([\w\.\-]+)' on entity '([
224
235
  drain_events
225
236
  end
226
237
 
238
+ When /^a test .*is received(?: for check '([\w\.\-]+)' on entity '([\w\.\-]+)')?$/ do |check, entity|
239
+ check ||= @check
240
+ entity ||= @entity
241
+ submit_test(entity, check)
242
+ drain_events
243
+ end
244
+
227
245
  # TODO logging is a side-effect, should test for notification generation itself
228
246
  Then /^a notification should not be generated(?: for check '([\w\.\-]+)' on entity '([\w\.\-]+)')?$/ do |check, entity|
229
247
  check ||= @check
@@ -87,7 +87,7 @@ module Flapjack
87
87
  return nil
88
88
  end
89
89
  redis.keys('entity_id:*').inject([]) {|memo, check|
90
- a, entity_name = check.split(':')
90
+ a, entity_name = check.split(':', 2)
91
91
  if (entity_name =~ regex) && !memo.include?(entity_name)
92
92
  memo << entity_name
93
93
  end
@@ -27,7 +27,7 @@ module Flapjack
27
27
  # TODO probably shouldn't always be creating on query -- work out when this should be happening
28
28
  def self.for_event_id(event_id, options = {})
29
29
  raise "Redis connection not set" unless redis = options[:redis]
30
- entity_name, check = event_id.split(':')
30
+ entity_name, check = event_id.split(':', 2)
31
31
  self.new(Flapjack::Data::Entity.find_by_name(entity_name, :redis => redis, :create => true), check,
32
32
  :redis => redis)
33
33
  end
@@ -26,7 +26,7 @@ module Flapjack
26
26
  event_id = event.id
27
27
  event_state = event.state
28
28
 
29
- severity = if ([event_state, max_notified_severity] & ['critical', 'unknown']).any?
29
+ severity = if ([event_state, max_notified_severity] & ['critical', 'unknown', 'test_notifications']).any?
30
30
  'critical'
31
31
  elsif [event_state, max_notified_severity].include?('warning')
32
32
  'warning'
@@ -34,7 +34,7 @@ module Flapjack
34
34
  @summary = notification['summary']
35
35
  @details = notification['details']
36
36
  @time = notification['time']
37
- @entity_name, @check = notification['event_id'].split(':')
37
+ @entity_name, @check = notification['event_id'].split(':', 2)
38
38
 
39
39
  entity_check = Flapjack::Data::EntityCheck.for_event_id(notification['event_id'],
40
40
  :redis => ::Resque.redis)
@@ -355,7 +355,7 @@ module Flapjack
355
355
  end
356
356
  end
357
357
  else
358
- entity, check = event['event_id'].split(':')
358
+ entity, check = event['event_id'].split(':', 2)
359
359
  state = event['state']
360
360
  summary = event['summary']
361
361
  duration = event['duration'] ? time_period_in_words(event['duration']) : '4 hours'
@@ -61,7 +61,7 @@ module Flapjack
61
61
  @logger.debug("pagerduty notification event popped off the queue: " + event.inspect)
62
62
  unless 'shutdown'.eql?(type)
63
63
  event_id = event['event_id']
64
- entity, check = event_id.split(':')
64
+ entity, check = event_id.split(':', 2)
65
65
  state = event['state']
66
66
  summary = event['summary']
67
67
  address = event['address']
@@ -24,7 +24,7 @@ module Flapjack
24
24
  state = notification['state']
25
25
  summary = notification['summary']
26
26
  time = notification['time']
27
- entity, check = notification['event_id'].split(':')
27
+ entity, check = notification['event_id'].split(':', 2)
28
28
 
29
29
  headline_map = {'problem' => 'PROBLEM: ',
30
30
  'recovery' => 'RECOVERY: ',
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  module Flapjack
4
- VERSION = "0.7.12"
4
+ VERSION = "0.7.13"
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.12
4
+ version: 0.7.13
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-12 00:00:00.000000000 Z
14
+ date: 2013-06-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: dante
@@ -412,6 +412,7 @@ files:
412
412
  - dist/puppet/sqlite3/manifests/dev.pp
413
413
  - etc/flapjack_config.yaml.example
414
414
  - features/events.feature
415
+ - features/events_check_names.feature
415
416
  - features/notification_rules.feature
416
417
  - features/notifications.feature
417
418
  - features/packaging-lintian.feature
@@ -553,7 +554,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
553
554
  version: '0'
554
555
  segments:
555
556
  - 0
556
- hash: -3589199594353387110
557
+ hash: 1459875303565561678
557
558
  required_rubygems_version: !ruby/object:Gem::Requirement
558
559
  none: false
559
560
  requirements:
@@ -562,7 +563,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
562
563
  version: '0'
563
564
  segments:
564
565
  - 0
565
- hash: -3589199594353387110
566
+ hash: 1459875303565561678
566
567
  requirements: []
567
568
  rubyforge_project:
568
569
  rubygems_version: 1.8.23
@@ -571,6 +572,7 @@ specification_version: 3
571
572
  summary: Intelligent, scalable, distributed monitoring notification system.
572
573
  test_files:
573
574
  - features/events.feature
575
+ - features/events_check_names.feature
574
576
  - features/notification_rules.feature
575
577
  - features/notifications.feature
576
578
  - features/packaging-lintian.feature