dguettler-god 0.7.13.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/History.txt +293 -0
  2. data/Manifest.txt +102 -0
  3. data/README.txt +59 -0
  4. data/Rakefile +67 -0
  5. data/bin/god +128 -0
  6. data/examples/events.god +84 -0
  7. data/examples/gravatar.god +54 -0
  8. data/examples/single.god +66 -0
  9. data/ext/god/extconf.rb +55 -0
  10. data/ext/god/kqueue_handler.c +123 -0
  11. data/ext/god/netlink_handler.c +168 -0
  12. data/init/god +42 -0
  13. data/lib/god/behavior.rb +52 -0
  14. data/lib/god/behaviors/clean_pid_file.rb +21 -0
  15. data/lib/god/behaviors/clean_unix_socket.rb +21 -0
  16. data/lib/god/behaviors/notify_when_flapping.rb +51 -0
  17. data/lib/god/cli/command.rb +230 -0
  18. data/lib/god/cli/run.rb +176 -0
  19. data/lib/god/cli/version.rb +23 -0
  20. data/lib/god/condition.rb +96 -0
  21. data/lib/god/conditions/always.rb +23 -0
  22. data/lib/god/conditions/complex.rb +86 -0
  23. data/lib/god/conditions/cpu_usage.rb +80 -0
  24. data/lib/god/conditions/degrading_lambda.rb +52 -0
  25. data/lib/god/conditions/disk_usage.rb +27 -0
  26. data/lib/god/conditions/file_mtime.rb +28 -0
  27. data/lib/god/conditions/flapping.rb +128 -0
  28. data/lib/god/conditions/http_response_code.rb +168 -0
  29. data/lib/god/conditions/lambda.rb +25 -0
  30. data/lib/god/conditions/memory_usage.rb +82 -0
  31. data/lib/god/conditions/process_exits.rb +72 -0
  32. data/lib/god/conditions/process_running.rb +74 -0
  33. data/lib/god/conditions/tries.rb +44 -0
  34. data/lib/god/configurable.rb +57 -0
  35. data/lib/god/contact.rb +106 -0
  36. data/lib/god/contacts/campfire.rb +82 -0
  37. data/lib/god/contacts/email.rb +95 -0
  38. data/lib/god/contacts/jabber.rb +65 -0
  39. data/lib/god/contacts/twitter.rb +39 -0
  40. data/lib/god/contacts/webhook.rb +47 -0
  41. data/lib/god/dependency_graph.rb +41 -0
  42. data/lib/god/diagnostics.rb +37 -0
  43. data/lib/god/driver.rb +207 -0
  44. data/lib/god/errors.rb +24 -0
  45. data/lib/god/event_handler.rb +111 -0
  46. data/lib/god/event_handlers/dummy_handler.rb +13 -0
  47. data/lib/god/event_handlers/kqueue_handler.rb +17 -0
  48. data/lib/god/event_handlers/netlink_handler.rb +13 -0
  49. data/lib/god/logger.rb +124 -0
  50. data/lib/god/metric.rb +59 -0
  51. data/lib/god/process.rb +341 -0
  52. data/lib/god/registry.rb +32 -0
  53. data/lib/god/simple_logger.rb +53 -0
  54. data/lib/god/socket.rb +96 -0
  55. data/lib/god/sugar.rb +47 -0
  56. data/lib/god/system/portable_poller.rb +42 -0
  57. data/lib/god/system/process.rb +42 -0
  58. data/lib/god/system/slash_proc_poller.rb +92 -0
  59. data/lib/god/task.rb +491 -0
  60. data/lib/god/timeline.rb +25 -0
  61. data/lib/god/trigger.rb +43 -0
  62. data/lib/god/watch.rb +183 -0
  63. data/lib/god.rb +670 -0
  64. data/test/configs/child_events/child_events.god +44 -0
  65. data/test/configs/child_events/simple_server.rb +3 -0
  66. data/test/configs/child_polls/child_polls.god +37 -0
  67. data/test/configs/child_polls/simple_server.rb +12 -0
  68. data/test/configs/complex/complex.god +59 -0
  69. data/test/configs/complex/simple_server.rb +3 -0
  70. data/test/configs/contact/contact.god +84 -0
  71. data/test/configs/contact/simple_server.rb +3 -0
  72. data/test/configs/daemon_events/daemon_events.god +37 -0
  73. data/test/configs/daemon_events/simple_server.rb +8 -0
  74. data/test/configs/daemon_events/simple_server_stop.rb +11 -0
  75. data/test/configs/daemon_polls/daemon_polls.god +17 -0
  76. data/test/configs/daemon_polls/simple_server.rb +6 -0
  77. data/test/configs/degrading_lambda/degrading_lambda.god +31 -0
  78. data/test/configs/degrading_lambda/tcp_server.rb +15 -0
  79. data/test/configs/matias/matias.god +50 -0
  80. data/test/configs/real.rb +59 -0
  81. data/test/configs/running_load/running_load.god +16 -0
  82. data/test/configs/stress/simple_server.rb +3 -0
  83. data/test/configs/stress/stress.god +15 -0
  84. data/test/configs/task/logs/.placeholder +0 -0
  85. data/test/configs/task/task.god +26 -0
  86. data/test/configs/test.rb +61 -0
  87. data/test/helper.rb +151 -0
  88. data/test/suite.rb +6 -0
  89. data/test/test_behavior.rb +21 -0
  90. data/test/test_campfire.rb +41 -0
  91. data/test/test_condition.rb +50 -0
  92. data/test/test_conditions_disk_usage.rb +56 -0
  93. data/test/test_conditions_http_response_code.rb +109 -0
  94. data/test/test_conditions_process_running.rb +44 -0
  95. data/test/test_conditions_tries.rb +67 -0
  96. data/test/test_contact.rb +109 -0
  97. data/test/test_dependency_graph.rb +62 -0
  98. data/test/test_driver.rb +11 -0
  99. data/test/test_email.rb +45 -0
  100. data/test/test_event_handler.rb +80 -0
  101. data/test/test_god.rb +598 -0
  102. data/test/test_handlers_kqueue_handler.rb +16 -0
  103. data/test/test_logger.rb +66 -0
  104. data/test/test_metric.rb +72 -0
  105. data/test/test_process.rb +246 -0
  106. data/test/test_registry.rb +15 -0
  107. data/test/test_socket.rb +42 -0
  108. data/test/test_sugar.rb +42 -0
  109. data/test/test_system_portable_poller.rb +17 -0
  110. data/test/test_system_process.rb +30 -0
  111. data/test/test_task.rb +262 -0
  112. data/test/test_timeline.rb +37 -0
  113. data/test/test_trigger.rb +59 -0
  114. data/test/test_watch.rb +279 -0
  115. data/test/test_webhook.rb +17 -0
  116. metadata +206 -0
data/History.txt ADDED
@@ -0,0 +1,293 @@
1
+ ==
2
+ * Bug Fixes
3
+ * Fix redefinition error for time.h and allow it to compile on Ubuntu Edgy [github.com/tbuser]
4
+
5
+ == 0.7.13 / 2009-05-04
6
+ * Bug Fixes
7
+ * Auto daemonized processes are now stopped/unmonitored correctly [github.com/jcapote]
8
+
9
+ == 0.7.12 / 2008-12-10
10
+ * Bug Fixes
11
+ * Fix capistrano deployability [github.com/eric]
12
+ * Fix event handling [brianw]
13
+
14
+ == 0.7.11 / 2008-11-14
15
+ * Bug Fixes
16
+ * Make notifications work inside lifecycle blocks
17
+
18
+ == 0.7.10 / 2008-11-13
19
+ * Major Enhancements
20
+ * Enable sending of arbitrary signals to a task or group via `god signal`
21
+ * Bug Fixes
22
+ * setup logging *after* loading a given config file when daemonized.
23
+ enables logging to the 'God.log_file' specified in a config file. [github.com/jnewland]
24
+ * New Conditions
25
+ * FileMtime < PollCondition - trigger on file mtime durations [github.com/jwilkins]
26
+ * New Contacts
27
+ * Twitter - allow messages to twitter [github.com/jwilkins]
28
+ * Campfire - send messages to 37signals' Campfire [github.com/hellvinz]
29
+ * Minor Enhancements
30
+ * Add watch log_cmd that can be reopened with STDOUT instead of a log file [github.com/jberkel]
31
+ * Added webhook output support [Martyn Loughran]
32
+
33
+ == 0.7.9 / 2008-08-06
34
+ * Major Enhancements
35
+ * Use a psuedo-priority queue for more efficient driver loop [Darrell Kresge]
36
+ * Bug Fixes
37
+ * Fix file_writable? when using chroot [github.com/eric]
38
+
39
+ == 0.7.8 / 2008-07-09
40
+ * Bug Fixes
41
+ * Catch all Exceptions from HttpResponseCode condition [github.com/rliebling]
42
+ * Don't error out if the process went away in SlashProcPoller [Kevin Clark]
43
+ * Correction of Task#handle_poll to prevent crash under event registration failure conditions. [github.com/raggi]
44
+ * Cleaned up logging of failed e-mail sends. [github.com/raggi]
45
+ * Listen on 127.0.0.1 when using God as a client. [github.com/halorgium]
46
+ * New Behaviors
47
+ * clean_unix_socket [github.com/gma]
48
+ * New Contacts
49
+ * jabber [github.com/jwulff]
50
+ * email via sendmail [github.com/monde]
51
+ * Minor Enhancements
52
+ * chroot support [github.com/eric]
53
+ * Added God.log_file for the main god log, overridden by command line option. [github.com/raggi]
54
+ * Print groups from `god status` command if present [github.com/pdlug]
55
+ * Allow headers to be specified for http_response_code condition [github.com/pdlug]
56
+
57
+ == 0.7.7 / 2008-06-17
58
+ * Bug Fixes
59
+ * Fix detection of proc file system [raggi]
60
+
61
+ == 0.7.6 / 2008-05-13
62
+ * Major Enhancements
63
+ * Implement System::Process methods for Linux based on /proc [Kevin Clark]
64
+ * Minor Enhancements
65
+ * Allowing directories to be loaded at start [Bert Goethals]
66
+ * Bug Fixes
67
+ * Don't leak events on error in the kqueue handler [Kevin Clark]
68
+
69
+ == 0.7.5 / 2008-02-21
70
+ * Bug Fixes
71
+ * Remove Ruby's Logger and replace with custom SimpleLogger to stop threaded leak
72
+
73
+ == 0.7.4 / 2008-02-18
74
+ * Bug Fixes
75
+ * Introduce local scope to prevent faulty optimization that causes memory to leak
76
+
77
+ == 0.7.3 / 2008-02-14
78
+ * Minor Enhancements
79
+ * Add --bleakhouse to make running diagnostics easier
80
+ * Bug Fixes
81
+ * Use ::Process.kill(0, ...) instead of `kill -0` [queso]
82
+ * Fix pid_file behavior in process-centric conditions so they work with tasks [matias]
83
+ * Redirect output of daemonized god to log file or /dev/null earlier [_eric]
84
+
85
+ == 0.7.2 / 2008-02-04
86
+ * Bug Fixes
87
+ * Start event system for CLI commands
88
+ * Up internal history to 100 lines per watch
89
+
90
+ == 0.7.1 / 2008-02-04
91
+ * Minor Enhancements
92
+ * Add --no-events option to completely disable events system
93
+
94
+ == 0.7.0 / 2008-02-01
95
+ * Minor Enhancements
96
+ * Better default pid_file_directory behavior
97
+ * Add --attach <pid> to specify that god should quit if <pid> exits
98
+ * Bug Fixes
99
+ * Handle ECONNRESET in HttpResponseCode
100
+
101
+ == 0.6.12 / 2008-01-31
102
+ * Minor Enhancements
103
+ * Allow log file output for non-daemonized god
104
+ * Switch to SIGTERM from SIGHUP for default lambda killer
105
+
106
+ == 0.6.11 / 2008-01-31
107
+ * Major Enhancements
108
+ * HUGE refactor of timer system to simplify scheduling
109
+ * Minor Enhancements
110
+ * Check for a truly working event system and disallow event conditions if none is present
111
+
112
+ == 0.6.10 / 2008-01-24
113
+ * Bug Fixes
114
+ * Fix ensure_stop nil pid no local variable bug
115
+
116
+ == 0.6.9 / 2008-01-23
117
+ * Bug Fixes
118
+ * Fix Timer condition dedup behavior
119
+
120
+ == 0.6.8 / 2008-01-23
121
+ * Minor Enhancements
122
+ * Warn if a command returns a non-zero exit code
123
+ * Ensure that stop command actually stops process
124
+
125
+ == 0.6.7 / 2008-01-22
126
+ * Minor Enhancements
127
+ * Add --no-syslog option to disable Syslog
128
+ * Allow contact redeclaration (dups are ignored)
129
+
130
+ == 0.6.6 / 2008-01-07
131
+ * Bug Fixes
132
+ * Redo Timer mutexing to reduce synchronization needs
133
+
134
+ == 0.6.5 / 2008-01-04
135
+ * Bug Fixes
136
+ * Fix Timer descheduling deadlock issue
137
+ * Change HttpResponseCode to use GET instead of HEAD
138
+
139
+ == 0.6.4 / 2008-12-31
140
+ * Bug Fixes
141
+ * Refactor Hub to clarify mutexing
142
+ * Eliminate potential iteration problem in Timer
143
+ * Add caching PID accessor to process to solve event deregistration failure
144
+
145
+ == 0.6.3 / 2007-12-18
146
+ * Minor Enhancements
147
+ * Output ProcessExits registration/deregistration info
148
+
149
+ == 0.6.2 / 2007-12-17
150
+ * Minor Enhancements
151
+ * Output registered PID for ProcessExits
152
+ * Bug Fixes
153
+ * Fix `god remove <group>` not working for unmonitored watches
154
+
155
+ == 0.6.1 / 2007-12-14
156
+
157
+ * Minor Enhancement
158
+ * Log when state change is complete
159
+
160
+ == 0.6.0 / 2007-12-4
161
+
162
+ * Minor Enhancement
163
+ * Move Syslog calls into God::Logger and clean up all calling code
164
+ * Remove god's pid file on user requested termination
165
+ * Better handling and cleanup of DRb server's unix domain socket
166
+ * Allow shorthand for requesting a god log
167
+ * Add `god check` to make it easier to diagnose event problems
168
+ * Refactor god binary into class/method structure
169
+ * Implement `god remove` to remove a Task altogether
170
+ * New Conditions
171
+ * DiskUsage < PollCondition - trigger if disk usage is above limit on mount [Rudy Desjardins]
172
+
173
+ == 0.5.2 / 2007-10-10
174
+
175
+ * Minor Enhancement
176
+ * Allow extra args to pass through to config file
177
+
178
+ == 0.5.1 / 2007-10-08
179
+
180
+ * Bug Fixes
181
+ * Rescue connection refused in http response code condition
182
+
183
+ == 0.5.0 / 2007-10-05
184
+
185
+ * Major Enhancements
186
+ * Implement lifecycle scoped metric to allow for cross-state conditions
187
+ * Add TriggerCondition for conditions that need info about state changes
188
+ * Implement notification system
189
+ * Add Tasks (a generalization of Watches) to do non-process related tasks
190
+ * Add example init.d file in GOD_INSTALL_DIR/init/god [scott becker]
191
+ * Add human readable info to conditions (and make low level log lines debug)
192
+ * Switch DRb to use a unix domain socket for security reasons
193
+ * Minor Enchancements
194
+ * Allow EventConditions to do transition overloading
195
+ * Report errors during god startup instead of failing silently
196
+ * Make transition block optional (default to Always condition returning true)
197
+ * Better usage info for `god --help`
198
+ * Explain what's going on when attempting to rebind to an in-use port
199
+ * Add -b option to god binary to auto-bind to an unused port
200
+ * Add `god quit` to stop god without stopping any tasks
201
+ * Make self-daemonized Watch commands synchronous (as they should be)
202
+ * Allow self-daemonized Watches to specify a log (could be useful)
203
+ * Check for existence of config file if specified
204
+ * Robustify `god load` and report errors back to the command issuer
205
+ * Warn when `god load` tries to set global options
206
+ * Add Configurable.clear method and make built-in conditions clear on entry
207
+ * New Conditions
208
+ * Flapping < TriggerCondition - trigger on state change
209
+ * HttpResponseCode < PollCondition - trigger on http response code or timeout (thx scott becker)
210
+ * New Contacts
211
+ * Email < Contact - notify via email (smtp)
212
+ * Bug Fixes
213
+ * Fix abort not aborting problem
214
+ * Fix -p option not working for god binary
215
+ * Fix God.init not accepting block (thx _eric)
216
+ * Fix SIGHUP ignore (thx _eric)
217
+ * Fix error reporting on `god --help` (don't error report a normal SystemExit)
218
+
219
+ == 0.4.3 / 2007-09-10
220
+ * Bug Fixes
221
+ * fix Process#alive? to not raise on no such file (affects `god terminate`)
222
+
223
+ == 0.4.2 / 2007-09-10
224
+ * Bug Fixes
225
+ * fix netlink buffer issue that prevented events on Linux from working consistently [dkresge]
226
+
227
+ == 0.4.1 / 2007-09-10
228
+ * Bug Fixes
229
+ * require 'stringio' for ruby 1.8.5
230
+
231
+ == 0.4.0 / 2007-09-10
232
+
233
+ * Major Enhancements
234
+ * Add the ability for conditions to override transition state (for exceptional cases)
235
+ * Implement dynamic load of config files while god is running (god load <filename>)
236
+ * Add ability to save auto-daemonized process output to a log file
237
+ * Add robust default stop lambda command for auto-daemonized processes (inspired by _eric)
238
+ * Add status command for god binary (shows status of each watch)
239
+ * Create proper logger with timestamps
240
+ * Add log command to god binary to get real time logs for a specific watch from a running god instance
241
+ * Add terminate command for god binary (stop god and all watches)
242
+ * Minor Enhancements
243
+ * Enforce validity of Watches
244
+ * Enforce that God.init is not called after a Watch
245
+ * Move pid_file_directory creation and validation to God.start
246
+ * Remove check for at least one Watch during startup (now that dynamic loading exists)
247
+ * New Conditions
248
+ * Tries < PollCondition - triggers after the specified number of tries
249
+ * Add :notify_when_flapping behavior to check for oscillation [kevinclark]
250
+ * Add :degrading_lambda condition. [kevinclark]
251
+ It uses a decaying interval (1/2 rate) for 3 cycles before failing.
252
+ * Bug Fixes
253
+ * Use exit!(0) instead of exit! in god binary to exit with code 0 (instead of default -1)
254
+ * Command line group control fixed
255
+ * Fix cross-thread return problem
256
+
257
+ == 0.3.0 / 2007-08-17
258
+
259
+ * Fix netlink header problem on Ubuntu Edgy [Dan Sully]
260
+ * Add uid/gid setting for processes [kevinclark]
261
+ * Add autostart flag for watches so they don't necessarily startup with god [kevinclark]
262
+ * Change command line call options for god binary to accommodate watch start/stop functionality
263
+ * Add individual start/stop/restart grace periods for finer grained control
264
+ * Change default DRb port to 17165 ('god'.to_i(32))
265
+ * Implement command line control to start/restart/stop/monitor/unmonitor watches/groups by name
266
+ * Watches can now belong to a group that can be controlled as a whole
267
+ * Allow god to be installed (sans events) on systems that don't support events
268
+ * Daemonize and handle PID files for non-daemonizing scripts [kevinclark]
269
+ * Fix simple mode lifecycle gap
270
+ * Remove necessity to specify pid_file for conditions
271
+ * Change config file to use God.init and God.watch directly instead of God.meddle block
272
+ * Move god binary command logic to main library
273
+ * Enhance god binary with better reporting
274
+ * Fix synchronization bug in Timer (reported by Srini Panguluri)
275
+ * Add Lambda condition for easy custom conditions [Mike Mintz]
276
+ * Add sugar for numerics (seconds, minutes, kilobytes, megabytes, percent, etc)
277
+ * Add optional PID and log file generation to god binary for daemon mode
278
+ * Add God.load to do glob enabled loading
279
+ * Add -V option to god binary for detailed version/build info
280
+
281
+ == 0.2.0 / 2007-07-18
282
+
283
+ * Rewrote innards to use a state and event based lifecycle
284
+ * Basic support for events via kqueue (bsd/darwin) and netlink/pec (linux) [kevinclark]
285
+ * Added advanced syntax (simple syntax calls advanced api underneath)
286
+ * Condition returns have changed meaning. With simple syntax, a true return activates block
287
+ * Updated http://god.rubyforge.org with updated simple config and new advanced config
288
+
289
+ == 0.1.0 / 2007-07-07
290
+
291
+ * 1 major enhancement
292
+ * Birthday!
293
+
data/Manifest.txt ADDED
@@ -0,0 +1,102 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/god
6
+ examples/events.god
7
+ examples/gravatar.god
8
+ examples/single.god
9
+ ext/god/extconf.rb
10
+ ext/god/kqueue_handler.c
11
+ ext/god/netlink_handler.c
12
+ init/god
13
+ lib/god.rb
14
+ lib/god/behavior.rb
15
+ lib/god/behaviors/clean_pid_file.rb
16
+ lib/god/behaviors/notify_when_flapping.rb
17
+ lib/god/cli/command.rb
18
+ lib/god/cli/run.rb
19
+ lib/god/cli/version.rb
20
+ lib/god/condition.rb
21
+ lib/god/conditions/always.rb
22
+ lib/god/conditions/complex.rb
23
+ lib/god/conditions/cpu_usage.rb
24
+ lib/god/conditions/degrading_lambda.rb
25
+ lib/god/conditions/disk_usage.rb
26
+ lib/god/conditions/flapping.rb
27
+ lib/god/conditions/http_response_code.rb
28
+ lib/god/conditions/lambda.rb
29
+ lib/god/conditions/memory_usage.rb
30
+ lib/god/conditions/process_exits.rb
31
+ lib/god/conditions/process_running.rb
32
+ lib/god/conditions/tries.rb
33
+ lib/god/configurable.rb
34
+ lib/god/contact.rb
35
+ lib/god/contacts/email.rb
36
+ lib/god/dependency_graph.rb
37
+ lib/god/diagnostics.rb
38
+ lib/god/driver.rb
39
+ lib/god/errors.rb
40
+ lib/god/event_handler.rb
41
+ lib/god/event_handlers/dummy_handler.rb
42
+ lib/god/event_handlers/kqueue_handler.rb
43
+ lib/god/event_handlers/netlink_handler.rb
44
+ lib/god/logger.rb
45
+ lib/god/metric.rb
46
+ lib/god/process.rb
47
+ lib/god/registry.rb
48
+ lib/god/socket.rb
49
+ lib/god/sugar.rb
50
+ lib/god/system/process.rb
51
+ lib/god/task.rb
52
+ lib/god/timeline.rb
53
+ lib/god/trigger.rb
54
+ lib/god/watch.rb
55
+ test/configs/child_events/child_events.god
56
+ test/configs/child_events/simple_server.rb
57
+ test/configs/child_polls/child_polls.god
58
+ test/configs/child_polls/simple_server.rb
59
+ test/configs/complex/complex.god
60
+ test/configs/complex/simple_server.rb
61
+ test/configs/contact/contact.god
62
+ test/configs/contact/simple_server.rb
63
+ test/configs/daemon_events/daemon_events.god
64
+ test/configs/daemon_events/simple_server.rb
65
+ test/configs/daemon_events/simple_server_stop.rb
66
+ test/configs/daemon_polls/daemon_polls.god
67
+ test/configs/daemon_polls/simple_server.rb
68
+ test/configs/degrading_lambda/degrading_lambda.god
69
+ test/configs/degrading_lambda/tcp_server.rb
70
+ test/configs/real.rb
71
+ test/configs/running_load/running_load.god
72
+ test/configs/stress/simple_server.rb
73
+ test/configs/stress/stress.god
74
+ test/configs/task/logs/.placeholder
75
+ test/configs/task/task.god
76
+ test/configs/test.rb
77
+ test/helper.rb
78
+ test/suite.rb
79
+ test/test_behavior.rb
80
+ test/test_condition.rb
81
+ test/test_conditions_disk_usage.rb
82
+ test/test_conditions_http_response_code.rb
83
+ test/test_conditions_process_running.rb
84
+ test/test_conditions_tries.rb
85
+ test/test_contact.rb
86
+ test/test_dependency_graph.rb
87
+ test/test_driver.rb
88
+ test/test_event_handler.rb
89
+ test/test_god.rb
90
+ test/test_handlers_kqueue_handler.rb
91
+ test/test_logger.rb
92
+ test/test_metric.rb
93
+ test/test_process.rb
94
+ test/test_registry.rb
95
+ test/test_socket.rb
96
+ test/test_sugar.rb
97
+ test/test_system_process.rb
98
+ test/test_task.rb
99
+ test/test_timeline.rb
100
+ test/test_trigger.rb
101
+ test/test_watch.rb
102
+
data/README.txt ADDED
@@ -0,0 +1,59 @@
1
+ god
2
+ by Tom Preston-Werner
3
+ Kevin Clark (kqueue/netlink support)
4
+
5
+ http://god.rubyforge.org
6
+
7
+ == DESCRIPTION:
8
+
9
+ God is an easy to configure, easy to extend monitoring framework written
10
+ in Ruby.
11
+
12
+ Keeping your server processes and tasks running should be a simple part of
13
+ your deployment process. God aims to be the simplest, most powerful
14
+ monitoring application available.
15
+
16
+ == DOCUMENTATION:
17
+
18
+ See online documentation at http://god.rubyforge.org
19
+
20
+ == COMMUNITY:
21
+
22
+ Sign up for the god mailing list at http://groups.google.com/group/god-rb
23
+
24
+ == INSTALL:
25
+
26
+ $ sudo gem install god
27
+
28
+ == CONTRIBUTE:
29
+
30
+ Latest code is available at http://github.com/mojombo/god
31
+
32
+ The 'master' branch can be cloned with:
33
+
34
+ $ git clone git://github.com/mojombo/god.git
35
+
36
+ == LICENSE:
37
+
38
+ (The MIT License)
39
+
40
+ Copyright (c) 2007 Tom Preston-Werner
41
+
42
+ Permission is hereby granted, free of charge, to any person obtaining
43
+ a copy of this software and associated documentation files (the
44
+ 'Software'), to deal in the Software without restriction, including
45
+ without limitation the rights to use, copy, modify, merge, publish,
46
+ distribute, sublicense, and/or sell copies of the Software, and to
47
+ permit persons to whom the Software is furnished to do so, subject to
48
+ the following conditions:
49
+
50
+ The above copyright notice and this permission notice shall be
51
+ included in all copies or substantial portions of the Software.
52
+
53
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
54
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
55
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
56
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
57
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
58
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
59
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,67 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "god"
8
+ gem.summary = 'Like monit, only awesome'
9
+ gem.description = "God is an easy to configure, easy to extend monitoring framework written in Ruby."
10
+ gem.email = "tom@mojombo.com"
11
+ gem.homepage = "http://god.rubyforge.org/"
12
+ gem.authors = ["Tom Preston-Werner"]
13
+ gem.require_paths = ["lib", "ext"]
14
+ gem.files.include("ext")
15
+ gem.extensions << 'ext/god/extconf.rb'
16
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
+ end
18
+
19
+ rescue LoadError
20
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
21
+ end
22
+
23
+ require 'rake/testtask'
24
+ Rake::TestTask.new(:test) do |test|
25
+ test.libs << 'lib' << 'test'
26
+ test.pattern = 'test/**/test_*.rb'
27
+ test.verbose = true
28
+ end
29
+
30
+ task :default => :test
31
+
32
+ desc "Open an irb session preloaded with this library"
33
+ task :console do
34
+ sh "irb -rubygems -r ./lib/god.rb"
35
+ end
36
+
37
+ desc "Upload site to Rubyforge"
38
+ task :site do
39
+ sh "scp -r site/* mojombo@god.rubyforge.org:/var/www/gforge-projects/god"
40
+ end
41
+
42
+ desc "Upload site to Rubyforge"
43
+ task :site_edge do
44
+ sh "scp -r site/* mojombo@god.rubyforge.org:/var/www/gforge-projects/god/edge"
45
+ end
46
+
47
+ desc "Run rcov"
48
+ task :coverage do
49
+ `rm -fr coverage`
50
+ `rcov test/test_*.rb`
51
+ `open coverage/index.html`
52
+ end
53
+
54
+ require 'rake/rdoctask'
55
+ Rake::RDocTask.new do |rdoc|
56
+ if File.exist?('VERSION.yml')
57
+ config = YAML.load(File.read('VERSION.yml'))
58
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
59
+ else
60
+ version = ""
61
+ end
62
+
63
+ rdoc.rdoc_dir = 'rdoc'
64
+ rdoc.title = "god #{version}"
65
+ rdoc.rdoc_files.include('README*')
66
+ rdoc.rdoc_files.include('lib/**/*.rb')
67
+ end
data/bin/god ADDED
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ STDOUT.sync = true
4
+
5
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
6
+
7
+ require 'rubygems'
8
+ require 'optparse'
9
+ require 'drb'
10
+
11
+ begin
12
+ options = {:daemonize => true, :port => 17165, :syslog => true, :events => true}
13
+
14
+ opts = OptionParser.new do |opts|
15
+ opts.banner = <<-EOF
16
+ Usage:
17
+ Starting:
18
+ god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]
19
+
20
+ Querying:
21
+ god <command> <argument> [-p <port>]
22
+ god <command> [-p <port>]
23
+ god -v
24
+ god -V (must be run as root to be accurate on Linux)
25
+
26
+ Commands:
27
+ start <task or group name> start task or group
28
+ restart <task or group name> restart task or group
29
+ stop <task or group name> stop task or group
30
+ monitor <task or group name> monitor task or group
31
+ unmonitor <task or group name> unmonitor task or group
32
+ remove <task or group name> remove task or group from god
33
+ load <file> load a config into a running god
34
+ log <task name> show realtime log for given task
35
+ status show status of each task
36
+ signal <task or group name> <sig> signal all matching tasks
37
+ quit stop god
38
+ terminate stop god and all tasks
39
+ check run self diagnostic
40
+
41
+ Options:
42
+ EOF
43
+
44
+ opts.on("-cCONFIG", "--config-file CONFIG", "Configuration file") do |x|
45
+ options[:config] = x
46
+ end
47
+
48
+ opts.on("-pPORT", "--port PORT", "Communications port (default 17165)") do |x|
49
+ options[:port] = x
50
+ end
51
+
52
+ opts.on("-b", "--auto-bind", "Auto-bind to an unused port number") do
53
+ options[:port] = "0"
54
+ end
55
+
56
+ opts.on("-PFILE", "--pid FILE", "Where to write the PID file") do |x|
57
+ options[:pid] = x
58
+ end
59
+
60
+ opts.on("-lFILE", "--log FILE", "Where to write the log file") do |x|
61
+ options[:log] = x
62
+ end
63
+
64
+ opts.on("-D", "--no-daemonize", "Don't daemonize") do
65
+ options[:daemonize] = false
66
+ end
67
+
68
+ opts.on("-v", "--version", "Print the version number and exit") do
69
+ options[:version] = true
70
+ end
71
+
72
+ opts.on("-V", "Print extended version and build information") do
73
+ options[:info] = true
74
+ end
75
+
76
+ opts.on("--log-level LEVEL", "Log level [debug|info|warn|error|fatal]") do |x|
77
+ options[:log_level] = x.to_sym
78
+ end
79
+
80
+ opts.on("--no-syslog", "Disable output to syslog") do
81
+ options[:syslog] = false
82
+ end
83
+
84
+ opts.on("--attach PID", "Quit god when the attached process dies") do |x|
85
+ options[:attach] = x
86
+ end
87
+
88
+ opts.on("--no-events", "Disable the event system") do
89
+ options[:events] = false
90
+ end
91
+
92
+ opts.on("--bleakhouse", "Enable bleakhouse profiling") do
93
+ options[:bleakhouse] = true
94
+ end
95
+ end
96
+
97
+ opts.parse!
98
+
99
+ # validate
100
+ if options[:log_level] && ![:debug, :info, :warn, :error, :fatal].include?(options[:log_level])
101
+ abort("Invalid log level '#{options[:log_level]}'")
102
+ end
103
+
104
+ # dispatch
105
+ if !options[:config] && options[:version]
106
+ require 'god'
107
+ God::CLI::Version.version
108
+ elsif !options[:config] && options[:info]
109
+ require 'god'
110
+ God::EventHandler.load
111
+ God::CLI::Version.version_extended
112
+ elsif !options[:config] && command = ARGV[0]
113
+ require 'god'
114
+ God::EventHandler.load
115
+ God::CLI::Command.new(command, options, ARGV)
116
+ else
117
+ require 'god/cli/run'
118
+ God::CLI::Run.new(options)
119
+ end
120
+ rescue Exception => e
121
+ if e.instance_of?(SystemExit)
122
+ raise
123
+ else
124
+ puts 'Uncaught exception'
125
+ puts e.message
126
+ puts e.backtrace.join("\n")
127
+ end
128
+ end