flapjack 0.5.5 → 0.6.23
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.
- data/.gitignore +10 -0
- data/.rbenv-version +1 -0
- data/.rspec +10 -0
- data/Gemfile +18 -0
- data/Guardfile +14 -0
- data/README.md +152 -173
- data/Rakefile +53 -150
- data/bin/flapjack +72 -0
- data/bin/flapjack-nagios-receiver +111 -0
- data/bin/flapjack-nagios-receiver-control +15 -0
- data/bin/flapjack-netsaint-parser +0 -2
- data/bin/flapjack-populator +133 -16
- data/bin/install-flapjack-systemwide +2 -2
- data/config.ru +11 -0
- data/dist/etc/init.d/flapjack +46 -0
- data/dist/etc/init.d/flapjack-nagios-receiver +36 -0
- data/doc/GLOSSARY.md +19 -0
- data/etc/flapjack_config.yaml.example +90 -0
- data/features/events.feature +132 -0
- data/features/notifications.feature +57 -0
- data/features/packaging-lintian.feature +5 -3
- data/features/steps/events_steps.rb +164 -0
- data/features/steps/flapjack-importer_steps.rb +2 -5
- data/features/steps/flapjack-worker_steps.rb +13 -6
- data/features/steps/notifications_steps.rb +178 -0
- data/features/steps/packaging-lintian_steps.rb +14 -0
- data/features/steps/time_travel_steps.rb +34 -0
- data/features/support/env.rb +63 -36
- data/flapjack.gemspec +35 -186
- data/lib/flapjack.rb +2 -0
- data/lib/flapjack/api.rb +274 -0
- data/lib/flapjack/api/entity_check_presenter.rb +184 -0
- data/lib/flapjack/api/entity_presenter.rb +66 -0
- data/lib/flapjack/cli/worker_manager.rb +1 -2
- data/lib/flapjack/configuration.rb +11 -0
- data/lib/flapjack/coordinator.rb +288 -0
- data/lib/flapjack/daemonizing.rb +186 -0
- data/lib/flapjack/data/contact.rb +45 -0
- data/lib/flapjack/data/entity.rb +89 -0
- data/lib/flapjack/data/entity_check.rb +396 -0
- data/lib/flapjack/data/event.rb +144 -0
- data/lib/flapjack/data/notification.rb +13 -0
- data/lib/flapjack/executive.rb +289 -0
- data/lib/flapjack/filters/acknowledgement.rb +39 -0
- data/lib/flapjack/filters/{any_parents_failed.rb → base.rb} +6 -4
- data/lib/flapjack/filters/delays.rb +53 -0
- data/lib/flapjack/filters/detect_mass_client_failures.rb +44 -0
- data/lib/flapjack/filters/ok.rb +25 -5
- data/lib/flapjack/filters/scheduled_maintenance.rb +17 -0
- data/lib/flapjack/filters/unscheduled_maintenance.rb +17 -0
- data/lib/flapjack/jabber.rb +294 -0
- data/lib/flapjack/notification/common.rb +23 -0
- data/lib/flapjack/notification/email.rb +107 -0
- data/lib/flapjack/notification/email/alert.html.haml +48 -0
- data/lib/flapjack/notification/email/alert.text.erb +14 -0
- data/lib/flapjack/notification/sms.rb +42 -0
- data/lib/flapjack/notification/sms/messagenet.rb +49 -0
- data/lib/flapjack/notifier_engine.rb +4 -4
- data/lib/flapjack/notifiers/mailer/mailer.rb +6 -7
- data/lib/flapjack/notifiers/xmpp/xmpp.rb +12 -12
- data/lib/flapjack/pagerduty.rb +230 -0
- data/lib/flapjack/patches.rb +108 -19
- data/lib/flapjack/persistence/data_mapper/models/check.rb +5 -3
- data/lib/flapjack/persistence/data_mapper/models/check_template.rb +2 -0
- data/lib/flapjack/persistence/data_mapper/models/event.rb +2 -0
- data/lib/flapjack/persistence/data_mapper/models/node.rb +3 -1
- data/lib/flapjack/persistence/data_mapper/models/related_check.rb +3 -1
- data/lib/flapjack/pikelet.rb +56 -0
- data/lib/flapjack/transports/beanstalkd.rb +1 -1
- data/lib/flapjack/transports/result.rb +6 -6
- data/lib/flapjack/utility.rb +46 -0
- data/lib/flapjack/version.rb +5 -0
- data/lib/flapjack/web.rb +198 -0
- data/lib/flapjack/web/views/acknowledge.haml +55 -0
- data/lib/flapjack/web/views/check.haml +162 -0
- data/lib/flapjack/web/views/index.haml +92 -0
- data/lib/flapjack/web/views/self_stats.haml +56 -0
- data/lib/flapjack/{applications/worker.rb → worker/application.rb} +0 -0
- data/lib/flapjack/worker/cli.rb +49 -0
- data/{spec → spec.old}/check_sandbox/echo +0 -0
- data/{spec → spec.old}/check_sandbox/sandboxed_check +0 -0
- data/{spec → spec.old}/configs/flapjack-notifier-couchdb.ini +0 -0
- data/{spec → spec.old}/configs/flapjack-notifier.ini +0 -0
- data/{spec → spec.old}/configs/recipients.ini +0 -0
- data/{spec → spec.old}/helpers.rb +0 -0
- data/{spec → spec.old}/inifile_spec.rb +0 -0
- data/{spec → spec.old}/mock-notifiers/mock/init.rb +0 -0
- data/{spec → spec.old}/mock-notifiers/mock/mock.rb +0 -0
- data/{spec → spec.old}/notifier-directories/spoons/testmailer/init.rb +0 -0
- data/{spec → spec.old}/notifier_application_spec.rb +0 -0
- data/{spec → spec.old}/notifier_filters_spec.rb +0 -0
- data/{spec → spec.old}/notifier_options_multiplexer_spec.rb +0 -0
- data/{spec → spec.old}/notifier_options_spec.rb +0 -0
- data/{spec → spec.old}/notifier_spec.rb +0 -0
- data/{spec → spec.old}/notifiers/mailer_spec.rb +0 -0
- data/{spec → spec.old}/notifiers/xmpp_spec.rb +0 -0
- data/{spec → spec.old}/persistence/datamapper_spec.rb +0 -0
- data/{spec → spec.old}/persistence/mock_persistence_backend.rb +0 -0
- data/{spec → spec.old}/simple.ini +0 -0
- data/{spec → spec.old}/spec.opts +0 -0
- data/{spec → spec.old}/test-filters/blocker.rb +0 -0
- data/{spec → spec.old}/test-filters/mock.rb +0 -0
- data/{spec → spec.old}/transports/beanstalkd_spec.rb +0 -0
- data/{spec → spec.old}/transports/mock_transport.rb +0 -0
- data/{spec → spec.old}/worker_application_spec.rb +0 -0
- data/{spec → spec.old}/worker_options_spec.rb +0 -0
- data/spec/lib/flapjack/api/entity_check_presenter_spec.rb +117 -0
- data/spec/lib/flapjack/api/entity_presenter_spec.rb +92 -0
- data/spec/lib/flapjack/api_spec.rb +170 -0
- data/spec/lib/flapjack/coordinator_spec.rb +16 -0
- data/spec/lib/flapjack/data/entity_check_spec.rb +398 -0
- data/spec/lib/flapjack/data/entity_spec.rb +71 -0
- data/spec/lib/flapjack/data/event_spec.rb +6 -0
- data/spec/lib/flapjack/executive_spec.rb +59 -0
- data/spec/lib/flapjack/filters/acknowledgement_spec.rb +6 -0
- data/spec/lib/flapjack/filters/delays_spec.rb +6 -0
- data/spec/lib/flapjack/filters/detect_mass_client_failures_spec.rb +6 -0
- data/spec/lib/flapjack/filters/ok_spec.rb +6 -0
- data/spec/lib/flapjack/filters/scheduled_maintenance_spec.rb +6 -0
- data/spec/lib/flapjack/filters/unscheduled_maintenance_spec.rb +6 -0
- data/spec/lib/flapjack/jabber_spec.rb +150 -0
- data/spec/lib/flapjack/notification/email_spec.rb +6 -0
- data/spec/lib/flapjack/notification/sms_spec.rb +6 -0
- data/spec/lib/flapjack/pikelet_spec.rb +28 -0
- data/spec/lib/flapjack/web_spec.rb +188 -0
- data/spec/spec_helper.rb +44 -0
- data/spec/support/profile_all_formatter.rb +44 -0
- data/spec/support/uncolored_doc_formatter.rb +9 -0
- data/tasks/events.rake +85 -0
- data/tmp/acknowledge.rb +14 -0
- data/tmp/create_config_yaml.rb +16 -0
- data/tmp/create_events_failure.rb +33 -0
- data/tmp/create_events_ok.rb +33 -0
- data/tmp/create_events_ok_fail_ack_ok.rb +54 -0
- data/tmp/create_events_ok_failure.rb +40 -0
- data/tmp/create_events_ok_failure_ack.rb +54 -0
- data/tmp/dummy_entities.json +1 -0
- data/tmp/generate_nagios_test_hosts.rb +16 -0
- data/tmp/parse_config_yaml.rb +7 -0
- data/tmp/redis_delete_all_keys.rb +11 -0
- data/tmp/test_entities.json +1 -0
- metadata +482 -221
- data/TODO.md +0 -36
- data/VERSION +0 -1
- data/bin/flapjack-benchmark +0 -50
- data/bin/flapjack-notifier +0 -21
- data/bin/flapjack-notifier-manager +0 -43
- data/bin/flapjack-stats +0 -27
- data/bin/flapjack-worker +0 -13
- data/bin/flapjack-worker-manager +0 -35
- data/dist/etc/init.d/flapjack-notifier +0 -47
- data/dist/etc/init.d/flapjack-workers +0 -44
- data/features/flapjack-notifier-manager.feature +0 -19
- data/features/flapjack-worker-manager.feature +0 -27
- data/features/flapjack-worker.feature +0 -27
- data/features/netsaint-config-converter.feature +0 -126
- data/features/persistence/couch.feature +0 -105
- data/features/persistence/sqlite3.feature +0 -105
- data/features/persistence/steps/couch_steps.rb +0 -25
- data/features/persistence/steps/generic_steps.rb +0 -102
- data/features/persistence/steps/sqlite3_steps.rb +0 -13
- data/features/steps/flapjack-notifier-manager_steps.rb +0 -24
- data/features/steps/flapjack-worker-manager_steps.rb +0 -48
- data/lib/flapjack/applications/notifier.rb +0 -222
- data/lib/flapjack/cli/notifier.rb +0 -108
- data/lib/flapjack/cli/notifier_manager.rb +0 -86
- data/lib/flapjack/cli/worker.rb +0 -51
data/TODO.md
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
* refactor couchdb backend to be less bongtastic
|
|
2
|
-
* write "action" hooks API on notifications
|
|
3
|
-
|
|
4
|
-
* write migration tool for sqlite3 => couchdb
|
|
5
|
-
|
|
6
|
-
* write persistence backend setup tool (create couchdb/sqlite3 database)
|
|
7
|
-
|
|
8
|
-
* add lintian-like checks for verifying packagability (see http://pkg-ruby-extras.alioth.debian.org/upstream-devs.html)
|
|
9
|
-
* sandbox flapjack-worker
|
|
10
|
-
* write beanstalkd.yreserve to simplify code
|
|
11
|
-
* write beanstalkd.jput, beanstalkd.jreserve for native json api
|
|
12
|
-
|
|
13
|
-
* build config file/cli options proxy
|
|
14
|
-
* build easily runnable benchmarks for flapjack-{worker,notifier}
|
|
15
|
-
|
|
16
|
-
* update installation guide
|
|
17
|
-
* clean up persistence API to be more user friendly
|
|
18
|
-
|
|
19
|
-
* write puppet manifests
|
|
20
|
-
* provide common interface for loading checks into beanstalk (extract from populator)
|
|
21
|
-
|
|
22
|
-
* write zeroconf/avahi notifier
|
|
23
|
-
* write growl notifier
|
|
24
|
-
* write sms notifier
|
|
25
|
-
* allow customisation of notifier messages (body, header)
|
|
26
|
-
|
|
27
|
-
* http://www.kitchensoap.com/2009/10/05/meanwhile-more-meta-metrics/
|
|
28
|
-
|
|
29
|
-
* add support to worker and notifier for multiple beanstalkds
|
|
30
|
-
* patch beanstalk-client to recognise DRAINING status
|
|
31
|
-
|
|
32
|
-
* write check generator
|
|
33
|
-
* include a collection of common functions
|
|
34
|
-
(logging to rrd, retreiving values, executing check)
|
|
35
|
-
|
|
36
|
-
|
data/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.5.5
|
data/bin/flapjack-benchmark
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
$: << File.dirname(__FILE__) + '/../lib' unless $:.include?(File.dirname(__FILE__) + '/../lib/')
|
|
4
|
-
|
|
5
|
-
require 'flapjack/cli/notifier'
|
|
6
|
-
require 'flapjack/applications/notifier'
|
|
7
|
-
require 'daemons'
|
|
8
|
-
require 'flapjack/patches'
|
|
9
|
-
|
|
10
|
-
# setup
|
|
11
|
-
@options = Flapjack::Notifier::Options.parse(ARGV)
|
|
12
|
-
|
|
13
|
-
log = Log4r::Logger.new("notifier")
|
|
14
|
-
log.add(Log4r::SyslogOutputter.new("notifier"))
|
|
15
|
-
|
|
16
|
-
app = Flapjack::Notifier::Application.run(:log => log,
|
|
17
|
-
:notifiers => {},
|
|
18
|
-
:filters => [],
|
|
19
|
-
:queue_backend => {:type => :beanstalkd},
|
|
20
|
-
:persistence => {:type => :data_mapper,
|
|
21
|
-
:uri => "sqlite3:///tmp/flapjack.db"})
|
|
22
|
-
|
|
23
|
-
mockapp = Flapjack::Notifier::Application.run(:log => log,
|
|
24
|
-
:notifiers => {},
|
|
25
|
-
:queue_backend => {:type => :mockbackend,
|
|
26
|
-
:basedir => File.join(File.dirname(__FILE__), '..', 'spec', 'transports')},
|
|
27
|
-
:persistence => {:type => :mockbackend,
|
|
28
|
-
:basedir => File.join(File.dirname(__FILE__), '..', 'spec', 'persistence')})
|
|
29
|
-
|
|
30
|
-
# populate
|
|
31
|
-
require 'beanstalk-client'
|
|
32
|
-
beanstalk = Beanstalk::Pool.new(["localhost:11300"], 'results')
|
|
33
|
-
|
|
34
|
-
puts "Writing 1000 passing checks onto work queue."
|
|
35
|
-
2000.times do
|
|
36
|
-
result = {:output => "some output", :check_id => 1, :retval => 0}
|
|
37
|
-
beanstalk.yput(result)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# benchmark
|
|
41
|
-
require 'benchmark'
|
|
42
|
-
|
|
43
|
-
Benchmark.bm(30) do |b|
|
|
44
|
-
b.report("beanstalkd + datamapper:") do
|
|
45
|
-
1000.times {app.process_result}
|
|
46
|
-
end
|
|
47
|
-
b.report("mock + mock:") do
|
|
48
|
-
1000.times {mockapp.process_result}
|
|
49
|
-
end
|
|
50
|
-
end
|
data/bin/flapjack-notifier
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
$: << File.dirname(__FILE__) + '/../lib' unless $:.include?(File.dirname(__FILE__) + '/../lib/')
|
|
4
|
-
|
|
5
|
-
require 'flapjack/cli/notifier'
|
|
6
|
-
require 'flapjack/applications/notifier'
|
|
7
|
-
require 'daemons'
|
|
8
|
-
require 'flapjack/patches'
|
|
9
|
-
|
|
10
|
-
@options = Flapjack::Notifier::Options.parse(ARGV)
|
|
11
|
-
|
|
12
|
-
log = Log4r::Logger.new("notifier")
|
|
13
|
-
log.add(Log4r::StdoutOutputter.new("notifier"))
|
|
14
|
-
log.add(Log4r::SyslogOutputter.new("notifier"))
|
|
15
|
-
|
|
16
|
-
app = Flapjack::Notifier::Application.run(:log => log,
|
|
17
|
-
:notifiers => @options.notifiers,
|
|
18
|
-
:transport => @options.transport,
|
|
19
|
-
:persistence => @options.persistence)
|
|
20
|
-
app.main()
|
|
21
|
-
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
$: << File.dirname(__FILE__) + '/../lib' unless $:.include?(File.dirname(__FILE__) + '/../lib/')
|
|
4
|
-
|
|
5
|
-
require 'rubygems'
|
|
6
|
-
require 'daemons'
|
|
7
|
-
require 'fileutils'
|
|
8
|
-
require 'flapjack/cli/notifier_manager'
|
|
9
|
-
require 'flapjack/patches' # for Daemons
|
|
10
|
-
|
|
11
|
-
# reassign ARGV so we don't mess with it directly
|
|
12
|
-
args = ARGV
|
|
13
|
-
args << '--help' if args.size == 0
|
|
14
|
-
options = Flapjack::NotifierManagerOptions.parse(args)
|
|
15
|
-
|
|
16
|
-
worker_path = File.join(File.dirname(__FILE__), 'flapjack-notifier')
|
|
17
|
-
|
|
18
|
-
# set up pid dir
|
|
19
|
-
pid_dir = "/var/run/flapjack/"
|
|
20
|
-
unless File.exists?(pid_dir)
|
|
21
|
-
puts "#{pid_dir} doesn't exist."
|
|
22
|
-
exit 2
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
unless File.writable?(pid_dir)
|
|
26
|
-
puts "Can't write to #{pid_dir} - check permissions?"
|
|
27
|
-
exit 2
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# construct arguments
|
|
31
|
-
daemon_args = args
|
|
32
|
-
if args.first != "stop"
|
|
33
|
-
# if we're not stopping the daemon, pass options to it
|
|
34
|
-
daemon_args += ['--', '--recipients', options.recipients,
|
|
35
|
-
'--config', File.expand_path(options.config_filename)]
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
# boot
|
|
39
|
-
Daemons.run(worker_path, :ARGV => daemon_args,
|
|
40
|
-
:multiple => false,
|
|
41
|
-
:dir_mode => :normal,
|
|
42
|
-
:dir => pid_dir)
|
|
43
|
-
|
data/bin/flapjack-stats
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'rubygems'
|
|
4
|
-
require 'beanstalk-client'
|
|
5
|
-
|
|
6
|
-
begin
|
|
7
|
-
beanstalk = Beanstalk::Pool.new(['localhost:11300'])
|
|
8
|
-
loop do
|
|
9
|
-
time = Time.now
|
|
10
|
-
beanstalk.list_tubes['localhost:11300'].each do |tube_name|
|
|
11
|
-
next if tube_name == 'default'
|
|
12
|
-
stats = beanstalk.stats_tube(tube_name)
|
|
13
|
-
message = []
|
|
14
|
-
message << "#{time} [#{tube_name}]"
|
|
15
|
-
message << "total: #{stats['total-jobs']}"
|
|
16
|
-
message << "waiting: #{stats['current-waiting']}"
|
|
17
|
-
message << "ready: #{stats['current-jobs-ready']}"
|
|
18
|
-
puts message.join(', ')
|
|
19
|
-
end
|
|
20
|
-
sleep 1
|
|
21
|
-
end
|
|
22
|
-
rescue Beanstalk::NotConnected
|
|
23
|
-
puts "beanstalk isn't up!"
|
|
24
|
-
exit 2
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
|
data/bin/flapjack-worker
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
$: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
4
|
-
|
|
5
|
-
require 'flapjack/cli/worker'
|
|
6
|
-
require 'flapjack/applications/worker'
|
|
7
|
-
|
|
8
|
-
@options = Flapjack::WorkerOptions.parse(ARGV)
|
|
9
|
-
app = Flapjack::Worker::Application.run(:host => @options.host,
|
|
10
|
-
:port => @options.port,
|
|
11
|
-
:check_directory => @options.check_directory)
|
|
12
|
-
app.main
|
|
13
|
-
|
data/bin/flapjack-worker-manager
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
$: << File.dirname(__FILE__) + '/../lib' unless $:.include?(File.dirname(__FILE__) + '/../lib/')
|
|
4
|
-
|
|
5
|
-
require 'rubygems'
|
|
6
|
-
require 'daemons'
|
|
7
|
-
require 'fileutils'
|
|
8
|
-
require 'flapjack/cli/worker_manager'
|
|
9
|
-
require 'flapjack/patches' # for Daemons
|
|
10
|
-
|
|
11
|
-
# reassign ARGV so we don't mess with it directly
|
|
12
|
-
args = ARGV
|
|
13
|
-
args << '--help' if args.size == 0
|
|
14
|
-
options = WorkerManagerOptions.parse(args)
|
|
15
|
-
|
|
16
|
-
worker_path = File.join(File.dirname(__FILE__), 'flapjack-worker')
|
|
17
|
-
|
|
18
|
-
# set up pid dir
|
|
19
|
-
pid_dir = "/var/run/flapjack"
|
|
20
|
-
FileUtils.mkdir_p(pid_dir)
|
|
21
|
-
|
|
22
|
-
# spin up a number of workers (5 is the default).
|
|
23
|
-
options.workers.times do |n|
|
|
24
|
-
# we fork for each worker, as Daemons.run backgrounds this script.
|
|
25
|
-
fork do
|
|
26
|
-
Daemons.run(worker_path,
|
|
27
|
-
:ARGV => (args + %w(-- -b localhost)),
|
|
28
|
-
:multiple => true,
|
|
29
|
-
:dir_mode => :normal,
|
|
30
|
-
:dir => pid_dir)
|
|
31
|
-
end
|
|
32
|
-
# so we don't try and stop the daemon multiple times
|
|
33
|
-
break if ARGV[0] == "stop"
|
|
34
|
-
end
|
|
35
|
-
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
#
|
|
3
|
-
# Copyright (c) 2009-2011 Lindsay Holmwood <lindsay@holmwood.id.au>
|
|
4
|
-
#
|
|
5
|
-
# flapjack-notifier
|
|
6
|
-
# Boots flapjack-notifier, notifier for Flapjack.
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local:/usr/local/sbin:/usr/local/bin:/usr/lib/flapjack/bin
|
|
10
|
-
|
|
11
|
-
if [ -f /etc/default/flapjack-notifier ]; then
|
|
12
|
-
. /etc/default/flapjack-notifier
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
# Default return value
|
|
16
|
-
RETVAL=0
|
|
17
|
-
|
|
18
|
-
if [ ! $(which flapjack-notifier-manager) ]; then
|
|
19
|
-
echo "Error: flapjack-notifier-manager isn't on your path."
|
|
20
|
-
echo "Refusing to start!"
|
|
21
|
-
exit 1
|
|
22
|
-
fi
|
|
23
|
-
|
|
24
|
-
# Evaluate command
|
|
25
|
-
case "$1" in
|
|
26
|
-
start)
|
|
27
|
-
flapjack-notifier-manager start --recipients $RECIPIENTS \
|
|
28
|
-
--port $BEANSTALKD_PORT --beanstalk $BEANSTALKD_ADDR
|
|
29
|
-
RETVAL=$?
|
|
30
|
-
;;
|
|
31
|
-
stop)
|
|
32
|
-
flapjack-notifier-manager stop --recipients $RECIPIENTS \
|
|
33
|
-
--port $BEANSTALKD_PORT --beanstalk $BEANSTALKD_ADDR
|
|
34
|
-
RETVAL=$?
|
|
35
|
-
;;
|
|
36
|
-
restart)
|
|
37
|
-
flapjack-notifier-manager restart --recipients $RECIPIENTS \
|
|
38
|
-
--port $BEANSTALKD_PORT --beanstalk $BEANSTALKD_ADDR
|
|
39
|
-
RETVAL=$?
|
|
40
|
-
;;
|
|
41
|
-
*)
|
|
42
|
-
echo "Usage: flapjack-notifier {start|stop|restart}"
|
|
43
|
-
RETVAL=1
|
|
44
|
-
;;
|
|
45
|
-
esac
|
|
46
|
-
|
|
47
|
-
exit $RETVAL
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
#
|
|
3
|
-
# Copyright (c) 2009-2011 Lindsay Holmwood <lindsay@holmwood.id.au>
|
|
4
|
-
#
|
|
5
|
-
# flapjack-workers
|
|
6
|
-
# Boots flapjack-workers, check executors for Flapjack.
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local:/usr/local/sbin:/usr/local/bin:/usr/lib/flapjack/bin
|
|
10
|
-
|
|
11
|
-
if [ -f /etc/default/flapjack-workers ]; then
|
|
12
|
-
. /etc/default/flapjack-workers
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
# Default return value
|
|
16
|
-
RETVAL=0
|
|
17
|
-
|
|
18
|
-
if [ ! $(which flapjack-worker-manager) ]; then
|
|
19
|
-
echo "flapjack-worker-manager isn't on your path."
|
|
20
|
-
echo "Refusing to start."
|
|
21
|
-
exit 1
|
|
22
|
-
fi
|
|
23
|
-
|
|
24
|
-
# Evaluate command
|
|
25
|
-
case "$1" in
|
|
26
|
-
start)
|
|
27
|
-
flapjack-worker-manager start --workers $WORKERS --checks-directory $CHECKS_DIRECTORY
|
|
28
|
-
RETVAL=$?
|
|
29
|
-
;;
|
|
30
|
-
stop)
|
|
31
|
-
flapjack-worker-manager stop
|
|
32
|
-
RETVAL=$?
|
|
33
|
-
;;
|
|
34
|
-
restart)
|
|
35
|
-
flapjack-worker-manager restart --workers $WORKERS
|
|
36
|
-
RETVAL=$?
|
|
37
|
-
;;
|
|
38
|
-
*)
|
|
39
|
-
echo "Usage: flapjack-workers {start|stop|restart}"
|
|
40
|
-
RETVAL=1
|
|
41
|
-
;;
|
|
42
|
-
esac
|
|
43
|
-
|
|
44
|
-
exit $RETVAL
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
Feature: flapjack-notifier-manager
|
|
2
|
-
So people can be notified when things break
|
|
3
|
-
A notifier must be started
|
|
4
|
-
Through an easy to use command line tool
|
|
5
|
-
|
|
6
|
-
Scenario: Starting the notifier
|
|
7
|
-
Given the flapjack-notifier-manager is on my path
|
|
8
|
-
And the "/var/run/flapjack" directory exists and is writable
|
|
9
|
-
And beanstalkd is running on localhost
|
|
10
|
-
And there are no instances of flapjack-notifier running
|
|
11
|
-
When I run "flapjack-notifier-manager start --recipients spec/configs/recipients.ini --config spec/configs/flapjack-notifier.ini"
|
|
12
|
-
Then 1 instances of "flapjack-notifier" should be running
|
|
13
|
-
|
|
14
|
-
Scenario: Stopping the notifier
|
|
15
|
-
Given there is an instance of the flapjack-notifier running
|
|
16
|
-
And beanstalkd is running on localhost
|
|
17
|
-
When I run "flapjack-notifier-manager stop"
|
|
18
|
-
Then 0 instances of "flapjack-notifier" should be running
|
|
19
|
-
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
Feature: flapjack-worker-manager
|
|
2
|
-
To scale Flapjack easily and efficiently
|
|
3
|
-
A sysadmin
|
|
4
|
-
Must be able to manage clusters of workers
|
|
5
|
-
With ease
|
|
6
|
-
From the command line
|
|
7
|
-
|
|
8
|
-
Scenario: Running multiple workers
|
|
9
|
-
Given the flapjack-worker-manager is on my path
|
|
10
|
-
And beanstalkd is running on localhost
|
|
11
|
-
And there are no instances of flapjack-worker running
|
|
12
|
-
When I run "flapjack-worker-manager start"
|
|
13
|
-
Then 5 instances of "flapjack-worker" should be running
|
|
14
|
-
|
|
15
|
-
Scenario: Running a specified number of workers
|
|
16
|
-
Given the flapjack-worker-manager is on my path
|
|
17
|
-
And beanstalkd is running on localhost
|
|
18
|
-
And there are no instances of flapjack-worker running
|
|
19
|
-
When I run "flapjack-worker-manager start --workers=10"
|
|
20
|
-
Then 10 instances of "flapjack-worker" should be running
|
|
21
|
-
|
|
22
|
-
Scenario: Stopping all workers
|
|
23
|
-
Given there are 5 instances of the flapjack-worker running
|
|
24
|
-
And beanstalkd is running on localhost
|
|
25
|
-
When I run "flapjack-worker-manager stop"
|
|
26
|
-
Then 0 instances of "flapjack-worker" should be running
|
|
27
|
-
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
Feature: flapjack-worker
|
|
2
|
-
To be alerted to problems
|
|
3
|
-
A user
|
|
4
|
-
Needs checks executed
|
|
5
|
-
On a regular schedule
|
|
6
|
-
And the results of those checks
|
|
7
|
-
Need to be reported
|
|
8
|
-
|
|
9
|
-
Scenario: Start a worker
|
|
10
|
-
Given beanstalkd is running
|
|
11
|
-
When I background run "flapjack-worker"
|
|
12
|
-
Then I should see "flapjack-worker" running
|
|
13
|
-
Then I should see "Waiting for check" in the "flapjack-worker" output
|
|
14
|
-
|
|
15
|
-
Scenario: Start a worker without beanstalk running
|
|
16
|
-
Given beanstalkd is not running
|
|
17
|
-
When I background run "flapjack-worker"
|
|
18
|
-
Then I should see "flapjack-worker" running
|
|
19
|
-
Then I should not see "Shutting down" in the "flapjack-worker" output
|
|
20
|
-
|
|
21
|
-
Scenario: Beanstalk disappears while worker running
|
|
22
|
-
Given beanstalkd is running
|
|
23
|
-
When I background run "flapjack-worker"
|
|
24
|
-
And beanstalkd is killed
|
|
25
|
-
Then I should see "flapjack-worker" running
|
|
26
|
-
Then I should not see "Shutting down" in the "flapjack-worker" output
|
|
27
|
-
Then I should see "went away" in the "flapjack-worker" output
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
Feature: Netsaint -> Flapjack configuration converter
|
|
2
|
-
To assist the migration to Flapjack
|
|
3
|
-
An operator needs to migrate
|
|
4
|
-
A functioning netsaint or nagios configuration
|
|
5
|
-
Into Flapjack's native configuration system
|
|
6
|
-
|
|
7
|
-
@parse
|
|
8
|
-
Scenario: Parse + print netsaint services
|
|
9
|
-
Given NetSaint configuration is at "features/support/data/etc/netsaint"
|
|
10
|
-
When I run "flapjack-netsaint-parser" with the following arguments:
|
|
11
|
-
| argument |
|
|
12
|
-
| print |
|
|
13
|
-
| services |
|
|
14
|
-
| --source=features/support/data/etc/netsaint |
|
|
15
|
-
Then I should see a valid JSON output
|
|
16
|
-
And I should see a list of services
|
|
17
|
-
And I should see the following attributes for every service:
|
|
18
|
-
| attribute |
|
|
19
|
-
| check_command |
|
|
20
|
-
| description |
|
|
21
|
-
|
|
22
|
-
@parse
|
|
23
|
-
Scenario: Parse + print netsaint timeperiods
|
|
24
|
-
Given NetSaint configuration is at "features/support/data/etc/netsaint"
|
|
25
|
-
When I run "flapjack-netsaint-parser" with the following arguments:
|
|
26
|
-
| argument |
|
|
27
|
-
| print |
|
|
28
|
-
| timeperiods |
|
|
29
|
-
| --source=features/support/data/etc/netsaint |
|
|
30
|
-
Then I should see a valid JSON output
|
|
31
|
-
And I should see a list of timeperiods
|
|
32
|
-
And I should see the following attributes for every timeperiod:
|
|
33
|
-
| attribute | nillable? |
|
|
34
|
-
| timeperiod_alias | true |
|
|
35
|
-
|
|
36
|
-
@parse
|
|
37
|
-
Scenario: Parse + print netsaint contacts
|
|
38
|
-
Given NetSaint configuration is at "features/support/data/etc/netsaint"
|
|
39
|
-
When I run "flapjack-netsaint-parser" with the following arguments:
|
|
40
|
-
| argument |
|
|
41
|
-
| print |
|
|
42
|
-
| contacts |
|
|
43
|
-
| --source=features/support/data/etc/netsaint |
|
|
44
|
-
Then I should see a valid JSON output
|
|
45
|
-
And I should see a list of contacts
|
|
46
|
-
And I should see the following attributes for every contact:
|
|
47
|
-
| attribute |
|
|
48
|
-
| contact_alias |
|
|
49
|
-
| email_address |
|
|
50
|
-
| host_notification_period |
|
|
51
|
-
| host_notify_commands |
|
|
52
|
-
| notify_host_down |
|
|
53
|
-
| notify_host_unreachable |
|
|
54
|
-
| notify_service_warning |
|
|
55
|
-
| notify_service_recovery |
|
|
56
|
-
| notify_service_critical |
|
|
57
|
-
| notify_host_recovery |
|
|
58
|
-
| service_notify_commands |
|
|
59
|
-
| svc_notification_period |
|
|
60
|
-
And I should see the following attributes for every contact:
|
|
61
|
-
| attribute | nillable? |
|
|
62
|
-
| pager | true |
|
|
63
|
-
|
|
64
|
-
@parse
|
|
65
|
-
Scenario: Parse + print netsaint contactgroups
|
|
66
|
-
Given NetSaint configuration is at "features/support/data/etc/netsaint"
|
|
67
|
-
When I run "flapjack-netsaint-parser" with the following arguments:
|
|
68
|
-
| argument |
|
|
69
|
-
| print |
|
|
70
|
-
| contactgroups |
|
|
71
|
-
| --source=features/support/data/etc/netsaint |
|
|
72
|
-
Then I should see a valid JSON output
|
|
73
|
-
And I should see a list of contactgroups
|
|
74
|
-
And I should see the following attributes for every contactgroup:
|
|
75
|
-
| attribute |
|
|
76
|
-
| contacts |
|
|
77
|
-
| group_alias |
|
|
78
|
-
|
|
79
|
-
@parse
|
|
80
|
-
Scenario: Parse + print netsaint hosts
|
|
81
|
-
Given NetSaint configuration is at "features/support/data/etc/netsaint"
|
|
82
|
-
When I run "flapjack-netsaint-parser" with the following arguments:
|
|
83
|
-
| argument |
|
|
84
|
-
| print |
|
|
85
|
-
| hosts |
|
|
86
|
-
| --source=features/support/data/etc/netsaint |
|
|
87
|
-
Then I should see a valid JSON output
|
|
88
|
-
And I should see a list of hosts
|
|
89
|
-
And I should see the following attributes for every host:
|
|
90
|
-
| attribute |
|
|
91
|
-
| host_alias |
|
|
92
|
-
| address |
|
|
93
|
-
| parent_hosts |
|
|
94
|
-
| host_check_command |
|
|
95
|
-
| max_attempts |
|
|
96
|
-
| notification_interval |
|
|
97
|
-
| notification_period |
|
|
98
|
-
| notify_recovery |
|
|
99
|
-
| notify_down |
|
|
100
|
-
| notify_unreachable |
|
|
101
|
-
And I should see the following attributes for every host:
|
|
102
|
-
| attribute | nillable? |
|
|
103
|
-
| event_handler | true |
|
|
104
|
-
|
|
105
|
-
@import
|
|
106
|
-
Scenario: Import Netsaint config
|
|
107
|
-
Given NetSaint configuration is at "features/support/data/etc/netsaint"
|
|
108
|
-
And no file exists at "features/support/tmp/dump.json"
|
|
109
|
-
And beanstalkd is running
|
|
110
|
-
And there are no jobs on the "checks" beanstalkd queue
|
|
111
|
-
When I run "flapjack-netsaint-parser" with the following arguments:
|
|
112
|
-
| argument |
|
|
113
|
-
| dump |
|
|
114
|
-
| --source=features/support/data/etc/netsaint |
|
|
115
|
-
| --format=json |
|
|
116
|
-
| --to=features/support/tmp/dump.json |
|
|
117
|
-
Then I should see "features/support/tmp/dump.json" in the output
|
|
118
|
-
Then I should see valid JSON in "features/support/tmp/dump.json"
|
|
119
|
-
Then I should see a valid JSON batch in "features/support/tmp/dump.json"
|
|
120
|
-
When I run "flapjack-populator" with the following arguments:
|
|
121
|
-
| argument |
|
|
122
|
-
| deploy |
|
|
123
|
-
| --from=features/support/tmp/dump.json |
|
|
124
|
-
Then I should see "Deployed batch \d+" in the output
|
|
125
|
-
Then there should be several jobs on the "checks" beanstalkd queue
|
|
126
|
-
|