flapjack 0.9.2 → 0.9.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/etc/flapjack_config.yaml.example +17 -6
- data/lib/flapjack/gateways/jsonapi/check_presenter.rb +6 -6
- data/lib/flapjack/gateways/jsonapi/report_methods.rb +3 -5
- data/lib/flapjack/version.rb +1 -1
- data/spec/lib/flapjack/gateways/jsonapi/check_presenter_spec.rb +24 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d000bd7c6fe6166ad1c537c91fe4c53ddc85d9b
|
4
|
+
data.tar.gz: 678ebf7c7d42fbe6041d28df1748c8e607674d0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0b577918c1f294d4c7619e5e97f025cd8b5d9bf7e1b144efdcedfc58f0d05e188a8394cd9b51b334e82cf5ff7a508ff20316a02c26e60b140426b3ef633d804
|
7
|
+
data.tar.gz: 5acab492158136c9a110435c53c07480b8ea390beaea33ae31336b397611e0f576f270940639f9737907dd90e7261f6484a9629681303f111f1e448bf2540f83
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## Flapjack Changelog
|
2
2
|
|
3
|
+
# 0.9.3 - 2014-07-28
|
4
|
+
- Bug: fix outage reports in jsonapi c8e09f7 (@ali-graham)
|
5
|
+
- Bug: fix maintenance reports in jsonapi 234ce48 (@ali-graham)
|
6
|
+
- Bug: simplify checks reports in jsonapi 3eda22e (@ali-graham)
|
7
|
+
|
3
8
|
# 0.9.2 - 2014-07-17
|
4
9
|
- Feature: Add ability to disable check via JSON API #529 (@ali-graham)
|
5
10
|
- Feature: Jabber - Resource in JID should be supported in the config #557 (@jessereynolds)
|
@@ -97,8 +97,8 @@ production:
|
|
97
97
|
syslog_errors: yes
|
98
98
|
# location of custom alert templates
|
99
99
|
#templates:
|
100
|
-
# rollup.text: '/etc/flapjack/templates/jabber/rollup.text.erb'
|
101
|
-
# alert.text: '/etc/flapjack/templates/jabber/alert.text.erb'
|
100
|
+
# rollup.text: '/etc/flapjack/templates/jabber/rollup.text.erb'
|
101
|
+
# alert.text: '/etc/flapjack/templates/jabber/alert.text.erb'
|
102
102
|
pagerduty:
|
103
103
|
enabled: no
|
104
104
|
queue: pagerduty_notifications
|
@@ -107,7 +107,7 @@ production:
|
|
107
107
|
syslog_errors: yes
|
108
108
|
# location of custom alert templates
|
109
109
|
#templates:
|
110
|
-
# alert.text: '/etc/flapjack/templates/pagerduty/alert.text.erb'
|
110
|
+
# alert.text: '/etc/flapjack/templates/pagerduty/alert.text.erb'
|
111
111
|
web:
|
112
112
|
enabled: yes
|
113
113
|
port: 3080
|
@@ -245,8 +245,8 @@ development:
|
|
245
245
|
syslog_errors: yes
|
246
246
|
# location of custom alert templates
|
247
247
|
#templates:
|
248
|
-
# rollup.text: '/etc/flapjack/templates/jabber/rollup.text.erb'
|
249
|
-
# alert.text: '/etc/flapjack/templates/jabber/alert.text.erb'
|
248
|
+
# rollup.text: '/etc/flapjack/templates/jabber/rollup.text.erb'
|
249
|
+
# alert.text: '/etc/flapjack/templates/jabber/alert.text.erb'
|
250
250
|
pagerduty:
|
251
251
|
enabled: no
|
252
252
|
queue: pagerduty_notifications
|
@@ -255,12 +255,14 @@ development:
|
|
255
255
|
syslog_errors: yes
|
256
256
|
# location of custom alert templates
|
257
257
|
#templates:
|
258
|
-
# alert.text: '/etc/flapjack/templates/pagerduty/alert.text.erb'
|
258
|
+
# alert.text: '/etc/flapjack/templates/pagerduty/alert.text.erb'
|
259
259
|
web:
|
260
260
|
enabled: yes
|
261
261
|
port: 4080
|
262
262
|
timeout: 300
|
263
263
|
access_log: "log/web_access.log"
|
264
|
+
api_url: "http://localhost:4082/"
|
265
|
+
base_url: "/"
|
264
266
|
logger:
|
265
267
|
level: INFO
|
266
268
|
syslog_errors: yes
|
@@ -272,6 +274,15 @@ development:
|
|
272
274
|
logger:
|
273
275
|
level: INFO
|
274
276
|
syslog_errors: yes
|
277
|
+
jsonapi:
|
278
|
+
enabled: yes
|
279
|
+
port: 4082
|
280
|
+
timeout: 300
|
281
|
+
access_log: "log/jsonapi_access.log"
|
282
|
+
base_url: "http://localhost:4082/"
|
283
|
+
logger:
|
284
|
+
level: INFO
|
285
|
+
syslog_errors: yes
|
275
286
|
oobetet:
|
276
287
|
enabled: no
|
277
288
|
server: "jabber.example.com"
|
@@ -81,7 +81,7 @@ module Flapjack
|
|
81
81
|
}
|
82
82
|
end
|
83
83
|
|
84
|
-
result
|
84
|
+
{:outages => result}
|
85
85
|
end
|
86
86
|
|
87
87
|
def unscheduled_maintenance(start_time, end_time)
|
@@ -96,7 +96,7 @@ module Flapjack
|
|
96
96
|
pu[:end_time] >= start_time
|
97
97
|
}
|
98
98
|
|
99
|
-
start_in_unsched + unsched_maintenance
|
99
|
+
{:unscheduled_maintenances => (start_in_unsched + unsched_maintenance)}
|
100
100
|
end
|
101
101
|
|
102
102
|
def scheduled_maintenance(start_time, end_time)
|
@@ -111,7 +111,7 @@ module Flapjack
|
|
111
111
|
ps[:end_time] >= start_time
|
112
112
|
}
|
113
113
|
|
114
|
-
start_in_sched + sched_maintenance
|
114
|
+
{:scheduled_maintenances => (start_in_sched + sched_maintenance)}
|
115
115
|
end
|
116
116
|
|
117
117
|
# TODO test whether the below overlapping logic is prone to off-by-one
|
@@ -120,9 +120,7 @@ module Flapjack
|
|
120
120
|
#
|
121
121
|
# TODO test performance with larger data sets
|
122
122
|
def downtime(start_time, end_time)
|
123
|
-
|
124
|
-
|
125
|
-
outs = outage(start_time, end_time)
|
123
|
+
outs = outage(start_time, end_time)[:outages]
|
126
124
|
|
127
125
|
total_secs = {}
|
128
126
|
percentages = {}
|
@@ -139,6 +137,8 @@ module Flapjack
|
|
139
137
|
# We then create two new outage periods to cover the time around
|
140
138
|
# the scheduled maintenance period, and remove the original.
|
141
139
|
|
140
|
+
sched_maintenances = scheduled_maintenance(start_time, end_time)[:scheduled_maintenances]
|
141
|
+
|
142
142
|
sched_maintenances.each do |sm|
|
143
143
|
|
144
144
|
split_outs = []
|
@@ -27,11 +27,9 @@ module Flapjack
|
|
27
27
|
end
|
28
28
|
|
29
29
|
checks = if event_ids.nil?
|
30
|
-
Flapjack::Data::
|
31
|
-
|
32
|
-
|
33
|
-
}
|
34
|
-
}.flatten(2)
|
30
|
+
Flapjack::Data::EntityCheck.find_all(:redis => redis).collect {|check_name|
|
31
|
+
find_entity_check_by_name(*check_name.split(':', 2))
|
32
|
+
}
|
35
33
|
elsif !event_ids.empty?
|
36
34
|
event_ids.collect {|event_id| find_entity_check_by_name(*event_id.split(':', 2)) }
|
37
35
|
else
|
data/lib/flapjack/version.rb
CHANGED
@@ -47,8 +47,10 @@ describe 'Flapjack::Gateways::JSONAPI::CheckPresenter' do
|
|
47
47
|
ecp = Flapjack::Gateways::JSONAPI::CheckPresenter.new(entity_check)
|
48
48
|
outages = ecp.outage(time - (5 * 60 * 60), time - (2 * 60 * 60))
|
49
49
|
expect(outages).not_to be_nil
|
50
|
-
expect(outages).to
|
51
|
-
expect(outages
|
50
|
+
expect(outages).to be_a(Hash)
|
51
|
+
expect(outages).to have_key(:outages)
|
52
|
+
expect(outages[:outages]).to be_an(Array)
|
53
|
+
expect(outages[:outages].size).to eq(4)
|
52
54
|
|
53
55
|
# TODO check the data in those hashes
|
54
56
|
end
|
@@ -63,8 +65,10 @@ describe 'Flapjack::Gateways::JSONAPI::CheckPresenter' do
|
|
63
65
|
ecp = Flapjack::Gateways::JSONAPI::CheckPresenter.new(entity_check)
|
64
66
|
outages = ecp.outage(nil, nil)
|
65
67
|
expect(outages).not_to be_nil
|
66
|
-
expect(outages).to
|
67
|
-
expect(outages
|
68
|
+
expect(outages).to be_a(Hash)
|
69
|
+
expect(outages).to have_key(:outages)
|
70
|
+
expect(outages[:outages]).to be_an(Array)
|
71
|
+
expect(outages[:outages].size).to eq(4)
|
68
72
|
|
69
73
|
# TODO check the data in those hashes
|
70
74
|
end
|
@@ -82,8 +86,10 @@ describe 'Flapjack::Gateways::JSONAPI::CheckPresenter' do
|
|
82
86
|
ecp = Flapjack::Gateways::JSONAPI::CheckPresenter.new(entity_check)
|
83
87
|
outages = ecp.outage(nil, nil)
|
84
88
|
expect(outages).not_to be_nil
|
85
|
-
expect(outages).to
|
86
|
-
expect(outages
|
89
|
+
expect(outages).to be_a(Hash)
|
90
|
+
expect(outages).to have_key(:outages)
|
91
|
+
expect(outages[:outages]).to be_an(Array)
|
92
|
+
expect(outages[:outages].size).to eq(3)
|
87
93
|
end
|
88
94
|
|
89
95
|
it "returns a (small) outage hash for a single state change" do
|
@@ -95,8 +101,10 @@ describe 'Flapjack::Gateways::JSONAPI::CheckPresenter' do
|
|
95
101
|
ecp = Flapjack::Gateways::JSONAPI::CheckPresenter.new(entity_check)
|
96
102
|
outages = ecp.outage(nil, nil)
|
97
103
|
expect(outages).not_to be_nil
|
98
|
-
expect(outages).to
|
99
|
-
expect(outages
|
104
|
+
expect(outages).to be_a(Hash)
|
105
|
+
expect(outages).to have_key(:outages)
|
106
|
+
expect(outages[:outages]).to be_an(Array)
|
107
|
+
expect(outages[:outages].size).to eq(1)
|
100
108
|
end
|
101
109
|
|
102
110
|
it "a list of unscheduled maintenances for an entity check" do
|
@@ -109,8 +117,10 @@ describe 'Flapjack::Gateways::JSONAPI::CheckPresenter' do
|
|
109
117
|
ecp = Flapjack::Gateways::JSONAPI::CheckPresenter.new(entity_check)
|
110
118
|
unsched_maint = ecp.unscheduled_maintenance(time - (12 * 60 * 60), time)
|
111
119
|
|
112
|
-
expect(unsched_maint).to
|
113
|
-
expect(unsched_maint
|
120
|
+
expect(unsched_maint).to be_a(Hash)
|
121
|
+
expect(unsched_maint).to have_key(:unscheduled_maintenances)
|
122
|
+
expect(unsched_maint[:unscheduled_maintenances]).to be_an(Array)
|
123
|
+
expect(unsched_maint[:unscheduled_maintenances].size).to eq(4)
|
114
124
|
|
115
125
|
# TODO check the data in those hashes
|
116
126
|
end
|
@@ -125,8 +135,10 @@ describe 'Flapjack::Gateways::JSONAPI::CheckPresenter' do
|
|
125
135
|
ecp = Flapjack::Gateways::JSONAPI::CheckPresenter.new(entity_check)
|
126
136
|
sched_maint = ecp.scheduled_maintenance(time - (12 * 60 * 60), time)
|
127
137
|
|
128
|
-
expect(sched_maint).to
|
129
|
-
expect(sched_maint
|
138
|
+
expect(sched_maint).to be_a(Hash)
|
139
|
+
expect(sched_maint).to have_key(:scheduled_maintenances)
|
140
|
+
expect(sched_maint[:scheduled_maintenances]).to be_an(Array)
|
141
|
+
expect(sched_maint[:scheduled_maintenances].size).to eq(4)
|
130
142
|
|
131
143
|
# TODO check the data in those hashes
|
132
144
|
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.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lindsay Holmwood
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-07-
|
13
|
+
date: 2014-07-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: dante
|