god 0.8.0 → 0.9.0

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.
Files changed (50) hide show
  1. data/History.txt +14 -0
  2. data/Rakefile +42 -26
  3. data/ext/god/kqueue_handler.c +6 -4
  4. data/ext/god/netlink_handler.c +6 -6
  5. data/god.gemspec +127 -151
  6. data/lib/god.rb +26 -5
  7. data/lib/god/cli/command.rb +1 -1
  8. data/lib/god/cli/run.rb +5 -5
  9. data/lib/god/compat19.rb +36 -0
  10. data/lib/god/contacts/prowl.rb +77 -0
  11. data/lib/god/contacts/scout.rb +64 -0
  12. data/lib/god/driver.rb +5 -0
  13. data/lib/god/logger.rb +8 -29
  14. data/lib/god/process.rb +8 -2
  15. data/lib/god/simple_logger.rb +7 -1
  16. data/lib/god/socket.rb +13 -2
  17. data/lib/god/sys_logger.rb +45 -0
  18. data/lib/god/watch.rb +2 -1
  19. data/test/configs/contact/contact.god +7 -1
  20. data/test/configs/task/logs/.placeholder +0 -0
  21. data/test/helper.rb +2 -1
  22. data/test/test_behavior.rb +1 -1
  23. data/test/test_logger.rb +1 -1
  24. data/test/test_prowl.rb +15 -0
  25. metadata +6 -27
  26. data/.gitignore +0 -8
  27. data/VERSION.yml +0 -5
  28. data/ideas/execve/execve.c +0 -29
  29. data/ideas/execve/extconf.rb +0 -11
  30. data/ideas/execve/go.rb +0 -8
  31. data/ideas/future.god +0 -82
  32. data/init/god +0 -42
  33. data/init/lsb_compliant_god +0 -109
  34. data/site/images/banner.jpg +0 -0
  35. data/site/images/bg.gif +0 -0
  36. data/site/images/bg_grey.gif +0 -0
  37. data/site/images/bullet.jpg +0 -0
  38. data/site/images/corner_green.gif +0 -0
  39. data/site/images/corner_green.psd +0 -0
  40. data/site/images/corner_pink.gif +0 -0
  41. data/site/images/god_logo.png +0 -0
  42. data/site/images/header_bg.gif +0 -0
  43. data/site/images/header_bg.jpg +0 -0
  44. data/site/images/red_dot.gif +0 -0
  45. data/site/images/top_bg.gif +0 -0
  46. data/site/index.html +0 -563
  47. data/site/install.html +0 -2
  48. data/site/javascripts/code_highlighter.js +0 -188
  49. data/site/javascripts/ruby.js +0 -18
  50. data/site/stylesheets/layout.css +0 -174
@@ -1,3 +1,17 @@
1
+ == 0.9.0 / 2010-04-03
2
+ * Minor Enhancements
3
+ * Allow kqueue for OpenBSD and NetBSD
4
+ * Add err_log and err_log_cmd
5
+ * Add God.terminate_timeout option
6
+ * Respect --log-level in Syslog
7
+ * Add configuration parameters to set permissions on socket
8
+ * Add Scout contact
9
+ * Add Prowl contact
10
+ * Bug Fixes
11
+ * Fix interleaved log messages
12
+ * Experimental
13
+ * Ruby 1.9 support
14
+
1
15
  == 0.8.0 / 2009-11-30
2
16
  * Minor Enhancements
3
17
  * Rubygems decontamination
data/Rakefile CHANGED
@@ -1,24 +1,10 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
+ require 'date'
3
4
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "god"
8
- gem.rubyforge_project = "god"
9
- gem.summary = 'Like monit, only awesome'
10
- gem.description = "God is an easy to configure, easy to extend monitoring framework written in Ruby."
11
- gem.email = "tom@mojombo.com"
12
- gem.homepage = "http://god.rubyforge.org/"
13
- gem.authors = ["Tom Preston-Werner"]
14
- gem.require_paths = ["lib", "ext"]
15
- gem.files.include("ext")
16
- gem.extensions << 'ext/god/extconf.rb'
17
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
- end
19
-
20
- rescue LoadError
21
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
5
+ def source_version
6
+ line = File.read('lib/god.rb')[/^\s*VERSION = .*/]
7
+ line.match(/.*VERSION = '(.*)'/)[1]
22
8
  end
23
9
 
24
10
  require 'rake/testtask'
@@ -54,15 +40,45 @@ end
54
40
 
55
41
  require 'rake/rdoctask'
56
42
  Rake::RDocTask.new do |rdoc|
57
- if File.exist?('VERSION.yml')
58
- config = YAML.load(File.read('VERSION.yml'))
59
- version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
60
- else
61
- version = ""
62
- end
63
-
64
43
  rdoc.rdoc_dir = 'rdoc'
65
- rdoc.title = "god #{version}"
44
+ rdoc.title = "god #{source_version}"
66
45
  rdoc.rdoc_files.include('README*')
67
46
  rdoc.rdoc_files.include('lib/**/*.rb')
47
+ end
48
+
49
+ if defined?(Gem)
50
+ task :release => :build do
51
+ sh "git commit --allow-empty -a -m 'up to #{source_version}'"
52
+ sh "git tag v#{source_version}"
53
+ sh "git push origin master"
54
+ sh "gem push pkg/god-#{source_version}.gem"
55
+ end
56
+
57
+ task :build => :gemspec do
58
+ sh 'mkdir -p pkg'
59
+ sh 'gem build god.gemspec'
60
+ sh 'mv *.gem pkg'
61
+ end
62
+
63
+ task :gemspec do
64
+ # read spec file and split out manifest section
65
+ spec = File.read('god.gemspec')
66
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
67
+ # replace version and date
68
+ head.sub!(/\.version = '.*'/, ".version = '#{source_version}'")
69
+ head.sub!(/\.date = '.*'/, ".date = '#{Date.today.to_s}'")
70
+ # determine file list from git ls-files
71
+ files = `git ls-files`.
72
+ split("\n").
73
+ sort.
74
+ reject { |file| file =~ /^\./ }.
75
+ reject { |file| file =~ /^(ideas|init|site)/ }.
76
+ map { |file| " #{file}" }.
77
+ join("\n")
78
+ # piece file back together and write...
79
+ manifest = " s.files = %w[\n#{files}\n ]\n"
80
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
81
+ File.open('god.gemspec', 'w') { |io| io.write(spec) }
82
+ puts "updated god.gemspec"
83
+ end
68
84
  end
@@ -1,4 +1,4 @@
1
- #if defined(__FreeBSD__) || defined(__APPLE__)
1
+ #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__NetBSD__)
2
2
 
3
3
  #include <ruby.h>
4
4
  #include <sys/event.h>
@@ -41,6 +41,8 @@ kqh_monitor_process(VALUE klass, VALUE pid, VALUE mask)
41
41
  {
42
42
  struct kevent new_event;
43
43
  ID event;
44
+
45
+ (void)event; //!< Silence warning about unused var, should be removed?
44
46
 
45
47
  u_int fflags = NUM2UINT(mask);
46
48
 
@@ -48,7 +50,7 @@ kqh_monitor_process(VALUE klass, VALUE pid, VALUE mask)
48
50
  EV_ADD | EV_ENABLE, fflags, 0, 0);
49
51
 
50
52
  if (-1 == kevent(kq, &new_event, 1, NULL, 0, NULL)) {
51
- rb_raise(rb_eStandardError, strerror(errno));
53
+ rb_raise(rb_eStandardError, "%s", strerror(errno));
52
54
  }
53
55
 
54
56
  num_events = NUM_EVENTS;
@@ -74,14 +76,14 @@ kqh_handle_events()
74
76
  events = (struct kevent*)malloc(num_to_fetch * sizeof(struct kevent));
75
77
 
76
78
  if (NULL == events) {
77
- rb_raise(rb_eStandardError, strerror(errno));
79
+ rb_raise(rb_eStandardError, "%s", strerror(errno));
78
80
  }
79
81
 
80
82
  nevents = kevent(kq, NULL, 0, events, num_to_fetch, NULL);
81
83
 
82
84
  if (-1 == nevents) {
83
85
  free(events);
84
- rb_raise(rb_eStandardError, strerror(errno));
86
+ rb_raise(rb_eStandardError, "%s", strerror(errno));
85
87
  } else {
86
88
  for (i = 0; i < nevents; i++) {
87
89
  if (events[i].fflags & NOTE_EXIT) {
@@ -37,7 +37,7 @@ nlh_handle_events()
37
37
  FD_SET(nl_sock, &fds);
38
38
 
39
39
  if (0 > rb_thread_select(nl_sock + 1, &fds, NULL, NULL, NULL)) {
40
- rb_raise(rb_eStandardError, strerror(errno));
40
+ rb_raise(rb_eStandardError, "%s", strerror(errno));
41
41
  }
42
42
 
43
43
  /* If there were no events detected, return */
@@ -47,13 +47,13 @@ nlh_handle_events()
47
47
 
48
48
  /* if there are events, make calls */
49
49
  if (-1 == recv(nl_sock, buff, sizeof(buff), 0)) {
50
- rb_raise(rb_eStandardError, strerror(errno));
50
+ rb_raise(rb_eStandardError, "%s", strerror(errno));
51
51
  }
52
52
 
53
53
  hdr = (struct nlmsghdr *)buff;
54
54
 
55
55
  if (NLMSG_ERROR == hdr->nlmsg_type) {
56
- rb_raise(rb_eStandardError, strerror(errno));
56
+ rb_raise(rb_eStandardError, "%s", strerror(errno));
57
57
  } else if (NLMSG_DONE == hdr->nlmsg_type) {
58
58
 
59
59
  event = (struct proc_event *)((struct cn_msg *)NLMSG_DATA(hdr))->data;
@@ -114,7 +114,7 @@ connect_to_netlink()
114
114
  nl_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
115
115
 
116
116
  if (-1 == nl_sock) {
117
- rb_raise(rb_eStandardError, strerror(errno));
117
+ rb_raise(rb_eStandardError, "%s", strerror(errno));
118
118
  }
119
119
 
120
120
  bzero(&sa_nl, sizeof(sa_nl));
@@ -123,7 +123,7 @@ connect_to_netlink()
123
123
  sa_nl.nl_pid = getpid();
124
124
 
125
125
  if (-1 == bind(nl_sock, (struct sockaddr *)&sa_nl, sizeof(sa_nl))) {
126
- rb_raise(rb_eStandardError, strerror(errno));
126
+ rb_raise(rb_eStandardError, "%s", strerror(errno));
127
127
  }
128
128
 
129
129
  /* Fill header */
@@ -145,7 +145,7 @@ connect_to_netlink()
145
145
  *(int*)msg->data = PROC_CN_MCAST_LISTEN;
146
146
 
147
147
  if (-1 == send(nl_sock, hdr, hdr->nlmsg_len, 0)) {
148
- rb_raise(rb_eStandardError, strerror(errno));
148
+ rb_raise(rb_eStandardError, "%s", strerror(errno));
149
149
  }
150
150
  }
151
151
 
@@ -1,11 +1,6 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
1
  Gem::Specification.new do |s|
7
2
  s.name = %q{god}
8
- s.version = "0.8.0"
3
+ s.version = '0.9.0'
9
4
 
10
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
6
  s.authors = ["Tom Preston-Werner"]
@@ -18,152 +13,133 @@ Gem::Specification.new do |s|
18
13
  s.extra_rdoc_files = [
19
14
  "README.txt"
20
15
  ]
21
- s.files = [
22
- ".gitignore",
23
- "Announce.txt",
24
- "History.txt",
25
- "README.txt",
26
- "Rakefile",
27
- "VERSION.yml",
28
- "bin/god",
29
- "examples/events.god",
30
- "examples/gravatar.god",
31
- "examples/single.god",
32
- "ext/god/.gitignore",
33
- "ext/god/extconf.rb",
34
- "ext/god/kqueue_handler.c",
35
- "ext/god/netlink_handler.c",
36
- "god.gemspec",
37
- "ideas/execve/.DS_Store",
38
- "ideas/execve/execve.c",
39
- "ideas/execve/extconf.rb",
40
- "ideas/execve/go.rb",
41
- "ideas/future.god",
42
- "init/god",
43
- "init/lsb_compliant_god",
44
- "lib/god.rb",
45
- "lib/god/behavior.rb",
46
- "lib/god/behaviors/clean_pid_file.rb",
47
- "lib/god/behaviors/clean_unix_socket.rb",
48
- "lib/god/behaviors/notify_when_flapping.rb",
49
- "lib/god/cli/command.rb",
50
- "lib/god/cli/run.rb",
51
- "lib/god/cli/version.rb",
52
- "lib/god/condition.rb",
53
- "lib/god/conditions/always.rb",
54
- "lib/god/conditions/complex.rb",
55
- "lib/god/conditions/cpu_usage.rb",
56
- "lib/god/conditions/degrading_lambda.rb",
57
- "lib/god/conditions/disk_usage.rb",
58
- "lib/god/conditions/file_mtime.rb",
59
- "lib/god/conditions/flapping.rb",
60
- "lib/god/conditions/http_response_code.rb",
61
- "lib/god/conditions/lambda.rb",
62
- "lib/god/conditions/memory_usage.rb",
63
- "lib/god/conditions/process_exits.rb",
64
- "lib/god/conditions/process_running.rb",
65
- "lib/god/conditions/tries.rb",
66
- "lib/god/configurable.rb",
67
- "lib/god/contact.rb",
68
- "lib/god/contacts/campfire.rb",
69
- "lib/god/contacts/email.rb",
70
- "lib/god/contacts/jabber.rb",
71
- "lib/god/contacts/twitter.rb",
72
- "lib/god/contacts/webhook.rb",
73
- "lib/god/dependency_graph.rb",
74
- "lib/god/diagnostics.rb",
75
- "lib/god/driver.rb",
76
- "lib/god/errors.rb",
77
- "lib/god/event_handler.rb",
78
- "lib/god/event_handlers/dummy_handler.rb",
79
- "lib/god/event_handlers/kqueue_handler.rb",
80
- "lib/god/event_handlers/netlink_handler.rb",
81
- "lib/god/logger.rb",
82
- "lib/god/metric.rb",
83
- "lib/god/process.rb",
84
- "lib/god/registry.rb",
85
- "lib/god/simple_logger.rb",
86
- "lib/god/socket.rb",
87
- "lib/god/sugar.rb",
88
- "lib/god/system/portable_poller.rb",
89
- "lib/god/system/process.rb",
90
- "lib/god/system/slash_proc_poller.rb",
91
- "lib/god/task.rb",
92
- "lib/god/timeline.rb",
93
- "lib/god/trigger.rb",
94
- "lib/god/watch.rb",
95
- "site/images/banner.jpg",
96
- "site/images/bg.gif",
97
- "site/images/bg_grey.gif",
98
- "site/images/bullet.jpg",
99
- "site/images/corner_green.gif",
100
- "site/images/corner_green.psd",
101
- "site/images/corner_pink.gif",
102
- "site/images/god_logo.png",
103
- "site/images/header_bg.gif",
104
- "site/images/header_bg.jpg",
105
- "site/images/red_dot.gif",
106
- "site/images/top_bg.gif",
107
- "site/index.html",
108
- "site/install.html",
109
- "site/javascripts/code_highlighter.js",
110
- "site/javascripts/ruby.js",
111
- "site/stylesheets/layout.css",
112
- "test/configs/child_events/child_events.god",
113
- "test/configs/child_events/simple_server.rb",
114
- "test/configs/child_polls/child_polls.god",
115
- "test/configs/child_polls/simple_server.rb",
116
- "test/configs/complex/complex.god",
117
- "test/configs/complex/simple_server.rb",
118
- "test/configs/contact/contact.god",
119
- "test/configs/contact/simple_server.rb",
120
- "test/configs/daemon_events/daemon_events.god",
121
- "test/configs/daemon_events/simple_server.rb",
122
- "test/configs/daemon_events/simple_server_stop.rb",
123
- "test/configs/daemon_polls/daemon_polls.god",
124
- "test/configs/daemon_polls/simple_server.rb",
125
- "test/configs/degrading_lambda/degrading_lambda.god",
126
- "test/configs/degrading_lambda/tcp_server.rb",
127
- "test/configs/lifecycle/lifecycle.god",
128
- "test/configs/matias/matias.god",
129
- "test/configs/real.rb",
130
- "test/configs/running_load/running_load.god",
131
- "test/configs/stress/simple_server.rb",
132
- "test/configs/stress/stress.god",
133
- "test/configs/task/logs/.placeholder",
134
- "test/configs/task/task.god",
135
- "test/configs/test.rb",
136
- "test/helper.rb",
137
- "test/suite.rb",
138
- "test/test_behavior.rb",
139
- "test/test_campfire.rb",
140
- "test/test_condition.rb",
141
- "test/test_conditions_disk_usage.rb",
142
- "test/test_conditions_http_response_code.rb",
143
- "test/test_conditions_process_running.rb",
144
- "test/test_conditions_tries.rb",
145
- "test/test_contact.rb",
146
- "test/test_dependency_graph.rb",
147
- "test/test_driver.rb",
148
- "test/test_email.rb",
149
- "test/test_event_handler.rb",
150
- "test/test_god.rb",
151
- "test/test_handlers_kqueue_handler.rb",
152
- "test/test_jabber.rb",
153
- "test/test_logger.rb",
154
- "test/test_metric.rb",
155
- "test/test_process.rb",
156
- "test/test_registry.rb",
157
- "test/test_socket.rb",
158
- "test/test_sugar.rb",
159
- "test/test_system_portable_poller.rb",
160
- "test/test_system_process.rb",
161
- "test/test_task.rb",
162
- "test/test_timeline.rb",
163
- "test/test_trigger.rb",
164
- "test/test_watch.rb",
165
- "test/test_webhook.rb"
16
+ # = MANIFEST =
17
+ s.files = %w[
18
+ Announce.txt
19
+ History.txt
20
+ README.txt
21
+ Rakefile
22
+ bin/god
23
+ examples/events.god
24
+ examples/gravatar.god
25
+ examples/single.god
26
+ ext/god/.gitignore
27
+ ext/god/extconf.rb
28
+ ext/god/kqueue_handler.c
29
+ ext/god/netlink_handler.c
30
+ god.gemspec
31
+ lib/god.rb
32
+ lib/god/behavior.rb
33
+ lib/god/behaviors/clean_pid_file.rb
34
+ lib/god/behaviors/clean_unix_socket.rb
35
+ lib/god/behaviors/notify_when_flapping.rb
36
+ lib/god/cli/command.rb
37
+ lib/god/cli/run.rb
38
+ lib/god/cli/version.rb
39
+ lib/god/compat19.rb
40
+ lib/god/condition.rb
41
+ lib/god/conditions/always.rb
42
+ lib/god/conditions/complex.rb
43
+ lib/god/conditions/cpu_usage.rb
44
+ lib/god/conditions/degrading_lambda.rb
45
+ lib/god/conditions/disk_usage.rb
46
+ lib/god/conditions/file_mtime.rb
47
+ lib/god/conditions/flapping.rb
48
+ lib/god/conditions/http_response_code.rb
49
+ lib/god/conditions/lambda.rb
50
+ lib/god/conditions/memory_usage.rb
51
+ lib/god/conditions/process_exits.rb
52
+ lib/god/conditions/process_running.rb
53
+ lib/god/conditions/tries.rb
54
+ lib/god/configurable.rb
55
+ lib/god/contact.rb
56
+ lib/god/contacts/campfire.rb
57
+ lib/god/contacts/email.rb
58
+ lib/god/contacts/jabber.rb
59
+ lib/god/contacts/prowl.rb
60
+ lib/god/contacts/scout.rb
61
+ lib/god/contacts/twitter.rb
62
+ lib/god/contacts/webhook.rb
63
+ lib/god/dependency_graph.rb
64
+ lib/god/diagnostics.rb
65
+ lib/god/driver.rb
66
+ lib/god/errors.rb
67
+ lib/god/event_handler.rb
68
+ lib/god/event_handlers/dummy_handler.rb
69
+ lib/god/event_handlers/kqueue_handler.rb
70
+ lib/god/event_handlers/netlink_handler.rb
71
+ lib/god/logger.rb
72
+ lib/god/metric.rb
73
+ lib/god/process.rb
74
+ lib/god/registry.rb
75
+ lib/god/simple_logger.rb
76
+ lib/god/socket.rb
77
+ lib/god/sugar.rb
78
+ lib/god/sys_logger.rb
79
+ lib/god/system/portable_poller.rb
80
+ lib/god/system/process.rb
81
+ lib/god/system/slash_proc_poller.rb
82
+ lib/god/task.rb
83
+ lib/god/timeline.rb
84
+ lib/god/trigger.rb
85
+ lib/god/watch.rb
86
+ test/configs/child_events/child_events.god
87
+ test/configs/child_events/simple_server.rb
88
+ test/configs/child_polls/child_polls.god
89
+ test/configs/child_polls/simple_server.rb
90
+ test/configs/complex/complex.god
91
+ test/configs/complex/simple_server.rb
92
+ test/configs/contact/contact.god
93
+ test/configs/contact/simple_server.rb
94
+ test/configs/daemon_events/daemon_events.god
95
+ test/configs/daemon_events/simple_server.rb
96
+ test/configs/daemon_events/simple_server_stop.rb
97
+ test/configs/daemon_polls/daemon_polls.god
98
+ test/configs/daemon_polls/simple_server.rb
99
+ test/configs/degrading_lambda/degrading_lambda.god
100
+ test/configs/degrading_lambda/tcp_server.rb
101
+ test/configs/lifecycle/lifecycle.god
102
+ test/configs/matias/matias.god
103
+ test/configs/real.rb
104
+ test/configs/running_load/running_load.god
105
+ test/configs/stress/simple_server.rb
106
+ test/configs/stress/stress.god
107
+ test/configs/task/logs/.placeholder
108
+ test/configs/task/task.god
109
+ test/configs/test.rb
110
+ test/helper.rb
111
+ test/suite.rb
112
+ test/test_behavior.rb
113
+ test/test_campfire.rb
114
+ test/test_condition.rb
115
+ test/test_conditions_disk_usage.rb
116
+ test/test_conditions_http_response_code.rb
117
+ test/test_conditions_process_running.rb
118
+ test/test_conditions_tries.rb
119
+ test/test_contact.rb
120
+ test/test_dependency_graph.rb
121
+ test/test_driver.rb
122
+ test/test_email.rb
123
+ test/test_event_handler.rb
124
+ test/test_god.rb
125
+ test/test_handlers_kqueue_handler.rb
126
+ test/test_jabber.rb
127
+ test/test_logger.rb
128
+ test/test_metric.rb
129
+ test/test_process.rb
130
+ test/test_prowl.rb
131
+ test/test_registry.rb
132
+ test/test_socket.rb
133
+ test/test_sugar.rb
134
+ test/test_system_portable_poller.rb
135
+ test/test_system_process.rb
136
+ test/test_task.rb
137
+ test/test_timeline.rb
138
+ test/test_trigger.rb
139
+ test/test_watch.rb
140
+ test/test_webhook.rb
166
141
  ]
142
+ # = MANIFEST =
167
143
  s.homepage = %q{http://god.rubyforge.org/}
168
144
  s.rdoc_options = ["--charset=UTF-8"]
169
145
  s.require_paths = ["lib", "ext"]