mcproc 2016.2.20
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 +7 -0
- data/Announce.txt +135 -0
- data/Gemfile +9 -0
- data/History.txt +469 -0
- data/LICENSE +22 -0
- data/README.md +37 -0
- data/Rakefile +185 -0
- data/TODO.md +37 -0
- data/bin/mcproc +134 -0
- data/doc/intro.asciidoc +20 -0
- data/doc/mcproc.asciidoc +1592 -0
- data/ext/god/.gitignore +5 -0
- data/ext/god/extconf.rb +56 -0
- data/ext/god/kqueue_handler.c +133 -0
- data/ext/god/netlink_handler.c +182 -0
- data/lib/god.rb +780 -0
- data/lib/god/behavior.rb +52 -0
- data/lib/god/behaviors/clean_pid_file.rb +21 -0
- data/lib/god/behaviors/clean_unix_socket.rb +21 -0
- data/lib/god/behaviors/notify_when_flapping.rb +51 -0
- data/lib/god/cli/command.rb +268 -0
- data/lib/god/cli/run.rb +170 -0
- data/lib/god/cli/version.rb +23 -0
- data/lib/god/compat19.rb +33 -0
- data/lib/god/condition.rb +96 -0
- data/lib/god/conditions/always.rb +36 -0
- data/lib/god/conditions/complex.rb +86 -0
- data/lib/god/conditions/cpu_usage.rb +80 -0
- data/lib/god/conditions/degrading_lambda.rb +52 -0
- data/lib/god/conditions/disk_usage.rb +32 -0
- data/lib/god/conditions/file_mtime.rb +28 -0
- data/lib/god/conditions/file_touched.rb +44 -0
- data/lib/god/conditions/flapping.rb +128 -0
- data/lib/god/conditions/http_response_code.rb +184 -0
- data/lib/god/conditions/lambda.rb +25 -0
- data/lib/god/conditions/memory_usage.rb +82 -0
- data/lib/god/conditions/process_exits.rb +66 -0
- data/lib/god/conditions/process_running.rb +63 -0
- data/lib/god/conditions/socket_responding.rb +142 -0
- data/lib/god/conditions/tries.rb +44 -0
- data/lib/god/configurable.rb +57 -0
- data/lib/god/contact.rb +114 -0
- data/lib/god/contacts/airbrake.rb +44 -0
- data/lib/god/contacts/campfire.rb +121 -0
- data/lib/god/contacts/email.rb +130 -0
- data/lib/god/contacts/hipchat.rb +117 -0
- data/lib/god/contacts/jabber.rb +75 -0
- data/lib/god/contacts/prowl.rb +57 -0
- data/lib/god/contacts/scout.rb +55 -0
- data/lib/god/contacts/sensu.rb +59 -0
- data/lib/god/contacts/slack.rb +98 -0
- data/lib/god/contacts/statsd.rb +46 -0
- data/lib/god/contacts/twitter.rb +51 -0
- data/lib/god/contacts/webhook.rb +74 -0
- data/lib/god/driver.rb +238 -0
- data/lib/god/errors.rb +24 -0
- data/lib/god/event_handler.rb +112 -0
- data/lib/god/event_handlers/dummy_handler.rb +13 -0
- data/lib/god/event_handlers/kqueue_handler.rb +17 -0
- data/lib/god/event_handlers/netlink_handler.rb +13 -0
- data/lib/god/logger.rb +109 -0
- data/lib/god/metric.rb +87 -0
- data/lib/god/process.rb +381 -0
- data/lib/god/registry.rb +32 -0
- data/lib/god/simple_logger.rb +59 -0
- data/lib/god/socket.rb +113 -0
- data/lib/god/sugar.rb +62 -0
- data/lib/god/sys_logger.rb +45 -0
- data/lib/god/system/portable_poller.rb +42 -0
- data/lib/god/system/process.rb +50 -0
- data/lib/god/system/slash_proc_poller.rb +92 -0
- data/lib/god/task.rb +552 -0
- data/lib/god/timeline.rb +25 -0
- data/lib/god/trigger.rb +43 -0
- data/lib/god/watch.rb +340 -0
- data/mcproc.gemspec +192 -0
- data/test/configs/child_events/child_events.god +44 -0
- data/test/configs/child_events/simple_server.rb +3 -0
- data/test/configs/child_polls/child_polls.god +37 -0
- data/test/configs/child_polls/simple_server.rb +12 -0
- data/test/configs/complex/complex.god +59 -0
- data/test/configs/complex/simple_server.rb +3 -0
- data/test/configs/contact/contact.god +118 -0
- data/test/configs/contact/simple_server.rb +3 -0
- data/test/configs/daemon_events/daemon_events.god +37 -0
- data/test/configs/daemon_events/simple_server.rb +8 -0
- data/test/configs/daemon_events/simple_server_stop.rb +11 -0
- data/test/configs/daemon_polls/daemon_polls.god +17 -0
- data/test/configs/daemon_polls/simple_server.rb +6 -0
- data/test/configs/degrading_lambda/degrading_lambda.god +31 -0
- data/test/configs/degrading_lambda/tcp_server.rb +15 -0
- data/test/configs/keepalive/keepalive.god +9 -0
- data/test/configs/keepalive/keepalive.rb +12 -0
- data/test/configs/lifecycle/lifecycle.god +25 -0
- data/test/configs/matias/matias.god +50 -0
- data/test/configs/real.rb +59 -0
- data/test/configs/running_load/running_load.god +16 -0
- data/test/configs/stop_options/simple_server.rb +12 -0
- data/test/configs/stop_options/stop_options.god +39 -0
- data/test/configs/stress/simple_server.rb +3 -0
- data/test/configs/stress/stress.god +15 -0
- data/test/configs/task/logs/.placeholder +0 -0
- data/test/configs/task/task.god +26 -0
- data/test/configs/test.rb +61 -0
- data/test/configs/usr1_trapper.rb +10 -0
- data/test/helper.rb +172 -0
- data/test/suite.rb +6 -0
- data/test/test_airbrake.rb +14 -0
- data/test/test_behavior.rb +18 -0
- data/test/test_campfire.rb +22 -0
- data/test/test_condition.rb +52 -0
- data/test/test_conditions_disk_usage.rb +50 -0
- data/test/test_conditions_http_response_code.rb +109 -0
- data/test/test_conditions_process_running.rb +40 -0
- data/test/test_conditions_socket_responding.rb +176 -0
- data/test/test_conditions_tries.rb +67 -0
- data/test/test_contact.rb +109 -0
- data/test/test_driver.rb +26 -0
- data/test/test_email.rb +34 -0
- data/test/test_event_handler.rb +82 -0
- data/test/test_god.rb +710 -0
- data/test/test_god_system.rb +201 -0
- data/test/test_handlers_kqueue_handler.rb +16 -0
- data/test/test_hipchat.rb +23 -0
- data/test/test_jabber.rb +29 -0
- data/test/test_logger.rb +55 -0
- data/test/test_metric.rb +74 -0
- data/test/test_process.rb +263 -0
- data/test/test_prowl.rb +15 -0
- data/test/test_registry.rb +15 -0
- data/test/test_sensu.rb +11 -0
- data/test/test_slack.rb +57 -0
- data/test/test_socket.rb +34 -0
- data/test/test_statsd.rb +22 -0
- data/test/test_sugar.rb +42 -0
- data/test/test_system_portable_poller.rb +17 -0
- data/test/test_system_process.rb +30 -0
- data/test/test_task.rb +246 -0
- data/test/test_timeline.rb +37 -0
- data/test/test_trigger.rb +63 -0
- data/test/test_watch.rb +286 -0
- data/test/test_webhook.rb +22 -0
- metadata +475 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
|
+
|
3
|
+
class TestTimeline < Minitest::Test
|
4
|
+
def setup
|
5
|
+
@timeline = Timeline.new(5)
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_new_should_be_empty
|
9
|
+
assert_equal 0, @timeline.size
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_should_not_grow_to_more_than_size
|
13
|
+
(1..10).each do |i|
|
14
|
+
@timeline.push(i)
|
15
|
+
end
|
16
|
+
|
17
|
+
assert_equal [6, 7, 8, 9, 10], @timeline
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_clear_should_clear_array
|
21
|
+
@timeline << 1
|
22
|
+
assert_equal [1], @timeline
|
23
|
+
assert_equal [], @timeline.clear
|
24
|
+
end
|
25
|
+
|
26
|
+
# def test_benchmark
|
27
|
+
# require 'benchmark'
|
28
|
+
#
|
29
|
+
# count = 1_000_000
|
30
|
+
#
|
31
|
+
# t = Timeline.new(10)
|
32
|
+
#
|
33
|
+
# Benchmark.bmbm do |x|
|
34
|
+
# x.report("go") { count.times { t.push(5) } }
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
|
+
|
3
|
+
class TestTrigger < Minitest::Test
|
4
|
+
def setup
|
5
|
+
Trigger.reset
|
6
|
+
end
|
7
|
+
|
8
|
+
def teardown
|
9
|
+
Trigger.reset
|
10
|
+
end
|
11
|
+
|
12
|
+
# base case
|
13
|
+
|
14
|
+
def test_should_have_empty_triggers
|
15
|
+
assert_equal({}, Trigger.triggers)
|
16
|
+
end
|
17
|
+
|
18
|
+
# register
|
19
|
+
|
20
|
+
def test_register_should_add_condition_to_triggers
|
21
|
+
c = Condition.new
|
22
|
+
c.watch = stub(:name => 'foo')
|
23
|
+
Trigger.register(c)
|
24
|
+
|
25
|
+
assert_equal({'foo' => [c]}, Trigger.triggers)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_register_should_add_condition_to_triggers_twice
|
29
|
+
watch = stub(:name => 'foo')
|
30
|
+
c = Condition.new
|
31
|
+
c.watch = watch
|
32
|
+
Trigger.register(c)
|
33
|
+
|
34
|
+
c2 = Condition.new
|
35
|
+
c2.watch = watch
|
36
|
+
Trigger.register(c2)
|
37
|
+
|
38
|
+
assert_equal({'foo' => [c, c2]}, Trigger.triggers)
|
39
|
+
end
|
40
|
+
|
41
|
+
# deregister
|
42
|
+
|
43
|
+
def test_deregister_should_remove_condition_from_triggers
|
44
|
+
c = Condition.new
|
45
|
+
c.watch = stub(:name => 'foo')
|
46
|
+
Trigger.register(c)
|
47
|
+
Trigger.deregister(c)
|
48
|
+
|
49
|
+
assert_equal({}, Trigger.triggers)
|
50
|
+
end
|
51
|
+
|
52
|
+
# broadcast
|
53
|
+
|
54
|
+
def test_broadcast_should_call_process_on_each_condition
|
55
|
+
c = Condition.new
|
56
|
+
c.watch = stub(:name => 'foo')
|
57
|
+
Trigger.register(c)
|
58
|
+
|
59
|
+
c.expects(:process).with(:state_change, [:up, :start])
|
60
|
+
|
61
|
+
Trigger.broadcast(c.watch, :state_change, [:up, :start])
|
62
|
+
end
|
63
|
+
end
|
data/test/test_watch.rb
ADDED
@@ -0,0 +1,286 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
|
+
|
3
|
+
class TestWatch < Minitest::Test
|
4
|
+
def setup
|
5
|
+
God.internal_init
|
6
|
+
@watch = Watch.new
|
7
|
+
@watch.name = 'foo'
|
8
|
+
@watch.start = lambda { }
|
9
|
+
@watch.stop = lambda { }
|
10
|
+
@watch.prepare
|
11
|
+
end
|
12
|
+
|
13
|
+
# new
|
14
|
+
|
15
|
+
def test_new_should_have_no_behaviors
|
16
|
+
assert_equal [], @watch.behaviors
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_new_should_have_no_metrics
|
20
|
+
Watch::VALID_STATES.each do |state|
|
21
|
+
assert_equal [], @watch.metrics[state]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_new_should_have_standard_attributes
|
26
|
+
assert_nothing_raised do
|
27
|
+
@watch.name = 'foo'
|
28
|
+
@watch.start = 'start'
|
29
|
+
@watch.stop = 'stop'
|
30
|
+
@watch.restart = 'restart'
|
31
|
+
@watch.interval = 30
|
32
|
+
@watch.grace = 5
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_new_should_have_unmonitored_state
|
37
|
+
assert_equal :unmonitored, @watch.state
|
38
|
+
end
|
39
|
+
|
40
|
+
# valid?
|
41
|
+
|
42
|
+
def test_valid?
|
43
|
+
God::Process.any_instance.expects(:valid?)
|
44
|
+
@watch.valid?
|
45
|
+
end
|
46
|
+
|
47
|
+
# behavior
|
48
|
+
|
49
|
+
def test_behavior_should_record_behavior
|
50
|
+
beh = nil
|
51
|
+
@watch.behavior(:fake_behavior) { |b| beh = b }
|
52
|
+
assert_equal 1, @watch.behaviors.size
|
53
|
+
assert_equal beh, @watch.behaviors.first
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_invalid_behavior_should_abort
|
57
|
+
assert_abort do
|
58
|
+
@watch.behavior(:invalid)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# transition
|
63
|
+
|
64
|
+
def test_transition_should_abort_on_invalid_start_state
|
65
|
+
assert_abort do
|
66
|
+
@watch.transition(:foo, :bar)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_transition_should_accept_all_valid_start_states
|
71
|
+
assert_nothing_raised do
|
72
|
+
Watch::VALID_STATES.each do |state|
|
73
|
+
@watch.transition(state, :bar) { }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_transition_should_create_and_record_a_metric_for_the_given_start_state
|
79
|
+
@watch.transition(:init, :start) { }
|
80
|
+
assert_equal 1, @watch.metrics[:init].size
|
81
|
+
end
|
82
|
+
|
83
|
+
# lifecycle
|
84
|
+
|
85
|
+
def test_lifecycle_should_create_and_record_a_metric_for_nil_start_state
|
86
|
+
@watch.lifecycle { }
|
87
|
+
assert_equal 1, @watch.metrics[nil].size
|
88
|
+
end
|
89
|
+
|
90
|
+
# keepalive
|
91
|
+
|
92
|
+
def test_keepalive_should_place_metrics_on_up_state
|
93
|
+
@watch.keepalive(:memory_max => 5.megabytes, :cpu_max => 50.percent)
|
94
|
+
assert_equal 2, @watch.metrics[:up].size
|
95
|
+
end
|
96
|
+
|
97
|
+
# start_if
|
98
|
+
|
99
|
+
def test_start_if_should_place_a_metric_on_up_state
|
100
|
+
@watch.start_if { }
|
101
|
+
assert_equal 1, @watch.metrics[:up].size
|
102
|
+
end
|
103
|
+
|
104
|
+
# restart_if
|
105
|
+
|
106
|
+
def test_restart_if_should_place_a_metric_on_up_state
|
107
|
+
@watch.restart_if { }
|
108
|
+
assert_equal 1, @watch.metrics[:up].size
|
109
|
+
end
|
110
|
+
|
111
|
+
# monitor
|
112
|
+
|
113
|
+
def test_monitor_should_move_to_init_if_available
|
114
|
+
@watch.instance_eval do
|
115
|
+
transition(:init, :up) { }
|
116
|
+
end
|
117
|
+
@watch.expects(:move).with(:init)
|
118
|
+
@watch.monitor
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_monitor_should_move_to_up_if_no_init_available
|
122
|
+
@watch.expects(:move).with(:up)
|
123
|
+
@watch.monitor
|
124
|
+
end
|
125
|
+
|
126
|
+
# unmonitor
|
127
|
+
|
128
|
+
def test_unmonitor_should_move_to_nil
|
129
|
+
@watch.expects(:move).with(:unmonitored)
|
130
|
+
@watch.unmonitor
|
131
|
+
end
|
132
|
+
|
133
|
+
# move
|
134
|
+
|
135
|
+
def test_move_should_not_clean_up_if_from_state_is_nil
|
136
|
+
@watch.driver.stubs(:in_driver_context?).returns(true)
|
137
|
+
@watch.driver.expects(:message).never
|
138
|
+
|
139
|
+
metric = nil
|
140
|
+
|
141
|
+
@watch.instance_eval do
|
142
|
+
transition(:init, :up) do |on|
|
143
|
+
metric = on
|
144
|
+
on.condition(:process_running) do |c|
|
145
|
+
c.running = true
|
146
|
+
c.interval = 10
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
metric.expects(:disable).never
|
152
|
+
|
153
|
+
@watch.move(:init)
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_move_should_clean_up_from_state_if_not_nil
|
157
|
+
@watch.driver.stubs(:in_driver_context?).returns(true)
|
158
|
+
@watch.driver.expects(:message).never
|
159
|
+
|
160
|
+
metric = nil
|
161
|
+
|
162
|
+
@watch.instance_eval do
|
163
|
+
transition(:init, :up) do |on|
|
164
|
+
metric = on
|
165
|
+
on.condition(:process_running) do |c|
|
166
|
+
c.running = true
|
167
|
+
c.interval = 10
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
@watch.move(:init)
|
173
|
+
|
174
|
+
metric.expects(:disable)
|
175
|
+
|
176
|
+
@watch.move(:up)
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_move_should_call_action
|
180
|
+
@watch.driver.stubs(:in_driver_context?).returns(true)
|
181
|
+
@watch.driver.expects(:message).never
|
182
|
+
|
183
|
+
@watch.expects(:action).with(:start)
|
184
|
+
|
185
|
+
@watch.move(:start)
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_move_should_move_to_up_state_if_no_start_or_restart_metric
|
189
|
+
@watch.driver.stubs(:in_driver_context?).returns(true)
|
190
|
+
@watch.driver.expects(:message).never
|
191
|
+
|
192
|
+
[:start, :restart].each do |state|
|
193
|
+
@watch.expects(:action)
|
194
|
+
@watch.move(state)
|
195
|
+
assert_equal :up, @watch.state
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_move_should_enable_destination_metric
|
200
|
+
@watch.driver.stubs(:in_driver_context?).returns(true)
|
201
|
+
@watch.driver.expects(:message).never
|
202
|
+
|
203
|
+
metric = nil
|
204
|
+
|
205
|
+
@watch.instance_eval do
|
206
|
+
transition(:init, :up) do |on|
|
207
|
+
metric = on
|
208
|
+
on.condition(:process_running) do |c|
|
209
|
+
c.running = true
|
210
|
+
c.interval = 10
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
metric.expects(:enable)
|
216
|
+
|
217
|
+
@watch.move(:init)
|
218
|
+
end
|
219
|
+
|
220
|
+
# action
|
221
|
+
|
222
|
+
def test_action_should_pass_start_and_stop_actions_to_call_action
|
223
|
+
@watch.driver.stubs(:in_driver_context?).returns(true)
|
224
|
+
@watch.driver.expects(:message).never
|
225
|
+
|
226
|
+
c = Conditions::FakePollCondition.new
|
227
|
+
[:start, :stop].each do |cmd|
|
228
|
+
@watch.expects(:call_action).with(c, cmd)
|
229
|
+
@watch.action(cmd, c)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
def test_action_should_do_stop_then_start_if_no_restart_command
|
234
|
+
@watch.driver.stubs(:in_driver_context?).returns(true)
|
235
|
+
@watch.driver.expects(:message).never
|
236
|
+
|
237
|
+
c = Conditions::FakePollCondition.new
|
238
|
+
@watch.expects(:call_action).with(c, :stop)
|
239
|
+
@watch.expects(:call_action).with(c, :start)
|
240
|
+
@watch.action(:restart, c)
|
241
|
+
end
|
242
|
+
|
243
|
+
def test_action_should_restart_to_call_action_if_present
|
244
|
+
@watch.driver.stubs(:in_driver_context?).returns(true)
|
245
|
+
@watch.driver.expects(:message).never
|
246
|
+
|
247
|
+
@watch.restart = lambda { }
|
248
|
+
c = Conditions::FakePollCondition.new
|
249
|
+
@watch.expects(:call_action).with(c, :restart)
|
250
|
+
@watch.action(:restart, c)
|
251
|
+
end
|
252
|
+
|
253
|
+
# call_action
|
254
|
+
|
255
|
+
def test_call_action
|
256
|
+
c = Conditions::FakePollCondition.new
|
257
|
+
God::Process.any_instance.expects(:call_action).with(:start)
|
258
|
+
@watch.call_action(c, :start)
|
259
|
+
end
|
260
|
+
|
261
|
+
def test_call_action_should_call_before_start_when_behavior_has_that
|
262
|
+
@watch.behavior(:fake_behavior)
|
263
|
+
c = Conditions::FakePollCondition.new
|
264
|
+
God::Process.any_instance.expects(:call_action).with(:start)
|
265
|
+
Behaviors::FakeBehavior.any_instance.expects(:before_start)
|
266
|
+
@watch.call_action(c, :start)
|
267
|
+
end
|
268
|
+
|
269
|
+
def test_call_action_should_call_after_start_when_behavior_has_that
|
270
|
+
@watch.behavior(:fake_behavior)
|
271
|
+
c = Conditions::FakePollCondition.new
|
272
|
+
God::Process.any_instance.expects(:call_action).with(:start)
|
273
|
+
Behaviors::FakeBehavior.any_instance.expects(:after_start)
|
274
|
+
@watch.call_action(c, :start)
|
275
|
+
end
|
276
|
+
|
277
|
+
# canonical_hash_form
|
278
|
+
|
279
|
+
def test_canonical_hash_form_should_convert_symbol_to_hash
|
280
|
+
assert_equal({true => :foo}, @watch.canonical_hash_form(:foo))
|
281
|
+
end
|
282
|
+
|
283
|
+
def test_canonical_hash_form_should_convert_hash_to_hash
|
284
|
+
assert_equal({true => :foo}, @watch.canonical_hash_form(true => :foo))
|
285
|
+
end
|
286
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
|
+
|
3
|
+
class TestWebhook < Minitest::Test
|
4
|
+
def setup
|
5
|
+
@webhook = God::Contacts::Webhook.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_notify
|
9
|
+
@webhook.url = 'http://example.com/switch'
|
10
|
+
Net::HTTP.any_instance.expects(:request).returns(Net::HTTPSuccess.new('a', 'b', 'c'))
|
11
|
+
|
12
|
+
@webhook.notify('msg', Time.now, 'prio', 'cat', 'host')
|
13
|
+
assert_equal "sent webhook to http://example.com/switch", @webhook.info
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_notify_with_url_containing_query_parameters
|
17
|
+
@webhook.url = 'http://example.com/switch?api_key=123'
|
18
|
+
Net::HTTP::Post.expects(:new).with('/switch?api_key=123')
|
19
|
+
|
20
|
+
@webhook.notify('msg', Time.now, 'prio', 'cat', 'host')
|
21
|
+
end
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,475 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mcproc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2016.2.20
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mario Scondo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rdoc
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.10'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: twitter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: prowly
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: xmpp4r
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.5'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.5'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: dike
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.0.3
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.0.3
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: daemons
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.1'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.1'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: mocha
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.10'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.10'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: gollum
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 1.3.1
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 1.3.1
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: mustache
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.99.0
|
174
|
+
- - "<"
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: 0.99.7
|
177
|
+
type: :development
|
178
|
+
prerelease: false
|
179
|
+
version_requirements: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - "~>"
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: 0.99.0
|
184
|
+
- - "<"
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: 0.99.7
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: airbrake
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - "~>"
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: 3.1.7
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - "~>"
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: 3.1.7
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: nokogiri
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - "~>"
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: 1.5.0
|
208
|
+
type: :development
|
209
|
+
prerelease: false
|
210
|
+
version_requirements: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - "~>"
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: 1.5.0
|
215
|
+
- !ruby/object:Gem::Dependency
|
216
|
+
name: activesupport
|
217
|
+
requirement: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - ">="
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: 2.3.10
|
222
|
+
- - "<"
|
223
|
+
- !ruby/object:Gem::Version
|
224
|
+
version: 4.0.0
|
225
|
+
type: :development
|
226
|
+
prerelease: false
|
227
|
+
version_requirements: !ruby/object:Gem::Requirement
|
228
|
+
requirements:
|
229
|
+
- - ">="
|
230
|
+
- !ruby/object:Gem::Version
|
231
|
+
version: 2.3.10
|
232
|
+
- - "<"
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: 4.0.0
|
235
|
+
- !ruby/object:Gem::Dependency
|
236
|
+
name: statsd-ruby
|
237
|
+
requirement: !ruby/object:Gem::Requirement
|
238
|
+
requirements:
|
239
|
+
- - ">="
|
240
|
+
- !ruby/object:Gem::Version
|
241
|
+
version: '0'
|
242
|
+
type: :development
|
243
|
+
prerelease: false
|
244
|
+
version_requirements: !ruby/object:Gem::Requirement
|
245
|
+
requirements:
|
246
|
+
- - ">="
|
247
|
+
- !ruby/object:Gem::Version
|
248
|
+
version: '0'
|
249
|
+
- !ruby/object:Gem::Dependency
|
250
|
+
name: i18n
|
251
|
+
requirement: !ruby/object:Gem::Requirement
|
252
|
+
requirements:
|
253
|
+
- - "<"
|
254
|
+
- !ruby/object:Gem::Version
|
255
|
+
version: 0.7.0
|
256
|
+
type: :development
|
257
|
+
prerelease: false
|
258
|
+
version_requirements: !ruby/object:Gem::Requirement
|
259
|
+
requirements:
|
260
|
+
- - "<"
|
261
|
+
- !ruby/object:Gem::Version
|
262
|
+
version: 0.7.0
|
263
|
+
description: An easy to configure, easy to extend monitoring framework written in
|
264
|
+
Ruby.
|
265
|
+
email: mcproc@googlegroups.com
|
266
|
+
executables:
|
267
|
+
- mcproc
|
268
|
+
extensions:
|
269
|
+
- ext/god/extconf.rb
|
270
|
+
extra_rdoc_files:
|
271
|
+
- README.md
|
272
|
+
files:
|
273
|
+
- Announce.txt
|
274
|
+
- Gemfile
|
275
|
+
- History.txt
|
276
|
+
- LICENSE
|
277
|
+
- README.md
|
278
|
+
- Rakefile
|
279
|
+
- TODO.md
|
280
|
+
- bin/mcproc
|
281
|
+
- doc/intro.asciidoc
|
282
|
+
- doc/mcproc.asciidoc
|
283
|
+
- ext/god/.gitignore
|
284
|
+
- ext/god/extconf.rb
|
285
|
+
- ext/god/kqueue_handler.c
|
286
|
+
- ext/god/netlink_handler.c
|
287
|
+
- lib/god.rb
|
288
|
+
- lib/god/behavior.rb
|
289
|
+
- lib/god/behaviors/clean_pid_file.rb
|
290
|
+
- lib/god/behaviors/clean_unix_socket.rb
|
291
|
+
- lib/god/behaviors/notify_when_flapping.rb
|
292
|
+
- lib/god/cli/command.rb
|
293
|
+
- lib/god/cli/run.rb
|
294
|
+
- lib/god/cli/version.rb
|
295
|
+
- lib/god/compat19.rb
|
296
|
+
- lib/god/condition.rb
|
297
|
+
- lib/god/conditions/always.rb
|
298
|
+
- lib/god/conditions/complex.rb
|
299
|
+
- lib/god/conditions/cpu_usage.rb
|
300
|
+
- lib/god/conditions/degrading_lambda.rb
|
301
|
+
- lib/god/conditions/disk_usage.rb
|
302
|
+
- lib/god/conditions/file_mtime.rb
|
303
|
+
- lib/god/conditions/file_touched.rb
|
304
|
+
- lib/god/conditions/flapping.rb
|
305
|
+
- lib/god/conditions/http_response_code.rb
|
306
|
+
- lib/god/conditions/lambda.rb
|
307
|
+
- lib/god/conditions/memory_usage.rb
|
308
|
+
- lib/god/conditions/process_exits.rb
|
309
|
+
- lib/god/conditions/process_running.rb
|
310
|
+
- lib/god/conditions/socket_responding.rb
|
311
|
+
- lib/god/conditions/tries.rb
|
312
|
+
- lib/god/configurable.rb
|
313
|
+
- lib/god/contact.rb
|
314
|
+
- lib/god/contacts/airbrake.rb
|
315
|
+
- lib/god/contacts/campfire.rb
|
316
|
+
- lib/god/contacts/email.rb
|
317
|
+
- lib/god/contacts/hipchat.rb
|
318
|
+
- lib/god/contacts/jabber.rb
|
319
|
+
- lib/god/contacts/prowl.rb
|
320
|
+
- lib/god/contacts/scout.rb
|
321
|
+
- lib/god/contacts/sensu.rb
|
322
|
+
- lib/god/contacts/slack.rb
|
323
|
+
- lib/god/contacts/statsd.rb
|
324
|
+
- lib/god/contacts/twitter.rb
|
325
|
+
- lib/god/contacts/webhook.rb
|
326
|
+
- lib/god/driver.rb
|
327
|
+
- lib/god/errors.rb
|
328
|
+
- lib/god/event_handler.rb
|
329
|
+
- lib/god/event_handlers/dummy_handler.rb
|
330
|
+
- lib/god/event_handlers/kqueue_handler.rb
|
331
|
+
- lib/god/event_handlers/netlink_handler.rb
|
332
|
+
- lib/god/logger.rb
|
333
|
+
- lib/god/metric.rb
|
334
|
+
- lib/god/process.rb
|
335
|
+
- lib/god/registry.rb
|
336
|
+
- lib/god/simple_logger.rb
|
337
|
+
- lib/god/socket.rb
|
338
|
+
- lib/god/sugar.rb
|
339
|
+
- lib/god/sys_logger.rb
|
340
|
+
- lib/god/system/portable_poller.rb
|
341
|
+
- lib/god/system/process.rb
|
342
|
+
- lib/god/system/slash_proc_poller.rb
|
343
|
+
- lib/god/task.rb
|
344
|
+
- lib/god/timeline.rb
|
345
|
+
- lib/god/trigger.rb
|
346
|
+
- lib/god/watch.rb
|
347
|
+
- mcproc.gemspec
|
348
|
+
- test/configs/child_events/child_events.god
|
349
|
+
- test/configs/child_events/simple_server.rb
|
350
|
+
- test/configs/child_polls/child_polls.god
|
351
|
+
- test/configs/child_polls/simple_server.rb
|
352
|
+
- test/configs/complex/complex.god
|
353
|
+
- test/configs/complex/simple_server.rb
|
354
|
+
- test/configs/contact/contact.god
|
355
|
+
- test/configs/contact/simple_server.rb
|
356
|
+
- test/configs/daemon_events/daemon_events.god
|
357
|
+
- test/configs/daemon_events/simple_server.rb
|
358
|
+
- test/configs/daemon_events/simple_server_stop.rb
|
359
|
+
- test/configs/daemon_polls/daemon_polls.god
|
360
|
+
- test/configs/daemon_polls/simple_server.rb
|
361
|
+
- test/configs/degrading_lambda/degrading_lambda.god
|
362
|
+
- test/configs/degrading_lambda/tcp_server.rb
|
363
|
+
- test/configs/keepalive/keepalive.god
|
364
|
+
- test/configs/keepalive/keepalive.rb
|
365
|
+
- test/configs/lifecycle/lifecycle.god
|
366
|
+
- test/configs/matias/matias.god
|
367
|
+
- test/configs/real.rb
|
368
|
+
- test/configs/running_load/running_load.god
|
369
|
+
- test/configs/stop_options/simple_server.rb
|
370
|
+
- test/configs/stop_options/stop_options.god
|
371
|
+
- test/configs/stress/simple_server.rb
|
372
|
+
- test/configs/stress/stress.god
|
373
|
+
- test/configs/task/logs/.placeholder
|
374
|
+
- test/configs/task/task.god
|
375
|
+
- test/configs/test.rb
|
376
|
+
- test/configs/usr1_trapper.rb
|
377
|
+
- test/helper.rb
|
378
|
+
- test/suite.rb
|
379
|
+
- test/test_airbrake.rb
|
380
|
+
- test/test_behavior.rb
|
381
|
+
- test/test_campfire.rb
|
382
|
+
- test/test_condition.rb
|
383
|
+
- test/test_conditions_disk_usage.rb
|
384
|
+
- test/test_conditions_http_response_code.rb
|
385
|
+
- test/test_conditions_process_running.rb
|
386
|
+
- test/test_conditions_socket_responding.rb
|
387
|
+
- test/test_conditions_tries.rb
|
388
|
+
- test/test_contact.rb
|
389
|
+
- test/test_driver.rb
|
390
|
+
- test/test_email.rb
|
391
|
+
- test/test_event_handler.rb
|
392
|
+
- test/test_god.rb
|
393
|
+
- test/test_god_system.rb
|
394
|
+
- test/test_handlers_kqueue_handler.rb
|
395
|
+
- test/test_hipchat.rb
|
396
|
+
- test/test_jabber.rb
|
397
|
+
- test/test_logger.rb
|
398
|
+
- test/test_metric.rb
|
399
|
+
- test/test_process.rb
|
400
|
+
- test/test_prowl.rb
|
401
|
+
- test/test_registry.rb
|
402
|
+
- test/test_sensu.rb
|
403
|
+
- test/test_slack.rb
|
404
|
+
- test/test_socket.rb
|
405
|
+
- test/test_statsd.rb
|
406
|
+
- test/test_sugar.rb
|
407
|
+
- test/test_system_portable_poller.rb
|
408
|
+
- test/test_system_process.rb
|
409
|
+
- test/test_task.rb
|
410
|
+
- test/test_timeline.rb
|
411
|
+
- test/test_trigger.rb
|
412
|
+
- test/test_watch.rb
|
413
|
+
- test/test_webhook.rb
|
414
|
+
homepage: http://www.linux-support.com/mcproc/
|
415
|
+
licenses: []
|
416
|
+
metadata: {}
|
417
|
+
post_install_message:
|
418
|
+
rdoc_options:
|
419
|
+
- "--charset=UTF-8"
|
420
|
+
require_paths:
|
421
|
+
- lib
|
422
|
+
- ext
|
423
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
424
|
+
requirements:
|
425
|
+
- - ">="
|
426
|
+
- !ruby/object:Gem::Version
|
427
|
+
version: '0'
|
428
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
429
|
+
requirements:
|
430
|
+
- - ">="
|
431
|
+
- !ruby/object:Gem::Version
|
432
|
+
version: '0'
|
433
|
+
requirements: []
|
434
|
+
rubyforge_project: mcproc
|
435
|
+
rubygems_version: 2.4.8
|
436
|
+
signing_key:
|
437
|
+
specification_version: 2
|
438
|
+
summary: Process monitoring framework.
|
439
|
+
test_files:
|
440
|
+
- test/test_airbrake.rb
|
441
|
+
- test/test_behavior.rb
|
442
|
+
- test/test_campfire.rb
|
443
|
+
- test/test_condition.rb
|
444
|
+
- test/test_conditions_disk_usage.rb
|
445
|
+
- test/test_conditions_http_response_code.rb
|
446
|
+
- test/test_conditions_process_running.rb
|
447
|
+
- test/test_conditions_socket_responding.rb
|
448
|
+
- test/test_conditions_tries.rb
|
449
|
+
- test/test_contact.rb
|
450
|
+
- test/test_driver.rb
|
451
|
+
- test/test_email.rb
|
452
|
+
- test/test_event_handler.rb
|
453
|
+
- test/test_god.rb
|
454
|
+
- test/test_god_system.rb
|
455
|
+
- test/test_handlers_kqueue_handler.rb
|
456
|
+
- test/test_hipchat.rb
|
457
|
+
- test/test_jabber.rb
|
458
|
+
- test/test_logger.rb
|
459
|
+
- test/test_metric.rb
|
460
|
+
- test/test_process.rb
|
461
|
+
- test/test_prowl.rb
|
462
|
+
- test/test_registry.rb
|
463
|
+
- test/test_sensu.rb
|
464
|
+
- test/test_slack.rb
|
465
|
+
- test/test_socket.rb
|
466
|
+
- test/test_statsd.rb
|
467
|
+
- test/test_sugar.rb
|
468
|
+
- test/test_system_portable_poller.rb
|
469
|
+
- test/test_system_process.rb
|
470
|
+
- test/test_task.rb
|
471
|
+
- test/test_timeline.rb
|
472
|
+
- test/test_trigger.rb
|
473
|
+
- test/test_watch.rb
|
474
|
+
- test/test_webhook.rb
|
475
|
+
has_rdoc:
|