flapjack 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c18eef4f4dd8297baab83f9f8c1ac1eb3972ace
4
- data.tar.gz: b62c3482d22ddb71af95b7cb5c097fa9ea75bdf4
3
+ metadata.gz: 7fc94944c2fb13e947e99bdfe54b0fe6f69a80e3
4
+ data.tar.gz: 7f090f5ca4504a757a5e773937af868c7eed16ee
5
5
  SHA512:
6
- metadata.gz: 0edb5492abaf9467c0960bcf9be3a5c941803354ce6f0e6bb5b2c03c6ac44a691544d173c00da9c37a4ab0e4973a6e5bc5c0bc02f44008701777597a7d5f8c24
7
- data.tar.gz: 2befbc8f51f15d686e88a5dadc7b2eea9f73f32860a7b77f34fdd8af31e243b4a99262e3d1befcba50f3d2a28f70f5679e91f22178ffbacebba23405a19c50eb
6
+ metadata.gz: b63e5c995f7790525b8eb152a52621e5edb9a1eed65b5abef6e3c0068b8217df0ab34ef6f33c48f694bc19eefd6f247013b8e2eb3e8dd7c480e77c3e4745a5b0
7
+ data.tar.gz: 6d96a660e3bf02e1bbf820b7ba4d6f14322dc6db76ae621a89266d3d0da5aefa433aa5c4dadd69315a8f317631d649f654d308dddf1316220d331052ff06b2b3
@@ -2,7 +2,7 @@ language: ruby
2
2
  rvm:
3
3
  - "1.9.3"
4
4
  - "2.0.0"
5
- - "2.1.0"
5
+ - "2.1.1"
6
6
  env:
7
7
  - ENTITIES=10 INTERVAL=120
8
8
  gemfile:
@@ -1,6 +1,12 @@
1
1
  ## Flapjack Changelog
2
2
 
3
- # 0.8.5 - UNRELEASED
3
+ # 0.8.6 - 2014-03-14
4
+ - Bug: tie Thin to < 2.0.0pre gh-442 (@mattdelves)
5
+ - Feature: Allow site-specific ERB templates for messages. gh-443 (@jswoods)
6
+ - Feature: Add flapjack-nsca-receiver gh-444 (@giganteous)
7
+ - Bug: Redis storage leak - unacknowledged_failures gh-446, gh-430 (@ali-graham)
8
+
9
+ # 0.8.5 - 2014-02-10
4
10
  - Feature: jsonapi rework now supports PATCH, eg for media under contacts gh-253 (@ali-graham)
5
11
  - Feature: experimental backbone based /edit_contacts page in the web UI has improvements gh-253 (@ali-graham)
6
12
 
data/Gemfile CHANGED
@@ -20,6 +20,6 @@ group :test do
20
20
  gem 'guard-cucumber'
21
21
  gem 'fuubar'
22
22
  gem 'simplecov', :require => false
23
- gem 'debugger-ruby_core_source', '>= 1.3.1' # required for perftools
23
+ gem 'debugger-ruby_core_source', '>= 1.3.2' # required for perftools
24
24
  gem 'perftools.rb'
25
25
  end
@@ -0,0 +1,246 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Nagios.cfg should be enabled with a command_file:
4
+ #
5
+ # command_file=/var/lib/nagios3/rw/nagios.cmd
6
+ #
7
+ # The format this script expects looks like:
8
+ # [$TIMET] PROCESS_SERVICE_CHECK_RESULT;$HOSTNAME$;$SERVICEDESC$;$SERVICESTATE$;$SERVICEOUTPUT$;$SERVICEPERFDATA$
9
+ #
10
+
11
+ unless $:.include?(File.dirname(__FILE__) + '/../lib/')
12
+ $: << File.dirname(__FILE__) + '/../lib'
13
+ end
14
+
15
+ require 'optparse'
16
+ require 'ostruct'
17
+ require 'redis'
18
+
19
+ require 'oj'
20
+ Oj.default_options = { :indent => 0, :mode => :strict }
21
+
22
+ require 'dante'
23
+
24
+ require 'flapjack/configuration'
25
+ require 'flapjack/data/event'
26
+
27
+ # Nsca example line for a storage-device check:
28
+ #[1393410685] PROCESS_SERVICE_CHECK_RESULT;db1.dev;STORAGE;0;Raid Set # 000 (800.0GB) is Normal.
29
+
30
+ def process_input(opts)
31
+ redis = opts[:redis]
32
+ fifo = File.new(opts[:fifo])
33
+ begin
34
+ while line = fifo.gets
35
+ skip unless line
36
+ split_line = line.split(" ")
37
+
38
+ timestamp, passivecheck = split_line
39
+ split_passive = passivecheck.split(";")
40
+ timestamp = timestamp.delete('[]')
41
+
42
+ check_long_output = ''
43
+ object_type, entity, check, state, check_output = split_passive
44
+
45
+ case
46
+ when (split_line.length < 2 || split_passive.length < 5)
47
+ puts "ERROR - rejecting this line; illegal format: [#{line}]"
48
+ next
49
+ when (timestamp !~ /^\d+$/)
50
+ puts "ERROR - rejecting this line; timestamp look like a timestamp: [#{line}]"
51
+ next
52
+ when (object_type != 'PROCESS_SERVICE_CHECK_RESULT')
53
+ puts "ERROR - rejecting this line; identifier 'PROCESS_SERVICE_CHECK_RESULT' is missing: [#{line}]"
54
+ next
55
+ end
56
+
57
+ puts "#{object_type}, #{timestamp}, #{entity}, #{check}, #{state}, #{check_output}"
58
+
59
+ state = {'0' => 'ok', '1' => 'warning', '2' => 'critical'}[state.downcase] || 'unknown'
60
+ event = {
61
+ 'entity' => entity,
62
+ 'check' => check,
63
+ 'type' => 'service',
64
+ 'state' => state,
65
+ 'summary' => check_output,
66
+ 'details' => nil,
67
+ 'time' => timestamp,
68
+ }
69
+ Flapjack::Data::Event.add(event, :redis => redis)
70
+ end
71
+ rescue Redis::CannotConnectError
72
+ puts "Error, unable to to connect to the redis server (#{$!})"
73
+ end
74
+ end
75
+
76
+ def main(opts)
77
+ fifo = opts[:fifo]
78
+ redis = Redis.new(opts[:redis_options])
79
+ while true
80
+ process_input(:redis => redis, :fifo => fifo)
81
+ puts "Whoops with the fifo, restarting main loop in 10 seconds"
82
+ sleep 10
83
+ end
84
+ end
85
+
86
+ options = OpenStruct.new
87
+ options.config = Flapjack::Configuration::DEFAULT_CONFIG_PATH
88
+ options.daemonize = nil
89
+
90
+ exe = File.basename(__FILE__)
91
+
92
+ optparse = OptionParser.new do |opts|
93
+ opts.banner = "Usage: #{exe} COMMAND [OPTIONS]"
94
+
95
+ opts.separator ""
96
+ opts.separator "Commands"
97
+ opts.separator " start #{" " * 25} start #{exe}"
98
+ opts.separator " stop #{" " * 26} stop #{exe}"
99
+ opts.separator " restart #{" " * 23} (re)start #{exe}"
100
+ opts.separator " status #{" " * 24} see if #{exe} is running"
101
+ opts.separator ""
102
+ opts.separator "Options"
103
+
104
+ opts.on("-c", "--config [PATH]", String, "PATH to the config file to use") do |c|
105
+ options.config = c
106
+ end
107
+
108
+ opts.on("-f", "--fifo FIFO", String, "Path to the nagios perfdata named pipe") do |f|
109
+ options.fifo = f
110
+ end
111
+
112
+ opts.on("-d", "--[no-]daemonize", "Daemonize?") do |d|
113
+ options.daemonize = d
114
+ end
115
+
116
+ opts.on("-p", "--pidfile [PATH]", String, "PATH to the pidfile to write to") do |pid|
117
+ options.pidfile = pid
118
+ end
119
+
120
+ opts.on("-l", "--logfile [PATH]", String, "PATH to the logfile to write to") do |l|
121
+ options.logfile = l
122
+ end
123
+
124
+ opts.on_tail("-h", "--help", "Show this usage message") do
125
+ puts opts
126
+ puts '
127
+ Required Nagios Configuration Changes
128
+ -------------------------------------
129
+
130
+ flapjack-nsca-receiver reads events from the nagios "command file" read from by Nagios, written to by the Nsca-daemon.
131
+
132
+ The named pipe is automatically created by _nagios_ if it is enabled
133
+ in the configfile:
134
+
135
+ # modified lines:
136
+ command_file=/var/lib/nagios3/rw/nagios.cmd
137
+
138
+ The Nsca daemon is optionally writing to a tempfile if the named pipe does
139
+ not exist.
140
+
141
+ Details on the wiki: https://github.com/flpjck/flapjack/wiki/USING#XXX
142
+ '
143
+
144
+ exit
145
+ end
146
+
147
+ end
148
+ optparse.parse!(ARGV)
149
+
150
+ FLAPJACK_ENV = ENV['FLAPJACK_ENV'] || 'production'
151
+
152
+ config = Flapjack::Configuration.new
153
+ config.load(options.config)
154
+ config_env = config.all
155
+ redis_options = config.for_redis
156
+
157
+ if config_env.nil? || config_env.empty?
158
+ puts "No config data for environment '#{FLAPJACK_ENV}' found in '#{options.config}'"
159
+ puts optparse
160
+ exit 1
161
+ end
162
+
163
+ config_nr = config_env['nsca-receiver'] || {}
164
+
165
+ pidfile = options.pidfile.nil? ?
166
+ (config_nr['pid_file'] || "/var/run/flapjack/#{exe}.pid") :
167
+ options.pidfile
168
+
169
+ logfile = options.logfile.nil? ?
170
+ (config_nr['log_file'] || "/var/log/flapjack/#{exe}.log") :
171
+ options.logfile
172
+
173
+ fifo = options.fifo.nil? ?
174
+ (config_nr['fifo'] || '/var/lib/nagios3/rw/nagios.cmd') :
175
+ options.fifo
176
+
177
+ daemonize = options.daemonize.nil? ?
178
+ !!config_nr['daemonize'] :
179
+ options.daemonize
180
+
181
+
182
+ runner = Dante::Runner.new(exe, :pid_path => pidfile, :log_path => logfile)
183
+ case ARGV[0]
184
+ when "start", "restart"
185
+ unless File.exist?(fifo)
186
+ raise "No fifo (named pipe) file found at #{fifo}"
187
+ end
188
+ unless File.pipe?(fifo)
189
+ raise "The file at #{fifo} is not a named pipe, try using mkfifo to make one"
190
+ end
191
+ unless File.readable?(fifo)
192
+ raise "The fifo (named pipe) at #{fifo} is unreadable"
193
+ end
194
+ end
195
+
196
+ case ARGV[0]
197
+ when "start"
198
+ if runner.daemon_running?
199
+ puts "#{exe} is already running."
200
+ exit 1
201
+ else
202
+ print "#{exe} starting..."
203
+ runner.execute(:daemonize => daemonize) {
204
+ main(:redis_options => redis_options, :fifo => fifo)
205
+ }
206
+ puts " done."
207
+ end
208
+
209
+ when "stop"
210
+ if runner.daemon_running?
211
+ print "#{exe} stopping..."
212
+ runner.execute(:kill => true)
213
+ puts " done."
214
+ else
215
+ puts "#{exe} is not running."
216
+ exit 1
217
+ end
218
+
219
+ when "restart"
220
+ print "#{exe} restarting..."
221
+ runner.execute(:daemonize => true, :restart => true) {
222
+ main(:redis_options => redis_options, :fifo => fifo)
223
+ }
224
+ puts " done."
225
+
226
+ when "status"
227
+ uptime = (runner.daemon_running?) ? Time.now - File.stat(pidfile).ctime : 0
228
+ if runner.daemon_running?
229
+ puts "#{exe} is running: #{uptime}"
230
+ else
231
+ puts "#{exe} is not running"
232
+ exit 3
233
+ end
234
+
235
+ else
236
+ if ARGV.nil? || ARGV.empty?
237
+ puts "No command provided"
238
+ else
239
+ puts "Unknown command provided: '#{ARGV[0]}'"
240
+ end
241
+ puts "\n#{optparse}"
242
+ exit 1
243
+
244
+ end
245
+
246
+
@@ -37,6 +37,10 @@ production:
37
37
  fifo: "/var/cache/nagios3/event_stream.fifo"
38
38
  pid_file: "/var/run/flapjack/flapjack-nagios-receiver.pid"
39
39
  log_file: "/var/log/flapjack/flapjack-nagios-receiver.log"
40
+ nsca-receiver:
41
+ fifo: "/var/lib/nagios3/rw/nagios.cmd"
42
+ pid_file: "/var/run/flapjack/flapjack-nsca-receiver.pid"
43
+ log_file: "/var/log/flapjack/flapjack-nsca-receiver.log"
40
44
  gateways:
41
45
  email:
42
46
  enabled: no
@@ -53,6 +57,14 @@ production:
53
57
  # type:
54
58
  # username:
55
59
  # password:
60
+ # location of custom alert templates
61
+ #templates:
62
+ # rollup_subject.text: '/etc/flapjack/templates/email/rollup_subject.text.erb'
63
+ # alert_subject.text: '/etc/flapjack/templates/email/alert_subject.text.erb'
64
+ # rollup.text: '/etc/flapjack/templates/email/rollup.text.erb'
65
+ # alert.text: '/etc/flapjack/templates/email/alert.text.erb'
66
+ # rollup.html: '/etc/flapjack/templates/email/rollup.html.erb'
67
+ # alert.html: '/etc/flapjack/templates/email/alert.html.erb'
56
68
  sms:
57
69
  enabled: no
58
70
  queue: sms_notifications
@@ -62,6 +74,10 @@ production:
62
74
  logger:
63
75
  level: INFO
64
76
  syslog_errors: yes
77
+ # location of custom alert templates
78
+ #templates:
79
+ # rollup.text: '/etc/flapjack/templates/sms/rollup.text.erb'
80
+ # alert.text: '/etc/flapjack/templates/sms/alert.text.erb'
65
81
  jabber:
66
82
  enabled: no
67
83
  queue: jabber_notifications
@@ -76,12 +92,19 @@ production:
76
92
  logger:
77
93
  level: INFO
78
94
  syslog_errors: yes
95
+ # location of custom alert templates
96
+ #templates:
97
+ # rollup.text: '/etc/flapjack/templates/jabber/rollup.text.erb'
98
+ # alert.text: '/etc/flapjack/templates/jabber/alert.text.erb'
79
99
  pagerduty:
80
100
  enabled: no
81
101
  queue: pagerduty_notifications
82
102
  logger:
83
103
  level: INFO
84
104
  syslog_errors: yes
105
+ # location of custom alert templates
106
+ #templates:
107
+ # alert.text: '/etc/flapjack/templates/pagerduty/alert.text.erb'
85
108
  web:
86
109
  enabled: yes
87
110
  port: 3080
@@ -180,6 +203,14 @@ development:
180
203
  # type:
181
204
  # username:
182
205
  # password:
206
+ # location of custom alert templates
207
+ #templates:
208
+ # rollup_subject.text: '/etc/flapjack/templates/email/rollup_subject.text.erb'
209
+ # alert_subject.text: '/etc/flapjack/templates/email/alert_subject.text.erb'
210
+ # rollup.text: '/etc/flapjack/templates/email/rollup.text.erb'
211
+ # alert.text: '/etc/flapjack/templates/email/alert.text.erb'
212
+ # rollup.html: '/etc/flapjack/templates/email/rollup.html.erb'
213
+ # alert.html: '/etc/flapjack/templates/email/alert.html.erb'
183
214
  sms:
184
215
  enabled: yes
185
216
  queue: sms_notifications
@@ -191,6 +222,10 @@ development:
191
222
  logger:
192
223
  level: INFO
193
224
  syslog_errors: yes
225
+ # location of custom alert templates
226
+ #templates:
227
+ # rollup.text: '/etc/flapjack/templates/sms/rollup.text.erb'
228
+ # alert.text: '/etc/flapjack/templates/sms/alert.text.erb'
194
229
  jabber:
195
230
  enabled: no
196
231
  queue: jabber_notifications
@@ -205,12 +240,19 @@ development:
205
240
  logger:
206
241
  level: INFO
207
242
  syslog_errors: yes
243
+ # location of custom alert templates
244
+ #templates:
245
+ # rollup.text: '/etc/flapjack/templates/jabber/rollup.text.erb'
246
+ # alert.text: '/etc/flapjack/templates/jabber/alert.text.erb'
208
247
  pagerduty:
209
248
  enabled: no
210
249
  queue: pagerduty_notifications
211
250
  logger:
212
251
  level: INFO
213
252
  syslog_errors: yes
253
+ # location of custom alert templates
254
+ #templates:
255
+ # alert.text: '/etc/flapjack/templates/pagerduty/alert.text.erb'
214
256
  web:
215
257
  enabled: yes
216
258
  port: 4080
@@ -29,7 +29,7 @@ Gem::Specification.new do |gem|
29
29
  gem.add_dependency 'resque', '~> 1.23.0'
30
30
  gem.add_dependency 'sinatra'
31
31
  gem.add_dependency 'rack-fiber_pool'
32
- gem.add_dependency 'thin'
32
+ gem.add_dependency 'thin', '~> 1.6.1'
33
33
  gem.add_dependency 'mail'
34
34
  gem.add_dependency 'blather', '~> 0.8.3'
35
35
  gem.add_dependency 'chronic'
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'digest'
4
+
3
5
  require 'active_support/inflector'
4
6
  require 'flapjack/utility'
5
7
 
@@ -44,7 +46,8 @@ module Flapjack
44
46
  # from self
45
47
  attr_reader :entity,
46
48
  :check,
47
- :notification_id
49
+ :notification_id,
50
+ :event_hash
48
51
 
49
52
  include Flapjack::Utility
50
53
 
@@ -52,6 +55,8 @@ module Flapjack
52
55
  raise "no logger supplied" unless @logger = opts[:logger]
53
56
 
54
57
  @event_id = contents['event_id']
58
+ @event_hash = contents['event_hash'] ||
59
+ Digest.hexencode(Digest::SHA1.new.digest(@event_id))[0..7].downcase
55
60
  @state = contents['state']
56
61
  @summary = contents['summary']
57
62
  @acknowledgement_duration = contents['duration'] # SMELLY
@@ -105,6 +105,16 @@ module Flapjack
105
105
  end
106
106
  end
107
107
 
108
+ def self.unacknowledged_failing(options = {})
109
+ raise "Redis connection not set" unless redis = options[:redis]
110
+
111
+ redis.zrange('failed_checks', '0', '-1').reject {|entity_check|
112
+ redis.exists(entity_check + ':unscheduled_maintenance')
113
+ }.collect {|entity_check|
114
+ Flapjack::Data::EntityCheck.for_event_id(entity_check, :redis => redis)
115
+ }
116
+ end
117
+
108
118
  def self.conflate_to_keys(entity_checks_hash)
109
119
  result = []
110
120
  entity_checks_hash.each {|entity, checks|
@@ -617,6 +627,16 @@ module Flapjack
617
627
  ta += check.split(' ').map {|x| x.downcase}
618
628
  end
619
629
 
630
+ def ack_hash
631
+ @ack_hash ||= @redis.hget('check_hashes_by_id', @key)
632
+ if @ack_hash.nil?
633
+ sha1 = Digest::SHA1.new
634
+ @ack_hash = Digest.hexencode(sha1.digest(@key))[0..7].downcase
635
+ @redis.hset("checks_by_hash", @ack_hash, @key)
636
+ end
637
+ @ack_hash
638
+ end
639
+
620
640
  private
621
641
 
622
642
  def initialize(entity, check, options = {})
@@ -6,7 +6,7 @@ module Flapjack
6
6
  module Data
7
7
  class Event
8
8
 
9
- attr_accessor :counter, :tags
9
+ attr_accessor :counter, :id_hash, :tags
10
10
 
11
11
  attr_reader :check, :summary, :details, :acknowledgement_id
12
12
 
@@ -52,6 +52,7 @@ module Flapjack
52
52
 
53
53
  tag_data = event.tags.is_a?(Set) ? event.tags.to_a : nil
54
54
  notif = {'event_id' => event.id,
55
+ 'event_hash' => event.id_hash,
55
56
  'state' => event.state,
56
57
  'summary' => event.summary,
57
58
  'details' => event.details,
@@ -105,6 +106,7 @@ module Flapjack
105
106
 
106
107
  def contents
107
108
  @contents ||= {'event_id' => @event_id,
109
+ 'event_hash' => @event_hash,
108
110
  'state' => @state,
109
111
  'summary' => @summary,
110
112
  'duration' => @duration,
@@ -107,19 +107,27 @@ module Flapjack
107
107
  message_id = opts[:message_id]
108
108
  alert = opts[:alert]
109
109
 
110
- message_type = case
111
- when alert.rollup
112
- 'rollup'
113
- else
114
- 'alert'
115
- end
110
+ message_type = alert.rollup ? 'rollup' : 'alert'
116
111
 
117
112
  mydir = File.dirname(__FILE__)
118
-
119
- subject_template_path = mydir + "/email/#{message_type}_subject.text.erb"
120
- text_template_path = mydir + "/email/#{message_type}.text.erb"
121
- html_template_path = mydir + "/email/#{message_type}.html.erb"
122
-
113
+ subject_template_path = case
114
+ when @config.has_key?('templates') && @config['templates']["#{message_type}_subject.text"]
115
+ @config['templates']["#{message_type}_subject.text"]
116
+ else
117
+ mydir + "/email/#{message_type}_subject.text.erb"
118
+ end
119
+ text_template_path = case
120
+ when @config.has_key?('templates') && @config['templates']["#{message_type}.text"]
121
+ @config['templates']["#{message_type}.text"]
122
+ else
123
+ mydir + "/email/#{message_type}.text.erb"
124
+ end
125
+ html_template_path = case
126
+ when @config.has_key?('templates') && @config['templates']["#{message_type}.html"]
127
+ @config['templates']["#{message_type}.html"]
128
+ else
129
+ mydir + "/email/#{message_type}.html.erb"
130
+ end
123
131
  subject_template = ERB.new(File.read(subject_template_path), nil, '-')
124
132
  text_template = ERB.new(File.read(text_template_path), nil, '-')
125
133
  html_template = ERB.new(File.read(html_template_path), nil, '-')
@@ -171,7 +171,7 @@ module Flapjack
171
171
  command = th.chunks.join(' ')
172
172
 
173
173
  case command
174
- when /^ACKID\s+(\d+)(?:\s*(.*?)(?:\s*duration:.*?(\w+.*))?)$/im
174
+ when /^ACKID\s+([0-9A-F]+)(?:\s*(.*?)(?:\s*duration:.*?(\w+.*))?)$/im
175
175
  ackid = $1
176
176
  comment = $2
177
177
  duration_str = $3
@@ -189,7 +189,7 @@ module Flapjack
189
189
  four_hours = 4 * 60 * 60
190
190
  duration = (dur.nil? || (dur <= 0)) ? four_hours : dur
191
191
 
192
- event_id = @redis.hget('unacknowledged_failures', ackid)
192
+ event_id = @redis.hget('check_hashes', ackid)
193
193
 
194
194
  if event_id.nil?
195
195
  error = "not found"
@@ -523,17 +523,21 @@ module Flapjack
523
523
  @logger.debug("processing jabber notification address: #{alert.address}, entity: #{alert.entity}, " +
524
524
  "check: '#{alert.check}', state: #{alert.state}, summary: #{alert.summary}")
525
525
 
526
- @ack_str =
527
- alert.event_count &&
528
- !alert.state.eql?('ok') &&
529
- !'acknowledgement'.eql?(alert.type) &&
530
- !'test'.eql?(alert.type) ?
531
- "#{@config['alias']}: ACKID #{event['event_count']}" : nil
526
+ @ack_str = if alert.state.eql?('ok') || ['test', 'acknowledgement'].include?(alert.type)
527
+ nil
528
+ else
529
+ "#{@config['alias']}: ACKID #{alert.event_hash}"
530
+ end
532
531
 
533
532
  message_type = alert.rollup ? 'rollup' : 'alert'
534
533
 
535
534
  mydir = File.dirname(__FILE__)
536
- message_template_path = mydir + "/jabber/#{message_type}.text.erb"
535
+ message_template_path = case
536
+ when @config.has_key?('templates') && @config['templates']["#{message_type}.text"]
537
+ @config['templates']["#{message_type}.text"]
538
+ else
539
+ mydir + "/jabber/#{message_type}.text.erb"
540
+ end
537
541
  message_template = ERB.new(File.read(message_template_path), nil, '-')
538
542
 
539
543
  @alert = alert
@@ -195,8 +195,14 @@ module Flapjack
195
195
  query_string = (request.query_string.respond_to?(:length) &&
196
196
  request.query_string.length > 0) ? "?#{request.query_string}" : ""
197
197
  if logger.debug?
198
+ body_debug = case
199
+ when response.body.respond_to?(:each)
200
+ response.body.each_with_index {|r, i| "body[#{i}]: #{r}"}.join(', ')
201
+ else
202
+ response.body.to_s
203
+ end
198
204
  logger.debug("Returning #{response.status} for #{request.request_method} " +
199
- "#{request.path_info}#{query_string}, body: #{response.body}")
205
+ "#{request.path_info}#{query_string}, body: #{body_debug}")
200
206
  elsif logger.info?
201
207
  logger.info("Returning #{response.status} for #{request.request_method} " +
202
208
  "#{request.path_info}#{query_string}")
@@ -130,7 +130,6 @@ module Flapjack
130
130
  contacts_data.map {|cd| cd['id']}.to_json
131
131
  end
132
132
 
133
-
134
133
  # Returns all (/contacts) or some (/contacts/1,2,3) or one (/contact/2) contact(s)
135
134
  # https://github.com/flpjck/flapjack/wiki/API#wiki-get_contacts
136
135
  app.get %r{/contacts(?:/)?([^/]+)?$} do
@@ -7,7 +7,6 @@ require 'em-synchrony/em-http'
7
7
  require 'oj'
8
8
 
9
9
  require 'flapjack/data/entity_check'
10
- require 'flapjack/data/global'
11
10
  require 'flapjack/data/alert'
12
11
  require 'flapjack/redis_pool'
13
12
  require 'flapjack/utility'
@@ -81,7 +80,12 @@ module Flapjack
81
80
  "check: '#{alert.check}', state: #{alert.state}, summary: #{alert.summary}")
82
81
 
83
82
  mydir = File.dirname(__FILE__)
84
- message_template_path = mydir + "/pagerduty/alert.text.erb"
83
+ message_template_path = case
84
+ when @config.has_key?('templates') && @config['templates']['alert.text']
85
+ @config['templates']['alert.text']
86
+ else
87
+ mydir + "/pagerduty/alert.text.erb"
88
+ end
85
89
  message_template = ERB.new(File.read(message_template_path), nil, '-')
86
90
 
87
91
  @alert = alert
@@ -174,7 +178,7 @@ module Flapjack
174
178
  def find_pagerduty_acknowledgements
175
179
  @logger.debug("looking for acks in pagerduty for unack'd problems")
176
180
 
177
- unacknowledged_failing_checks = Flapjack::Data::Global.unacknowledged_failing_checks(:redis => @redis)
181
+ unacknowledged_failing_checks = Flapjack::Data::EntityCheck.unacknowledged_failing(:redis => @redis)
178
182
 
179
183
  @logger.debug "found unacknowledged failing checks as follows: " + unacknowledged_failing_checks.join(', ')
180
184
 
@@ -34,7 +34,12 @@ module Flapjack
34
34
  message_type = alert.rollup ? 'rollup' : 'alert'
35
35
 
36
36
  my_dir = File.dirname(__FILE__)
37
- sms_template_path = my_dir + "/sms_messagenet/#{message_type}.text.erb"
37
+ sms_template_path = case
38
+ when @config.has_key?('templates') && @config['templates']["#{message_type}.text"]
39
+ @config['templates']["#{message_type}.text"]
40
+ else
41
+ my_dir + "/sms_messagenet/#{message_type}.text.erb"
42
+ end
38
43
  sms_template = ERB.new(File.read(sms_template_path), nil, '-')
39
44
 
40
45
  @alert = alert
@@ -218,8 +218,7 @@ module Flapjack
218
218
  @last_notifications = last_notification_data(entity_check)
219
219
 
220
220
  @scheduled_maintenances = entity_check.maintenances(nil, nil, :scheduled => true)
221
- @acknowledgement_id = entity_check.failed? ?
222
- entity_check.event_count_at(entity_check.last_change) : nil
221
+ @acknowledgement_id = entity_check.failed? ? entity_check.ack_hash : nil
223
222
 
224
223
  @current_scheduled_maintenance = entity_check.current_maintenance(:scheduled => true)
225
224
  @current_unscheduled_maintenance = entity_check.current_maintenance(:scheduled => false)
@@ -175,6 +175,12 @@ module Flapjack
175
175
  case event.type
176
176
  # Service events represent current state of checks on monitored systems
177
177
  when 'service'
178
+ if event.failure?
179
+ # ensure that the check's hash is stored for later lookup
180
+ # can't happen inside the multi as it must get a value
181
+ event.id_hash = entity_check.ack_hash
182
+ end
183
+
178
184
  @redis.multi
179
185
  if event.ok?
180
186
  @redis.hincrby('event_counters', 'ok', 1)
@@ -182,7 +188,6 @@ module Flapjack
182
188
  elsif event.failure?
183
189
  @redis.hincrby('event_counters', 'failure', 1)
184
190
  @redis.hincrby("event_counters:#{@instance_id}", 'failure', 1)
185
- @redis.hset('unacknowledged_failures', event.counter, event.id)
186
191
  end
187
192
  @redis.exec
188
193
 
@@ -217,10 +222,6 @@ module Flapjack
217
222
  @redis.hset(event.id + ':actions', timestamp, event.state)
218
223
  @redis.hincrby('event_counters', 'action', 1)
219
224
  @redis.hincrby("event_counters:#{@instance_id}", 'action', 1)
220
-
221
- if event.acknowledgement? && event.acknowledgement_id
222
- @redis.hdel('unacknowledged_failures', event.acknowledgement_id)
223
- end
224
225
  @redis.exec
225
226
  end
226
227
 
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  module Flapjack
4
- VERSION = "0.8.5"
4
+ VERSION = "0.8.6"
5
5
  end
@@ -597,4 +597,6 @@ describe Flapjack::Data::EntityCheck, :redis => true do
597
597
  expect(['foo-app-01', 'example.com', 'disk', '/', 'utilisation'].to_set.subset?(tags)).to be true
598
598
  end
599
599
 
600
+ it "returns unacknowledged failing checks"
601
+
600
602
  end
@@ -52,13 +52,13 @@ describe Flapjack::Gateways::Jabber, :logger => true do
52
52
  end
53
53
 
54
54
  it "receives an acknowledgement message" do
55
- expect(stanza).to receive(:body).and_return('flapjack: ACKID 876 fixing now duration: 90m')
55
+ expect(stanza).to receive(:body).and_return('flapjack: ACKID 1f8ac10f fixing now duration: 90m')
56
56
  from = double('from')
57
57
  expect(from).to receive(:stripped).and_return('sender')
58
58
  expect(stanza).to receive(:from).and_return(from)
59
59
 
60
60
  redis = double('redis')
61
- expect(redis).to receive(:hget).with('unacknowledged_failures', '876').
61
+ expect(redis).to receive(:hget).with('check_hashes', '1f8ac10f').
62
62
  and_return('main-example.com:ping')
63
63
 
64
64
  entity_check = double(Flapjack::Data::EntityCheck)
@@ -66,7 +66,7 @@ describe Flapjack::Gateways::Jabber, :logger => true do
66
66
 
67
67
  expect(Flapjack::Data::Event).to receive(:create_acknowledgement).
68
68
  with('main-example.com', 'ping', :summary => 'fixing now',
69
- :acknowledgement_id => '876',
69
+ :acknowledgement_id => '1f8ac10f',
70
70
  :duration => (90 * 60), :redis => redis)
71
71
 
72
72
  expect(Flapjack::Data::EntityCheck).to receive(:for_event_id).
@@ -109,7 +109,7 @@ describe Flapjack::Gateways::Pagerduty, :logger => true do
109
109
  expect(Flapjack::Data::Event).to receive(:create_acknowledgement).with('foo-app-01.bar.net', 'PING',
110
110
  :summary => 'Acknowledged on PagerDuty', :duration => 14400, :redis => redis)
111
111
 
112
- expect(Flapjack::Data::Global).to receive(:unacknowledged_failing_checks).and_return([entity_check])
112
+ expect(Flapjack::Data::EntityCheck).to receive(:unacknowledged_failing).and_return([entity_check])
113
113
 
114
114
  expect(fp).to receive(:pagerduty_acknowledged?).and_return({})
115
115
 
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.8.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lindsay Holmwood
@@ -10,300 +10,300 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-02-09 00:00:00.000000000 Z
13
+ date: 2014-03-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: dante
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - '>='
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - '>='
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: oj
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - '>='
33
+ - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: '0'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: eventmachine
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ~>
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
49
  version: 1.0.0
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ~>
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
56
  version: 1.0.0
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: hiredis
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: em-synchrony
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ~>
75
+ - - "~>"
76
76
  - !ruby/object:Gem::Version
77
77
  version: 1.0.2
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ~>
82
+ - - "~>"
83
83
  - !ruby/object:Gem::Version
84
84
  version: 1.0.2
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: em-http-request
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: redis
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - ~>
103
+ - - "~>"
104
104
  - !ruby/object:Gem::Version
105
105
  version: 3.0.6
106
106
  type: :runtime
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - ~>
110
+ - - "~>"
111
111
  - !ruby/object:Gem::Version
112
112
  version: 3.0.6
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: em-resque
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - '>='
117
+ - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  type: :runtime
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - '>='
124
+ - - ">="
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: resque
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - ~>
131
+ - - "~>"
132
132
  - !ruby/object:Gem::Version
133
133
  version: 1.23.0
134
134
  type: :runtime
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
- - - ~>
138
+ - - "~>"
139
139
  - !ruby/object:Gem::Version
140
140
  version: 1.23.0
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: sinatra
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - '>='
145
+ - - ">="
146
146
  - !ruby/object:Gem::Version
147
147
  version: '0'
148
148
  type: :runtime
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - '>='
152
+ - - ">="
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: rack-fiber_pool
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
- - - '>='
159
+ - - ">="
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  type: :runtime
163
163
  prerelease: false
164
164
  version_requirements: !ruby/object:Gem::Requirement
165
165
  requirements:
166
- - - '>='
166
+ - - ">="
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0'
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: thin
171
171
  requirement: !ruby/object:Gem::Requirement
172
172
  requirements:
173
- - - '>='
173
+ - - "~>"
174
174
  - !ruby/object:Gem::Version
175
- version: '0'
175
+ version: 1.6.1
176
176
  type: :runtime
177
177
  prerelease: false
178
178
  version_requirements: !ruby/object:Gem::Requirement
179
179
  requirements:
180
- - - '>='
180
+ - - "~>"
181
181
  - !ruby/object:Gem::Version
182
- version: '0'
182
+ version: 1.6.1
183
183
  - !ruby/object:Gem::Dependency
184
184
  name: mail
185
185
  requirement: !ruby/object:Gem::Requirement
186
186
  requirements:
187
- - - '>='
187
+ - - ">="
188
188
  - !ruby/object:Gem::Version
189
189
  version: '0'
190
190
  type: :runtime
191
191
  prerelease: false
192
192
  version_requirements: !ruby/object:Gem::Requirement
193
193
  requirements:
194
- - - '>='
194
+ - - ">="
195
195
  - !ruby/object:Gem::Version
196
196
  version: '0'
197
197
  - !ruby/object:Gem::Dependency
198
198
  name: blather
199
199
  requirement: !ruby/object:Gem::Requirement
200
200
  requirements:
201
- - - ~>
201
+ - - "~>"
202
202
  - !ruby/object:Gem::Version
203
203
  version: 0.8.3
204
204
  type: :runtime
205
205
  prerelease: false
206
206
  version_requirements: !ruby/object:Gem::Requirement
207
207
  requirements:
208
- - - ~>
208
+ - - "~>"
209
209
  - !ruby/object:Gem::Version
210
210
  version: 0.8.3
211
211
  - !ruby/object:Gem::Dependency
212
212
  name: chronic
213
213
  requirement: !ruby/object:Gem::Requirement
214
214
  requirements:
215
- - - '>='
215
+ - - ">="
216
216
  - !ruby/object:Gem::Version
217
217
  version: '0'
218
218
  type: :runtime
219
219
  prerelease: false
220
220
  version_requirements: !ruby/object:Gem::Requirement
221
221
  requirements:
222
- - - '>='
222
+ - - ">="
223
223
  - !ruby/object:Gem::Version
224
224
  version: '0'
225
225
  - !ruby/object:Gem::Dependency
226
226
  name: chronic_duration
227
227
  requirement: !ruby/object:Gem::Requirement
228
228
  requirements:
229
- - - '>='
229
+ - - ">="
230
230
  - !ruby/object:Gem::Version
231
231
  version: '0'
232
232
  type: :runtime
233
233
  prerelease: false
234
234
  version_requirements: !ruby/object:Gem::Requirement
235
235
  requirements:
236
- - - '>='
236
+ - - ">="
237
237
  - !ruby/object:Gem::Version
238
238
  version: '0'
239
239
  - !ruby/object:Gem::Dependency
240
240
  name: activesupport
241
241
  requirement: !ruby/object:Gem::Requirement
242
242
  requirements:
243
- - - ~>
243
+ - - "~>"
244
244
  - !ruby/object:Gem::Version
245
245
  version: 3.2.14
246
246
  type: :runtime
247
247
  prerelease: false
248
248
  version_requirements: !ruby/object:Gem::Requirement
249
249
  requirements:
250
- - - ~>
250
+ - - "~>"
251
251
  - !ruby/object:Gem::Version
252
252
  version: 3.2.14
253
253
  - !ruby/object:Gem::Dependency
254
254
  name: ice_cube
255
255
  requirement: !ruby/object:Gem::Requirement
256
256
  requirements:
257
- - - '>='
257
+ - - ">="
258
258
  - !ruby/object:Gem::Version
259
259
  version: '0'
260
260
  type: :runtime
261
261
  prerelease: false
262
262
  version_requirements: !ruby/object:Gem::Requirement
263
263
  requirements:
264
- - - '>='
264
+ - - ">="
265
265
  - !ruby/object:Gem::Version
266
266
  version: '0'
267
267
  - !ruby/object:Gem::Dependency
268
268
  name: tzinfo
269
269
  requirement: !ruby/object:Gem::Requirement
270
270
  requirements:
271
- - - ~>
271
+ - - "~>"
272
272
  - !ruby/object:Gem::Version
273
273
  version: 1.0.1
274
274
  type: :runtime
275
275
  prerelease: false
276
276
  version_requirements: !ruby/object:Gem::Requirement
277
277
  requirements:
278
- - - ~>
278
+ - - "~>"
279
279
  - !ruby/object:Gem::Version
280
280
  version: 1.0.1
281
281
  - !ruby/object:Gem::Dependency
282
282
  name: tzinfo-data
283
283
  requirement: !ruby/object:Gem::Requirement
284
284
  requirements:
285
- - - '>='
285
+ - - ">="
286
286
  - !ruby/object:Gem::Version
287
287
  version: '0'
288
288
  type: :runtime
289
289
  prerelease: false
290
290
  version_requirements: !ruby/object:Gem::Requirement
291
291
  requirements:
292
- - - '>='
292
+ - - ">="
293
293
  - !ruby/object:Gem::Version
294
294
  version: '0'
295
295
  - !ruby/object:Gem::Dependency
296
296
  name: rake
297
297
  requirement: !ruby/object:Gem::Requirement
298
298
  requirements:
299
- - - '>='
299
+ - - ">="
300
300
  - !ruby/object:Gem::Version
301
301
  version: '0'
302
302
  type: :development
303
303
  prerelease: false
304
304
  version_requirements: !ruby/object:Gem::Requirement
305
305
  requirements:
306
- - - '>='
306
+ - - ">="
307
307
  - !ruby/object:Gem::Version
308
308
  version: '0'
309
309
  description: Flapjack is a distributed monitoring notification system that provides
@@ -313,6 +313,7 @@ email: lindsay@holmwood.id.au
313
313
  executables:
314
314
  - flapjack
315
315
  - flapjack-nagios-receiver
316
+ - flapjack-nsca-receiver
316
317
  - flapjack-populator
317
318
  - flapper
318
319
  - receive-events
@@ -320,10 +321,10 @@ executables:
320
321
  extensions: []
321
322
  extra_rdoc_files: []
322
323
  files:
323
- - .gitignore
324
- - .gitmodules
325
- - .rspec
326
- - .travis.yml
324
+ - ".gitignore"
325
+ - ".gitmodules"
326
+ - ".rspec"
327
+ - ".travis.yml"
327
328
  - CHANGELOG.md
328
329
  - Gemfile
329
330
  - Guardfile
@@ -332,6 +333,7 @@ files:
332
333
  - Rakefile
333
334
  - bin/flapjack
334
335
  - bin/flapjack-nagios-receiver
336
+ - bin/flapjack-nsca-receiver
335
337
  - bin/flapjack-populator
336
338
  - bin/flapper
337
339
  - bin/receive-events
@@ -370,7 +372,6 @@ files:
370
372
  - lib/flapjack/data/entity.rb
371
373
  - lib/flapjack/data/entity_check.rb
372
374
  - lib/flapjack/data/event.rb
373
- - lib/flapjack/data/global.rb
374
375
  - lib/flapjack/data/message.rb
375
376
  - lib/flapjack/data/notification.rb
376
377
  - lib/flapjack/data/notification_rule.rb
@@ -486,7 +487,6 @@ files:
486
487
  - spec/lib/flapjack/data/entity_check_spec.rb
487
488
  - spec/lib/flapjack/data/entity_spec.rb
488
489
  - spec/lib/flapjack/data/event_spec.rb
489
- - spec/lib/flapjack/data/global_spec.rb
490
490
  - spec/lib/flapjack/data/message_spec.rb
491
491
  - spec/lib/flapjack/data/notification_rule_spec.rb
492
492
  - spec/lib/flapjack/data/notification_spec.rb
@@ -557,17 +557,17 @@ require_paths:
557
557
  - lib
558
558
  required_ruby_version: !ruby/object:Gem::Requirement
559
559
  requirements:
560
- - - '>='
560
+ - - ">="
561
561
  - !ruby/object:Gem::Version
562
562
  version: '0'
563
563
  required_rubygems_version: !ruby/object:Gem::Requirement
564
564
  requirements:
565
- - - '>='
565
+ - - ">="
566
566
  - !ruby/object:Gem::Version
567
567
  version: '0'
568
568
  requirements: []
569
569
  rubyforge_project:
570
- rubygems_version: 2.0.14
570
+ rubygems_version: 2.2.2
571
571
  signing_key:
572
572
  specification_version: 4
573
573
  summary: Intelligent, scalable, distributed monitoring notification system.
@@ -598,7 +598,6 @@ test_files:
598
598
  - spec/lib/flapjack/data/entity_check_spec.rb
599
599
  - spec/lib/flapjack/data/entity_spec.rb
600
600
  - spec/lib/flapjack/data/event_spec.rb
601
- - spec/lib/flapjack/data/global_spec.rb
602
601
  - spec/lib/flapjack/data/message_spec.rb
603
602
  - spec/lib/flapjack/data/notification_rule_spec.rb
604
603
  - spec/lib/flapjack/data/notification_spec.rb
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'flapjack/data/entity_check'
4
-
5
- module Flapjack
6
-
7
- module Data
8
-
9
- class Global
10
-
11
- # TODO maybe this should be an EntityCheck class method?
12
- def self.unacknowledged_failing_checks(options = {})
13
- raise "Redis connection not set" unless redis = options[:redis]
14
-
15
- redis.zrange('failed_checks', '0', '-1').reject {|entity_check|
16
- redis.exists(entity_check + ':unscheduled_maintenance')
17
- }.collect {|entity_check|
18
- Flapjack::Data::EntityCheck.for_event_id(entity_check, :redis => redis)
19
- }
20
- end
21
-
22
- end
23
-
24
- end
25
-
26
- end
@@ -1,8 +0,0 @@
1
- require 'spec_helper'
2
- require 'flapjack/data/global'
3
-
4
- describe Flapjack::Data::Global do
5
-
6
- it "returns unacknowledged failing checks"
7
-
8
- end