flapjack 0.9.6 → 1.0.0rc1
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/.gitignore +2 -0
- data/.rspec +6 -0
- data/.travis.yml +20 -16
- data/CHANGELOG.md +11 -25
- data/Dockerfile +8 -0
- data/Gemfile +2 -5
- data/bin/flapjack +24 -213
- data/etc/flapjack_config.yaml.example +6 -30
- data/features/cli.feature +16 -14
- data/features/cli_flapjack-feed-events.feature +12 -13
- data/features/cli_flapjack-nagios-receiver.feature +14 -15
- data/features/cli_flapjack-populator.feature +16 -15
- data/features/cli_flapper.feature +12 -12
- data/features/cli_receive-events.feature +6 -5
- data/features/cli_simulate-failed-check.feature +7 -6
- data/features/steps/cli_steps.rb +2 -2
- data/features/support/env.rb +1 -0
- data/flapjack.gemspec +1 -0
- data/lib/flapjack/cli/flapper.rb +200 -0
- data/lib/flapjack/cli/import.rb +102 -0
- data/lib/flapjack/cli/receiver.rb +656 -0
- data/lib/flapjack/cli/server.rb +256 -0
- data/lib/flapjack/cli/simulate.rb +180 -0
- data/lib/flapjack/configuration.rb +2 -0
- data/lib/flapjack/data/entity_check.rb +5 -22
- data/lib/flapjack/data/event.rb +7 -12
- data/lib/flapjack/gateways/email.rb +4 -1
- data/lib/flapjack/gateways/jabber.rb +12 -36
- data/lib/flapjack/gateways/jsonapi/check_presenter.rb +6 -6
- data/lib/flapjack/gateways/jsonapi/report_methods.rb +5 -3
- data/lib/flapjack/gateways/pagerduty.rb +1 -1
- data/lib/flapjack/gateways/web/public/js/backbone.jsonapi.js +1 -1
- data/lib/flapjack/gateways/web/public/js/modules/contact.js +2 -2
- data/lib/flapjack/gateways/web/public/js/modules/entity.js +2 -2
- data/lib/flapjack/gateways/web/public/js/modules/medium.js +4 -4
- data/lib/flapjack/gateways/web/public/js/self_stats.js +1 -1
- data/lib/flapjack/gateways/web/views/check.html.erb +7 -7
- data/lib/flapjack/gateways/web/views/checks.html.erb +2 -3
- data/lib/flapjack/gateways/web/views/contact.html.erb +4 -4
- data/lib/flapjack/gateways/web/views/contacts.html.erb +2 -2
- data/lib/flapjack/gateways/web/views/edit_contacts.html.erb +1 -1
- data/lib/flapjack/gateways/web/views/entities.html.erb +1 -1
- data/lib/flapjack/gateways/web/views/entity.html.erb +1 -1
- data/lib/flapjack/gateways/web/views/index.html.erb +2 -2
- data/lib/flapjack/gateways/web/views/layout.erb +10 -10
- data/lib/flapjack/gateways/web/views/self_stats.html.erb +1 -1
- data/lib/flapjack/gateways/web.rb +36 -7
- data/lib/flapjack/pikelet.rb +0 -2
- data/lib/flapjack/processor.rb +3 -1
- data/lib/flapjack/redis_pool.rb +2 -6
- data/lib/flapjack/version.rb +1 -1
- data/spec/lib/flapjack/coordinator_spec.rb +3 -3
- data/spec/lib/flapjack/data/entity_check_spec.rb +2 -6
- data/spec/lib/flapjack/data/event_spec.rb +0 -31
- data/spec/lib/flapjack/gateways/email_spec.rb +109 -0
- data/spec/lib/flapjack/gateways/jabber_spec.rb +18 -16
- data/spec/lib/flapjack/gateways/jsonapi/check_presenter_spec.rb +12 -24
- data/spec/lib/flapjack/gateways/pagerduty_spec.rb +1 -1
- data/spec/lib/flapjack/gateways/web/views/check.html.erb_spec.rb +2 -0
- data/spec/lib/flapjack/gateways/web/views/contact.html.erb_spec.rb +2 -0
- data/spec/lib/flapjack/gateways/web/views/index.html.erb_spec.rb +2 -0
- data/spec/lib/flapjack/gateways/web_spec.rb +194 -145
- data/spec/lib/flapjack/redis_pool_spec.rb +0 -1
- data/spec/support/profile_all_formatter.rb +44 -0
- data/spec/support/uncolored_doc_formatter.rb +9 -0
- data/tasks/benchmarks.rake +0 -4
- metadata +28 -38
- data/.ruby-version +0 -1
- data/Gemfile-ruby1.9 +0 -28
- data/Gemfile-ruby1.9.lock +0 -227
- data/bin/flapjack-feed-events +0 -124
- data/bin/flapjack-nagios-receiver +0 -246
- data/bin/flapjack-nsca-receiver +0 -246
- data/bin/flapjack-populator +0 -132
- data/bin/flapper +0 -152
- data/bin/receive-events +0 -179
- data/bin/simulate-failed-check +0 -151
- data/lib/flapjack/data/migration.rb +0 -36
- data/lib/flapjack/gateways/api/contact_methods.rb +0 -369
- data/lib/flapjack/gateways/api/entity_check_presenter.rb +0 -218
- data/lib/flapjack/gateways/api/entity_methods.rb +0 -361
- data/lib/flapjack/gateways/api/entity_presenter.rb +0 -75
- data/lib/flapjack/gateways/api/rack/json_params_parser.rb +0 -26
- data/lib/flapjack/gateways/api.rb +0 -124
- data/spec/lib/flapjack/gateways/api/contact_methods_spec.rb +0 -772
- data/spec/lib/flapjack/gateways/api/entity_check_presenter_spec.rb +0 -211
- data/spec/lib/flapjack/gateways/api/entity_methods_spec.rb +0 -863
- data/spec/lib/flapjack/gateways/api/entity_presenter_spec.rb +0 -108
- data/spec/lib/flapjack/gateways/api_spec.rb +0 -30
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e16bef3e8503fd14954e5bdf4b843e9d92e598a6
|
|
4
|
+
data.tar.gz: b85df2a0ca05163744d236b6c6237c63ad1b2520
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c0daf6b0e65f5810b695de85af843dfab1cafcda10d0e750c5e93adf6f4f0b9bf8506f19341cd0e29c5b06db47382a1016248d1f356fc335f47207187f8da9ce
|
|
7
|
+
data.tar.gz: 71fe02a6300726b86393640e1d919c43537b6f07a90d95e3a22ba366f05836dea16966227d11643530b1acf1e9dc0407464bbd73c23b54689ed70f413734183a
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
|
@@ -2,3 +2,9 @@
|
|
|
2
2
|
--format Fuubar
|
|
3
3
|
--format html
|
|
4
4
|
--out tmp/spec.html
|
|
5
|
+
--require ./spec/support/uncolored_doc_formatter.rb
|
|
6
|
+
--format UncoloredDocFormatter
|
|
7
|
+
--out tmp/spec_doc.txt
|
|
8
|
+
--require ./spec/support/profile_all_formatter.rb
|
|
9
|
+
--format ProfileAllFormatter
|
|
10
|
+
--out tmp/spec_profile.txt
|
data/.travis.yml
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
language: ruby
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
- rvm: '2.0'
|
|
9
|
-
gemfile: Gemfile
|
|
10
|
-
script: "bundle exec rspec spec && bundle exec cucumber features"
|
|
11
|
-
- rvm: '2.1'
|
|
12
|
-
gemfile: Gemfile
|
|
13
|
-
script: "bundle exec rspec spec && bundle exec cucumber features"
|
|
2
|
+
rvm:
|
|
3
|
+
- 1.9.3
|
|
4
|
+
- '2.0'
|
|
5
|
+
- '2.1'
|
|
6
|
+
gemfile:
|
|
7
|
+
- Gemfile
|
|
14
8
|
services:
|
|
15
|
-
|
|
9
|
+
- redis-server
|
|
16
10
|
before_script:
|
|
17
|
-
|
|
11
|
+
- mkdir -p ./log
|
|
18
12
|
before_install:
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
- git submodule update --init --recursive
|
|
14
|
+
- gem install bundler
|
|
15
|
+
script: bundle exec rspec spec && bundle exec cucumber features
|
|
16
|
+
notifications:
|
|
17
|
+
irc: 'irc.freenode.net#flapjack'
|
|
18
|
+
hipchat:
|
|
19
|
+
template:
|
|
20
|
+
- '%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}
|
|
21
|
+
(<a href="%{build_url}">Details</a>/<a href="%{compare_url}">Change view</a>)'
|
|
22
|
+
format: html
|
|
23
|
+
rooms:
|
|
24
|
+
secure: ajMolTKDuprYJ9Fadcjb3evh80MyJSgjW4hl4OWnEHyrjQLnsO0hbAvSrKRFUzorMoi58L8XZXd01gMgRqRxMvwqfoHLv4njw8px4X9+F/hySPZj3aMAFM1HuoTmHqeP+Rl+1Ssg+Kss6N4JkgNS81s+tkRnnoHG1n/EhfH6PkE=
|
data/CHANGELOG.md
CHANGED
|
@@ -1,34 +1,20 @@
|
|
|
1
1
|
## Flapjack Changelog
|
|
2
2
|
|
|
3
|
-
# 0.
|
|
4
|
-
- Feature:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
# 0.9.3 - 2014-07-28
|
|
15
|
-
- Bug: fix outage reports in jsonapi c8e09f7 (@ali-graham)
|
|
16
|
-
- Bug: fix maintenance reports in jsonapi 234ce48 (@ali-graham)
|
|
17
|
-
- Bug: simplify checks reports in jsonapi 3eda22e (@ali-graham)
|
|
18
|
-
|
|
19
|
-
# 0.9.2 - 2014-07-17
|
|
20
|
-
- Feature: Add ability to disable check via JSON API #529 (@ali-graham)
|
|
21
|
-
- Feature: Jabber - Resource in JID should be supported in the config #557 (@jessereynolds)
|
|
22
|
-
- Feature: Jabber - add an 'identifiers' list to the config #558 (@jessereynolds)
|
|
23
|
-
- Feature: Jabber - handle HipChat style status updates as per XEP-0085 #559 (@jessereynolds)
|
|
24
|
-
|
|
25
|
-
# 0.9.1 - 2014-06-27
|
|
3
|
+
# 1.0.0rc1 - 2014-06-25
|
|
4
|
+
- Feature: Allow ncsm to be skipped using a configured whitelist #485 (@StephenWeber)
|
|
5
|
+
- Feature: GLI the CLI (one command to rule them all) #478 (@auxesis, @ali-graham)
|
|
6
|
+
- Feature: Remove the original HTTP API #526 (@ali-graham)
|
|
7
|
+
- Feature: connecting to an password protected redis server is a good idea #533 (@mattdelves)
|
|
8
|
+
- Feature: Add option to pass tags to simulate-failed-check command. #537 (@jwoods)
|
|
9
|
+
- Feature: Dockerfile that runs flapjack #541 (@michaelneale)
|
|
10
|
+
- Feature: allow customistion of email from reply to #543 (@ferrisoxide)
|
|
11
|
+
- Feature: Allow custom Flapjack branding. #544 (@ferrisoxide)
|
|
12
|
+
- Feature: Add base_url functionality to the web gateway. #539 (@pieterlange)
|
|
26
13
|
- Bug: PATCHing blackhole properties for notification rule changes other blackholes - further fixes #504 (@ali-graham)
|
|
27
14
|
- Bug: JSONAPI get all entities/contacts with empty db e3725fc (@ali-graham)
|
|
28
|
-
- Bug: Decommission Check button returning a 404 #538 (@ali-graham)
|
|
29
|
-
- Bug: Weekday number 7 is accepted by the jsonapi but causes Flapjack to crash #549 (@ali-graham)
|
|
30
15
|
|
|
31
16
|
# 0.9.0 - 2014-05-23
|
|
17
|
+
- Feature: create 0.9.x series - the last to contain the original API
|
|
32
18
|
- Chore: split reports data from entities and checks in jsonapi #525 (@ali-graham)
|
|
33
19
|
|
|
34
20
|
# 0.8.12 - 2014-05-21
|
data/Dockerfile
ADDED
data/Gemfile
CHANGED
|
@@ -20,9 +20,6 @@ group :test do
|
|
|
20
20
|
gem 'guard-cucumber'
|
|
21
21
|
gem 'fuubar'
|
|
22
22
|
gem 'simplecov', :require => false
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
gem 'debugger-ruby_core_source', '>= 1.3.4' # required for perftools.rb
|
|
26
|
-
gem 'perftools.rb'
|
|
27
|
-
end
|
|
23
|
+
gem 'debugger-ruby_core_source', '>= 1.3.4' # required for perftools
|
|
24
|
+
gem 'perftools.rb'
|
|
28
25
|
end
|
data/bin/flapjack
CHANGED
|
@@ -1,229 +1,40 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
unless $:.include?(File.dirname(__FILE__) + '/../lib/')
|
|
5
|
-
$: << File.dirname(__FILE__) + '/../lib'
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
require 'dante'
|
|
9
|
-
|
|
10
|
-
module Dante
|
|
11
|
-
class Runner
|
|
12
|
-
|
|
13
|
-
def start
|
|
14
|
-
# skip signal traps
|
|
15
|
-
@startup_command.call(self.options) if @startup_command
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
require 'optparse'
|
|
21
|
-
require 'ostruct'
|
|
22
|
-
|
|
23
|
-
require 'oj'
|
|
24
|
-
Oj.mimic_JSON
|
|
25
|
-
Oj.default_options = { :indent => 0, :mode => :strict }
|
|
26
|
-
require 'active_support/json'
|
|
27
|
-
|
|
28
|
-
require 'flapjack/configuration'
|
|
29
|
-
require 'flapjack/version'
|
|
30
|
-
|
|
31
|
-
options = OpenStruct.new
|
|
32
|
-
options.config = Flapjack::Configuration::DEFAULT_CONFIG_PATH
|
|
33
|
-
options.daemonize = nil
|
|
34
|
-
|
|
35
|
-
@exe = File.basename(__FILE__)
|
|
36
|
-
|
|
37
|
-
optparse = OptionParser.new do |opts|
|
|
38
|
-
opts.banner = "Usage: flapjack COMMAND [OPTIONS]"
|
|
39
|
-
|
|
40
|
-
opts.separator ""
|
|
41
|
-
opts.separator "Commands"
|
|
42
|
-
opts.separator " start #{" " * 25} start flapjack"
|
|
43
|
-
opts.separator " stop #{" " * 26} stop flapjack"
|
|
44
|
-
opts.separator " restart #{" " * 23} (re)start flapjack"
|
|
45
|
-
opts.separator " reload #{" " * 24} reload flapjack configuration"
|
|
46
|
-
opts.separator " status #{" " * 24} see if flapjack is running"
|
|
47
|
-
opts.separator " version #{" " * 23} display flapjack version and exit"
|
|
48
|
-
opts.separator " help #{" " * 26} display this usage info"
|
|
49
|
-
opts.separator ""
|
|
50
|
-
opts.separator "Options"
|
|
51
|
-
|
|
52
|
-
opts.on("-c", "--config [PATH]", String, "PATH to the config file to use") do |c|
|
|
53
|
-
options.config = c
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
opts.on("-n", "--environment [ENV]", String, "Environment to boot") do |e|
|
|
57
|
-
options.environment = e
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
opts.on("-d", "--[no-]daemonize", "Daemonize?") do |d|
|
|
61
|
-
options.daemonize = d
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
opts.on('-r', '--rbtrace', 'Enable rbtrace profiling') do
|
|
65
|
-
require 'rbtrace'
|
|
66
|
-
end
|
|
3
|
+
require 'gli'
|
|
67
4
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
5
|
+
include GLI::App
|
|
6
|
+
subcommand_option_handling :normal
|
|
7
|
+
sort_help :manually
|
|
8
|
+
commands_from 'flapjack/cli'
|
|
71
9
|
|
|
72
|
-
|
|
73
|
-
options.log_path = l
|
|
74
|
-
end
|
|
10
|
+
program_desc 'Flexible monitoring notification routing system'
|
|
75
11
|
|
|
76
|
-
|
|
77
|
-
options.version = v
|
|
78
|
-
end
|
|
12
|
+
version Flapjack::VERSION
|
|
79
13
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
puts optparse
|
|
85
|
-
exit
|
|
86
|
-
elsif options.version
|
|
87
|
-
puts Flapjack::VERSION
|
|
88
|
-
exit
|
|
89
|
-
elsif !["start", "stop", "restart", "reload", "status"].include?(ARGV[0])
|
|
90
|
-
if ARGV.nil? || ARGV.empty?
|
|
91
|
-
puts "No command provided"
|
|
92
|
-
else
|
|
93
|
-
puts "Unknown command provided: '#{ARGV[0]}'"
|
|
94
|
-
end
|
|
95
|
-
puts "\n#{optparse}"
|
|
96
|
-
exit 1
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
FLAPJACK_ENV = options.environment || ENV['FLAPJACK_ENV'] || 'production'
|
|
100
|
-
|
|
101
|
-
config = Flapjack::Configuration.new
|
|
102
|
-
config.load(options.config)
|
|
103
|
-
config_env = config.all
|
|
104
|
-
|
|
105
|
-
if config_env.nil? || config_env.empty?
|
|
106
|
-
puts "No config data for environment '#{FLAPJACK_ENV}' found in '#{options.config}'"
|
|
107
|
-
exit(false)
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
pidfile = options.pidfile.nil? ?
|
|
111
|
-
(config_env['pid_file'] || 'tmp/pids/flapjack.pid') :
|
|
112
|
-
options.pidfile
|
|
14
|
+
desc 'Configuration file to use'
|
|
15
|
+
default_value '/etc/flapjack/flapjack.yaml'
|
|
16
|
+
arg_name '/path/to/flapjack.yaml'
|
|
17
|
+
flag [:c,:config]
|
|
113
18
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
19
|
+
desc 'Environment to boot'
|
|
20
|
+
default_value 'production'
|
|
21
|
+
arg_name '<environment>'
|
|
22
|
+
flag [:n, :env, :environment]
|
|
117
23
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
options.daemonize
|
|
121
|
-
|
|
122
|
-
flapjack_coord = Proc.new {
|
|
123
|
-
require 'flapjack/coordinator'
|
|
124
|
-
coordinator = Flapjack::Coordinator.new(config)
|
|
125
|
-
coordinator.start(:signals => true)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
@runner_opts = { :pid_path => pidfile, :log_path => logfile }
|
|
129
|
-
def get_runner
|
|
130
|
-
Dante::Runner.new(@exe, @runner_opts)
|
|
24
|
+
accept Array do |value|
|
|
25
|
+
value.split(/,/).map(&:strip)
|
|
131
26
|
end
|
|
132
27
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
Process.kill(0, pid)
|
|
137
|
-
return true
|
|
138
|
-
rescue Errno::ESRCH
|
|
139
|
-
return false
|
|
140
|
-
end
|
|
28
|
+
pre do |global,command,options,args|
|
|
29
|
+
FLAPJACK_ENV = ENV["FLAPJACK_ENV"] || global[:environment]
|
|
30
|
+
true
|
|
141
31
|
end
|
|
142
32
|
|
|
143
|
-
|
|
144
|
-
def wait_pid_gone(pid, timeout = 30)
|
|
145
|
-
print "waiting for a max of #{timeout} seconds for process #{pid} to exit" if process_exists(pid)
|
|
146
|
-
started_at = Time.now.to_i
|
|
147
|
-
while process_exists(pid)
|
|
148
|
-
break unless (Time.now.to_i - started_at < timeout)
|
|
149
|
-
print '.'
|
|
150
|
-
sleep 1
|
|
151
|
-
end
|
|
152
|
-
puts ''
|
|
153
|
-
return !process_exists(pid)
|
|
33
|
+
post do |global,command,options,args|
|
|
154
34
|
end
|
|
155
35
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
rescue StandardError
|
|
159
|
-
pid = nil
|
|
36
|
+
on_error do |exception|
|
|
37
|
+
true
|
|
160
38
|
end
|
|
161
39
|
|
|
162
|
-
|
|
163
|
-
when "start"
|
|
164
|
-
runner = get_runner
|
|
165
|
-
if runner.daemon_running?
|
|
166
|
-
puts "Flapjack is already running."
|
|
167
|
-
else
|
|
168
|
-
print "Flapjack starting..."
|
|
169
|
-
print "\n" unless daemonize
|
|
170
|
-
return_value = nil
|
|
171
|
-
runner.execute(:daemonize => daemonize) {
|
|
172
|
-
return_value = flapjack_coord.call
|
|
173
|
-
}
|
|
174
|
-
puts " done."
|
|
175
|
-
exit(return_value) unless return_value.nil?
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
when "stop"
|
|
179
|
-
runner = get_runner
|
|
180
|
-
if runner.daemon_running?
|
|
181
|
-
print "Flapjack stopping..."
|
|
182
|
-
runner.execute(:kill => true)
|
|
183
|
-
puts " done."
|
|
184
|
-
else
|
|
185
|
-
puts "Flapjack is not running."
|
|
186
|
-
end
|
|
187
|
-
exit 1 unless wait_pid_gone(pid)
|
|
188
|
-
|
|
189
|
-
when "restart"
|
|
190
|
-
runner = get_runner
|
|
191
|
-
if runner.daemon_running?
|
|
192
|
-
print "Flapjack stopping..."
|
|
193
|
-
runner.execute(:kill => true)
|
|
194
|
-
puts " done."
|
|
195
|
-
end
|
|
196
|
-
exit 1 unless wait_pid_gone(pid)
|
|
197
|
-
|
|
198
|
-
runner = get_runner
|
|
199
|
-
print "Flapjack starting..."
|
|
200
|
-
runner.execute(:daemonize => daemonize) {
|
|
201
|
-
flapjack_coord.call
|
|
202
|
-
}
|
|
203
|
-
puts " done."
|
|
204
|
-
|
|
205
|
-
when "reload"
|
|
206
|
-
runner = get_runner
|
|
207
|
-
if runner.daemon_running?
|
|
208
|
-
print "Reloading Flapjack configuration..."
|
|
209
|
-
begin
|
|
210
|
-
Process.kill('HUP', pid)
|
|
211
|
-
puts " sent HUP to pid #{pid}."
|
|
212
|
-
rescue => e
|
|
213
|
-
puts " couldn't send HUP to pid '#{pid}'."
|
|
214
|
-
end
|
|
215
|
-
else
|
|
216
|
-
puts "Flapjack is not running daemonized."
|
|
217
|
-
exit 1
|
|
218
|
-
end
|
|
219
|
-
|
|
220
|
-
when "status"
|
|
221
|
-
runner = get_runner
|
|
222
|
-
uptime = (runner.daemon_running?) ? Time.now - File.stat(pidfile).ctime : 0
|
|
223
|
-
if runner.daemon_running?
|
|
224
|
-
puts "Flapjack is running: pid #{pid}, uptime #{uptime}"
|
|
225
|
-
else
|
|
226
|
-
puts "Flapjack is not running"
|
|
227
|
-
exit 3
|
|
228
|
-
end
|
|
229
|
-
end
|
|
40
|
+
exit run(ARGV)
|
|
@@ -18,6 +18,8 @@ production:
|
|
|
18
18
|
archive_events: true
|
|
19
19
|
events_archive_maxage: 10800
|
|
20
20
|
new_check_scheduled_maintenance_duration: 100 years
|
|
21
|
+
new_check_scheduled_maintenance_ignore_tags:
|
|
22
|
+
- bypass_ncsm
|
|
21
23
|
logger:
|
|
22
24
|
level: INFO
|
|
23
25
|
syslog_errors: yes
|
|
@@ -49,7 +51,8 @@ production:
|
|
|
49
51
|
level: INFO
|
|
50
52
|
syslog_errors: yes
|
|
51
53
|
smtp_config:
|
|
52
|
-
#from: "flapjack@noreply.example"
|
|
54
|
+
# from: "Flapjack Example <flapjack@noreply.example>"
|
|
55
|
+
# reply_to: "flapjack@support.example"
|
|
53
56
|
host: 127.0.0.1
|
|
54
57
|
# 1025 is the default port for http://mailcatcher.me
|
|
55
58
|
port: 1025
|
|
@@ -87,8 +90,6 @@ production:
|
|
|
87
90
|
jabberid: "flapjack@jabber.example.com"
|
|
88
91
|
password: "good-password"
|
|
89
92
|
alias: "flapjack"
|
|
90
|
-
identifiers:
|
|
91
|
-
- "@flapjack"
|
|
92
93
|
rooms:
|
|
93
94
|
- "gimp@conference.jabber.example.com"
|
|
94
95
|
- "log@conference.jabber.example.com"
|
|
@@ -114,6 +115,7 @@ production:
|
|
|
114
115
|
timeout: 300
|
|
115
116
|
access_log: "/var/log/flapjack/web_access.log"
|
|
116
117
|
api_url: "http://localhost:3081/"
|
|
118
|
+
#logo_image_path: "/etc/flapjack/web/custom_logo/flapjack-2013-notext-transparent-300-300.png"
|
|
117
119
|
logger:
|
|
118
120
|
level: INFO
|
|
119
121
|
syslog_errors: yes
|
|
@@ -126,14 +128,6 @@ production:
|
|
|
126
128
|
logger:
|
|
127
129
|
level: INFO
|
|
128
130
|
syslog_errors: yes
|
|
129
|
-
api:
|
|
130
|
-
enabled: yes
|
|
131
|
-
port: 3071
|
|
132
|
-
timeout: 300
|
|
133
|
-
access_log: "/var/log/flapjack/api_access.log"
|
|
134
|
-
logger:
|
|
135
|
-
level: INFO
|
|
136
|
-
syslog_errors: yes
|
|
137
131
|
oobetet:
|
|
138
132
|
enabled: no
|
|
139
133
|
server: "jabber.example.com"
|
|
@@ -171,6 +165,7 @@ development:
|
|
|
171
165
|
archive_events: true
|
|
172
166
|
events_archive_maxage: 10800
|
|
173
167
|
new_check_scheduled_maintenance_duration: 100 years
|
|
168
|
+
new_check_scheduled_maintenance_ignore: onetime
|
|
174
169
|
logger:
|
|
175
170
|
level: DEBUG
|
|
176
171
|
syslog_errors: yes
|
|
@@ -261,25 +256,6 @@ development:
|
|
|
261
256
|
port: 4080
|
|
262
257
|
timeout: 300
|
|
263
258
|
access_log: "log/web_access.log"
|
|
264
|
-
api_url: "http://localhost:4082/"
|
|
265
|
-
base_url: "/"
|
|
266
|
-
logger:
|
|
267
|
-
level: INFO
|
|
268
|
-
syslog_errors: yes
|
|
269
|
-
api:
|
|
270
|
-
enabled: yes
|
|
271
|
-
port: 4081
|
|
272
|
-
timeout: 300
|
|
273
|
-
access_log: "log/api_access.log"
|
|
274
|
-
logger:
|
|
275
|
-
level: INFO
|
|
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
259
|
logger:
|
|
284
260
|
level: INFO
|
|
285
261
|
syslog_errors: yes
|
data/features/cli.feature
CHANGED
|
@@ -8,6 +8,8 @@ Feature: command line utility
|
|
|
8
8
|
Given a file named "flapjack_cfg.yaml" with:
|
|
9
9
|
"""
|
|
10
10
|
test:
|
|
11
|
+
pid_file: tmp/cucumber_cli/flapjack_d.pid
|
|
12
|
+
log_file: tmp/cucumber_cli/flapjack_d.log
|
|
11
13
|
redis:
|
|
12
14
|
db: 14
|
|
13
15
|
processor:
|
|
@@ -29,46 +31,46 @@ test:
|
|
|
29
31
|
"""
|
|
30
32
|
|
|
31
33
|
Scenario: Running with --help shows usage information
|
|
32
|
-
When I run `bin/flapjack --help`
|
|
34
|
+
When I run `bundle exec bin/flapjack server --help`
|
|
33
35
|
Then the exit status should be 0
|
|
34
|
-
And the output should contain "
|
|
36
|
+
And the output should contain "Server for running components"
|
|
35
37
|
And the output should contain " reload "
|
|
36
|
-
And the output should contain "-
|
|
38
|
+
And the output should contain "[-d|--daemonize]"
|
|
37
39
|
|
|
38
40
|
Scenario: Getting status when stopped
|
|
39
|
-
When I run `bin/flapjack
|
|
41
|
+
When I run `bundle exec bin/flapjack -n test --config tmp/cucumber_cli/flapjack_cfg_d.yaml server status`
|
|
40
42
|
Then the exit status should not be 0
|
|
41
43
|
And the output should contain "Flapjack is not running"
|
|
42
44
|
|
|
43
45
|
Scenario: Starting flapjack
|
|
44
|
-
When I start flapjack with `flapjack
|
|
46
|
+
When I start flapjack (via bundle exec) with `flapjack -n test --config tmp/cucumber_cli/flapjack_cfg.yaml server start`
|
|
45
47
|
Then flapjack should start within 15 seconds
|
|
46
48
|
|
|
47
49
|
Scenario: Stopping flapjack via SIGINT
|
|
48
|
-
When I start flapjack with `flapjack
|
|
50
|
+
When I start flapjack (via bundle exec) with `flapjack -n test --config tmp/cucumber_cli/flapjack_cfg.yaml server start`
|
|
49
51
|
Then flapjack should start within 15 seconds
|
|
50
52
|
When I send a SIGINT to the flapjack process
|
|
51
53
|
Then flapjack should stop within 15 seconds
|
|
52
54
|
|
|
53
55
|
Scenario: Starting, status and stopping flapjack, daemonized
|
|
54
|
-
When I start flapjack (daemonised) with `flapjack
|
|
56
|
+
When I start flapjack (daemonised) (via bundle exec) with `flapjack -n test --config tmp/cucumber_cli/flapjack_cfg_d.yaml server start -d`
|
|
55
57
|
Then flapjack should start within 15 seconds
|
|
56
|
-
When I run `bin/flapjack
|
|
58
|
+
When I run `bundle exec bin/flapjack -n test --config tmp/cucumber_cli/flapjack_cfg_d.yaml server status`
|
|
57
59
|
Then the exit status should be 0
|
|
58
60
|
And the output should contain "Flapjack is running"
|
|
59
|
-
When I stop flapjack with `flapjack
|
|
61
|
+
When I stop flapjack (via bundle exec) with `flapjack -n test --config tmp/cucumber_cli/flapjack_cfg_d.yaml server stop`
|
|
60
62
|
Then flapjack should stop within 15 seconds
|
|
61
63
|
|
|
62
64
|
Scenario: Starting, restarting and stopping flapjack, daemonized
|
|
63
|
-
When I start flapjack (daemonised) with `flapjack
|
|
65
|
+
When I start flapjack (daemonised) (via bundle exec) with `flapjack -n test --config tmp/cucumber_cli/flapjack_cfg_d.yaml server start -d`
|
|
64
66
|
Then flapjack should start within 15 seconds
|
|
65
|
-
When I restart flapjack with `flapjack
|
|
67
|
+
When I restart flapjack (via bundle exec) with `flapjack -n test --config tmp/cucumber_cli/flapjack_cfg_d.yaml server restart`
|
|
66
68
|
Then flapjack should restart within 15 seconds
|
|
67
|
-
When I stop flapjack with `flapjack
|
|
69
|
+
When I stop flapjack (via bundle exec) with `flapjack -n test --config tmp/cucumber_cli/flapjack_cfg_d.yaml server stop`
|
|
68
70
|
Then flapjack should stop within 15 seconds
|
|
69
71
|
|
|
70
72
|
Scenario: Reloading flapjack configuration
|
|
71
|
-
When I start flapjack with `flapjack
|
|
73
|
+
When I start flapjack (via bundle exec) with `flapjack -n test --config tmp/cucumber_cli/flapjack_cfg.yaml server start`
|
|
72
74
|
Then flapjack should start within 15 seconds
|
|
73
75
|
When I run `mv tmp/cucumber_cli/flapjack_cfg.yaml tmp/cucumber_cli/flapjack_cfg.yaml.bak`
|
|
74
76
|
Given a file named "flapjack_cfg.yaml" with:
|
|
@@ -81,7 +83,7 @@ test:
|
|
|
81
83
|
"""
|
|
82
84
|
When I send a SIGHUP to the flapjack process
|
|
83
85
|
# TODO how to test for config file change?
|
|
84
|
-
When I stop flapjack with `flapjack
|
|
86
|
+
When I stop flapjack (via bundle exec) with `flapjack -n test --config tmp/cucumber_cli/flapjack_cfg_d.yaml server stop`
|
|
85
87
|
Then flapjack should stop within 15 seconds
|
|
86
88
|
|
|
87
89
|
|
|
@@ -10,19 +10,18 @@ Feature: flapjack-feed-events command line
|
|
|
10
10
|
test:
|
|
11
11
|
redis:
|
|
12
12
|
db: 14
|
|
13
|
+
driver: ruby
|
|
13
14
|
"""
|
|
14
15
|
|
|
15
16
|
Scenario: Running with --help shows usage information
|
|
16
|
-
When I run `bin/flapjack-
|
|
17
|
+
When I run `bundle exec bin/flapjack -n test receiver json --help`
|
|
17
18
|
Then the exit status should be 0
|
|
18
|
-
And the output should contain "
|
|
19
|
-
And the output should contain "-
|
|
20
|
-
And the output should contain "-f, --from"
|
|
19
|
+
And the output should contain "JSON receiver"
|
|
20
|
+
And the output should contain "-f, --from=arg"
|
|
21
21
|
|
|
22
22
|
Scenario: Running flapjack-feed-events with no arguments and no STDIN fails with a warning
|
|
23
|
-
When I run `bin/flapjack-
|
|
23
|
+
When I run `bundle exec bin/flapjack -n test -c tmp/cucumber_cli/flapjack-feed-events.yaml receiver json`
|
|
24
24
|
And the output should contain "No file provided, and STDIN is from terminal! Exiting..."
|
|
25
|
-
And the output should contain "Usage: flapjack-feed-events"
|
|
26
25
|
Then the exit status should be 1
|
|
27
26
|
|
|
28
27
|
|
|
@@ -37,14 +36,14 @@ test:
|
|
|
37
36
|
"summary": "testing"
|
|
38
37
|
}
|
|
39
38
|
"""
|
|
40
|
-
When I run `cat tmp/cucumber_cli/single-event.json | bin/flapjack-
|
|
39
|
+
When I run `cat tmp/cucumber_cli/single-event.json | bundle exec bin/flapjack -n test -c tmp/cucumber_cli/flapjack-feed-events.yaml receiver json`
|
|
41
40
|
Then the exit status should be 0
|
|
42
41
|
And the output should not contain "Invalid event data received"
|
|
43
42
|
And the output should contain "Enqueued event data, "
|
|
44
43
|
And the output should contain "client1-localhost-test-1"
|
|
45
44
|
And the output should contain "Done."
|
|
46
45
|
|
|
47
|
-
When I run `bin/flapjack-
|
|
46
|
+
When I run `bundle exec bin/flapjack -n test -c tmp/cucumber_cli/flapjack-feed-events.yaml receiver json -f tmp/cucumber_cli/single-event.json`
|
|
48
47
|
Then the exit status should be 0
|
|
49
48
|
And the output should not contain "Invalid event data received"
|
|
50
49
|
And the output should contain "Enqueued event data, "
|
|
@@ -62,7 +61,7 @@ test:
|
|
|
62
61
|
"testing"
|
|
63
62
|
}
|
|
64
63
|
"""
|
|
65
|
-
When I run `cat tmp/cucumber_cli/multiple-events.json | bin/flapjack-
|
|
64
|
+
When I run `cat tmp/cucumber_cli/multiple-events.json | bundle exec bin/flapjack -n test -c tmp/cucumber_cli/flapjack-feed-events.yaml receiver json`
|
|
66
65
|
Then the exit status should be 0
|
|
67
66
|
And the output should not contain "Invalid event data received"
|
|
68
67
|
And the output should contain "Enqueued event data, "
|
|
@@ -70,7 +69,7 @@ test:
|
|
|
70
69
|
And the output should contain "client1-localhost-test-2"
|
|
71
70
|
And the output should contain "Done."
|
|
72
71
|
|
|
73
|
-
When I run `bin/flapjack-
|
|
72
|
+
When I run `bundle exec bin/flapjack -n test -c tmp/cucumber_cli/flapjack-feed-events.yaml receiver json -f tmp/cucumber_cli/multiple-events.json`
|
|
74
73
|
Then the exit status should be 0
|
|
75
74
|
And the output should not contain "Invalid event data received"
|
|
76
75
|
And the output should contain "Enqueued event data, "
|
|
@@ -84,7 +83,7 @@ test:
|
|
|
84
83
|
{"entity": "client1-localhost-test-1"}
|
|
85
84
|
{"entity": "client1-localhost-test-2", "check": "bar"}
|
|
86
85
|
"""
|
|
87
|
-
When I run `cat tmp/cucumber_cli/invalid-events.json | bin/flapjack-
|
|
86
|
+
When I run `cat tmp/cucumber_cli/invalid-events.json | bundle exec bin/flapjack -n test -c tmp/cucumber_cli/flapjack-feed-events.yaml receiver json`
|
|
88
87
|
Then the exit status should be 0
|
|
89
88
|
And the output should not contain "Enqueued event data, "
|
|
90
89
|
And the output should contain "Invalid event data received"
|
|
@@ -98,7 +97,7 @@ test:
|
|
|
98
97
|
{"entity": "client1-localhost-test-1"
|
|
99
98
|
{"entity": "client1-localhost-test-2", "check": "bar"}
|
|
100
99
|
"""
|
|
101
|
-
When I run `cat tmp/cucumber_cli/invalid-json.json | bin/flapjack-
|
|
100
|
+
When I run `cat tmp/cucumber_cli/invalid-json.json | bundle exec bin/flapjack -n test -c tmp/cucumber_cli/flapjack-feed-events.yaml receiver json`
|
|
102
101
|
Then the exit status should be 1
|
|
103
102
|
And the output should not contain "Enqueued event data, "
|
|
104
|
-
And the output should contain "
|
|
103
|
+
And the output should contain "expected comma at line 2"
|