god 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +14 -0
- data/Rakefile +42 -26
- data/ext/god/kqueue_handler.c +6 -4
- data/ext/god/netlink_handler.c +6 -6
- data/god.gemspec +127 -151
- data/lib/god.rb +26 -5
- data/lib/god/cli/command.rb +1 -1
- data/lib/god/cli/run.rb +5 -5
- data/lib/god/compat19.rb +36 -0
- data/lib/god/contacts/prowl.rb +77 -0
- data/lib/god/contacts/scout.rb +64 -0
- data/lib/god/driver.rb +5 -0
- data/lib/god/logger.rb +8 -29
- data/lib/god/process.rb +8 -2
- data/lib/god/simple_logger.rb +7 -1
- data/lib/god/socket.rb +13 -2
- data/lib/god/sys_logger.rb +45 -0
- data/lib/god/watch.rb +2 -1
- data/test/configs/contact/contact.god +7 -1
- data/test/configs/task/logs/.placeholder +0 -0
- data/test/helper.rb +2 -1
- data/test/test_behavior.rb +1 -1
- data/test/test_logger.rb +1 -1
- data/test/test_prowl.rb +15 -0
- metadata +6 -27
- data/.gitignore +0 -8
- data/VERSION.yml +0 -5
- data/ideas/execve/execve.c +0 -29
- data/ideas/execve/extconf.rb +0 -11
- data/ideas/execve/go.rb +0 -8
- data/ideas/future.god +0 -82
- data/init/god +0 -42
- data/init/lsb_compliant_god +0 -109
- data/site/images/banner.jpg +0 -0
- data/site/images/bg.gif +0 -0
- data/site/images/bg_grey.gif +0 -0
- data/site/images/bullet.jpg +0 -0
- data/site/images/corner_green.gif +0 -0
- data/site/images/corner_green.psd +0 -0
- data/site/images/corner_pink.gif +0 -0
- data/site/images/god_logo.png +0 -0
- data/site/images/header_bg.gif +0 -0
- data/site/images/header_bg.jpg +0 -0
- data/site/images/red_dot.gif +0 -0
- data/site/images/top_bg.gif +0 -0
- data/site/index.html +0 -563
- data/site/install.html +0 -2
- data/site/javascripts/code_highlighter.js +0 -188
- data/site/javascripts/ruby.js +0 -18
- data/site/stylesheets/layout.css +0 -174
data/History.txt
CHANGED
@@ -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
|
-
|
5
|
-
|
6
|
-
|
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 #{
|
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
|
data/ext/god/kqueue_handler.c
CHANGED
@@ -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) {
|
data/ext/god/netlink_handler.c
CHANGED
@@ -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
|
|
data/god.gemspec
CHANGED
@@ -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 =
|
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
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
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"]
|