flapjack 0.7.13 → 0.7.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,4 +9,5 @@ before_script:
9
9
  - mkdir -p ./log
10
10
  before_install:
11
11
  - git submodule update --init --recursive
12
+ - gem install bundler
12
13
  script: bundle exec rspec spec && bundle exec cucumber features
@@ -1,5 +1,9 @@
1
1
  ## Flapjack Changelog
2
2
 
3
+ # 0.7.14 - 2013-06-19
4
+ - Bug: Display of checks on web ui with a colon in their name is screwed gh-213 (@jessereynolds)
5
+ - Bug: show last critical, warning, unknown notificaiton times in web ui gh-211 (@jessereynolds)
6
+
3
7
  # 0.7.13 - 2013-06-18
4
8
  - Bug: test notifications are blocked by notification rules gh-188 (@jessereynolds)
5
9
  - Bug: unscheduled maintenances does not prevent alerts for checks with colons in their name gh-208 (@jessereynolds)
@@ -97,12 +97,12 @@ module Flapjack
97
97
 
98
98
  def self.find_all_with_checks(options)
99
99
  raise "Redis connection not set" unless redis = options[:redis]
100
- redis.keys("check:*").map {|s| s.match(/.*:(.*):.*/)[1] }.to_set
100
+ redis.keys("check:*").map {|s| s.sub(/^check:/, '').split(':', 2).first }.to_set
101
101
  end
102
102
 
103
103
  def self.find_all_with_failing_checks(options)
104
104
  raise "Redis connection not set" unless redis = options[:redis]
105
- redis.zrange("failed_checks", 0, -1).map {|s| s.match(/(.*):.*/)[1] }.to_set
105
+ redis.zrange("failed_checks", 0, -1).map {|s| s.split(':', 2).first }.to_set
106
106
  end
107
107
 
108
108
  def contacts
@@ -82,8 +82,8 @@ module Flapjack
82
82
 
83
83
  # TODO (?) recast as Entity.all do |e|; e.checks.do |ec|; ...
84
84
  @states = redis.keys('*:*:states').map { |r|
85
- parts = r.split(':')[0..1]
86
- [parts[0], parts[1]] + entity_check_state(parts[0], parts[1])
85
+ entity, check = r.sub(/:states$/, '').split(':', 2)
86
+ [entity, check] + entity_check_state(entity, check)
87
87
  }.compact.sort_by {|parts| parts }
88
88
 
89
89
  haml :checks
@@ -94,7 +94,7 @@ module Flapjack
94
94
  @adjective = 'failing'
95
95
 
96
96
  @states = redis.zrange('failed_checks', 0, -1).map {|key|
97
- parts = key.split(':')
97
+ parts = key.split(':', 2)
98
98
  [parts[0], parts[1]] + entity_check_state(parts[0], parts[1])
99
99
  }.compact.sort_by {|parts| parts}
100
100
 
@@ -159,8 +159,8 @@ module Flapjack
159
159
  @entity = params[:entity]
160
160
  entity_stats
161
161
  @states = redis.keys("#{@entity}:*:states").map { |r|
162
- parts = r.split(':')[0..1]
163
- [parts[0], parts[1]] + entity_check_state(parts[0], parts[1])
162
+ check = r.sub(/^#{@entity}:/, '').sub(/:states$/, '')
163
+ [@entity, check] + entity_check_state(@entity, check)
164
164
  }.compact.sort_by {|parts| parts }
165
165
  haml :entity
166
166
  end
@@ -44,16 +44,36 @@
44
44
  %td Last update:
45
45
  %td #{relative_time_ago(Time.at(@check_last_update.to_i))} ago
46
46
  %td #{Time.at(@check_last_update.to_i)}
47
- - if @last_notifications[:problem]
48
- - last_problem_relative = relative_time_ago(Time.at(@last_notifications[:problem])) + " ago"
49
- - last_problem = Time.at(@last_notifications[:problem]).to_s
47
+ - if @last_notifications[:critical]
48
+ - last_critical_relative = relative_time_ago(Time.at(@last_notifications[:critical])) + " ago"
49
+ - last_critical = Time.at(@last_notifications[:critical]).to_s
50
50
  - else
51
- - last_problem_relative = 'never'
52
- - last_problem = ''
51
+ - last_critical_relative = 'never'
52
+ - last_critical = ''
53
53
  %tr
54
- %td Last problem notification:
55
- %td= last_problem_relative
56
- %td= last_problem
54
+ %td Last critical notification:
55
+ %td= last_critical_relative
56
+ %td= last_critical
57
+ - if @last_notifications[:warning]
58
+ - last_warning_relative = relative_time_ago(Time.at(@last_notifications[:warning])) + " ago"
59
+ - last_warning = Time.at(@last_notifications[:warning]).to_s
60
+ - else
61
+ - last_warning_relative = 'never'
62
+ - last_warning = ''
63
+ %tr
64
+ %td Last warning notification:
65
+ %td= last_warning_relative
66
+ %td= last_warning
67
+ - if @last_notifications[:unknown]
68
+ - last_unknown_relative = relative_time_ago(Time.at(@last_notifications[:unknown])) + " ago"
69
+ - last_unknown = Time.at(@last_notifications[:unknown]).to_s
70
+ - else
71
+ - last_unknown_relative = 'never'
72
+ - last_unknown = ''
73
+ %tr
74
+ %td Last unknown notification:
75
+ %td= last_unknown_relative
76
+ %td= last_unknown
57
77
  - if @last_notifications[:recovery]
58
78
  - last_recovery_relative = relative_time_ago(Time.at(@last_notifications[:recovery])) + " ago"
59
79
  - last_recovery = Time.at(@last_notifications[:recovery]).to_s
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  module Flapjack
4
- VERSION = "0.7.13"
4
+ VERSION = "0.7.14"
5
5
  end
@@ -67,7 +67,7 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
67
67
  # (for the methods that access redis directly)
68
68
 
69
69
  it "shows a page listing all checks" do
70
- redis.should_receive(:keys).with('*:*:states').and_return(["#{entity_name}:#{check}:states"])
70
+ redis.should_receive(:keys).with('*:*:states').and_return(["#{entity_name}:#{check}"])
71
71
 
72
72
  expect_check_stats
73
73
 
@@ -84,7 +84,7 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
84
84
  end
85
85
 
86
86
  it "shows a page listing failing checks" do
87
- redis.should_receive(:zrange).with('failed_checks', 0, -1).and_return(["#{entity_name}:#{check}:states"])
87
+ redis.should_receive(:zrange).with('failed_checks', 0, -1).and_return(["#{entity_name}:#{check}"])
88
88
 
89
89
  expect_check_stats
90
90
 
@@ -101,7 +101,7 @@ describe Flapjack::Gateways::Web, :sinatra => true, :logger => true do
101
101
 
102
102
  it "shows a page listing flapjack statistics" do
103
103
  redis.should_receive(:keys).with('check:*').and_return([])
104
- redis.should_receive(:zrange).with('failed_checks', 0, -1).and_return(["#{entity_name}:#{check}:states"])
104
+ redis.should_receive(:zrange).with('failed_checks', 0, -1).and_return(["#{entity_name}:#{check}"])
105
105
  expect_stats
106
106
  expect_check_stats
107
107
  expect_entity_stats
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.13
4
+ version: 0.7.14
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-18 00:00:00.000000000 Z
14
+ date: 2013-06-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: dante
@@ -554,7 +554,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
554
554
  version: '0'
555
555
  segments:
556
556
  - 0
557
- hash: 1459875303565561678
557
+ hash: 1257649684215176614
558
558
  required_rubygems_version: !ruby/object:Gem::Requirement
559
559
  none: false
560
560
  requirements:
@@ -563,7 +563,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
563
563
  version: '0'
564
564
  segments:
565
565
  - 0
566
- hash: 1459875303565561678
566
+ hash: 1257649684215176614
567
567
  requirements: []
568
568
  rubyforge_project:
569
569
  rubygems_version: 1.8.23