forked from mojombo/god
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git://github.com/mojombo/god into mojombo/ma…
…ster
- Loading branch information
Showing
24 changed files
with
443 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ pkg | |
*.log | ||
logs | ||
*.rbc | ||
*~ | ||
.*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Gem::Specification.new do |s| | ||
s.name = %q{god} | ||
s.version = "0.7.7" | ||
|
||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= | ||
s.authors = ["Tom Preston-Werner"] | ||
s.date = %q{2008-06-23} | ||
s.default_executable = %q{god} | ||
s.description = %q{God is an easy to configure, easy to extend monitoring framework written in Ruby.} | ||
s.email = %q{tom@rubyisawesome.com} | ||
s.executables = ["god"] | ||
s.extensions = ["ext/god/extconf.rb"] | ||
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"] | ||
s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/god", "examples/events.god", "examples/gravatar.god", "examples/single.god", "ext/god/extconf.rb", "ext/god/kqueue_handler.c", "ext/god/netlink_handler.c", "init/god", "lib/god.rb", "lib/god/behavior.rb", "lib/god/behaviors/clean_pid_file.rb", "lib/god/behaviors/clean_unix_socket.rb", "lib/god/behaviors/notify_when_flapping.rb", "lib/god/cli/command.rb", "lib/god/cli/run.rb", "lib/god/cli/version.rb", "lib/god/condition.rb", "lib/god/conditions/always.rb", "lib/god/conditions/complex.rb", "lib/god/conditions/cpu_usage.rb", "lib/god/conditions/degrading_lambda.rb", "lib/god/conditions/disk_usage.rb", "lib/god/conditions/flapping.rb", "lib/god/conditions/http_response_code.rb", "lib/god/conditions/lambda.rb", "lib/god/conditions/memory_usage.rb", "lib/god/conditions/process_exits.rb", "lib/god/conditions/process_running.rb", "lib/god/conditions/tries.rb", "lib/god/configurable.rb", "lib/god/contact.rb", "lib/god/contacts/email.rb", "lib/god/dependency_graph.rb", "lib/god/diagnostics.rb", "lib/god/driver.rb", "lib/god/errors.rb", "lib/god/event_handler.rb", "lib/god/event_handlers/dummy_handler.rb", "lib/god/event_handlers/kqueue_handler.rb", "lib/god/event_handlers/netlink_handler.rb", "lib/god/logger.rb", "lib/god/metric.rb", "lib/god/process.rb", "lib/god/registry.rb", "lib/god/simple_logger.rb", "lib/god/socket.rb", "lib/god/sugar.rb", "lib/god/system/portable_poller.rb", "lib/god/system/process.rb", "lib/god/system/slash_proc_poller.rb", "lib/god/task.rb", "lib/god/timeline.rb", "lib/god/trigger.rb", "lib/god/watch.rb", "test/configs/child_events/child_events.god", "test/configs/child_events/simple_server.rb", "test/configs/child_polls/child_polls.god", "test/configs/child_polls/simple_server.rb", "test/configs/complex/complex.god", "test/configs/complex/simple_server.rb", "test/configs/contact/contact.god", "test/configs/contact/simple_server.rb", "test/configs/daemon_events/daemon_events.god", "test/configs/daemon_events/simple_server.rb", "test/configs/daemon_events/simple_server_stop.rb", "test/configs/daemon_polls/daemon_polls.god", "test/configs/daemon_polls/simple_server.rb", "test/configs/degrading_lambda/degrading_lambda.god", "test/configs/degrading_lambda/tcp_server.rb", "test/configs/matias/matias.god", "test/configs/real.rb", "test/configs/running_load/running_load.god", "test/configs/stress/simple_server.rb", "test/configs/stress/stress.god", "test/configs/task/logs/.placeholder", "test/configs/task/task.god", "test/configs/test.rb", "test/helper.rb", "test/suite.rb", "test/test_behavior.rb", "test/test_condition.rb", "test/test_conditions_disk_usage.rb", "test/test_conditions_http_response_code.rb", "test/test_conditions_process_running.rb", "test/test_conditions_tries.rb", "test/test_contact.rb", "test/test_dependency_graph.rb", "test/test_driver.rb", "test/test_event_handler.rb", "test/test_god.rb", "test/test_handlers_kqueue_handler.rb", "test/test_logger.rb", "test/test_metric.rb", "test/test_process.rb", "test/test_registry.rb", "test/test_socket.rb", "test/test_sugar.rb", "test/test_system_portable_poller.rb", "test/test_system_process.rb", "test/test_task.rb", "test/test_timeline.rb", "test/test_trigger.rb", "test/test_watch.rb"] | ||
s.has_rdoc = true | ||
s.homepage = %q{http://god.rubyforge.org/} | ||
s.rdoc_options = ["--main", "README.txt"] | ||
s.require_paths = ["lib", "ext"] | ||
s.rubyforge_project = %q{god} | ||
s.rubygems_version = %q{1.2.0} | ||
s.summary = %q{Like monit, only awesome} | ||
s.test_files = ["test/test_process.rb", "test/test_watch.rb", "test/test_system_portable_poller.rb", "test/test_conditions_tries.rb", "test/test_task.rb", "test/test_condition.rb", "test/test_timeline.rb", "test/test_logger.rb", "test/test_conditions_process_running.rb", "test/test_handlers_kqueue_handler.rb", "test/test_conditions_disk_usage.rb", "test/test_event_handler.rb", "test/test_driver.rb", "test/test_dependency_graph.rb", "test/test_metric.rb", "test/test_registry.rb", "test/test_behavior.rb", "test/test_socket.rb", "test/test_sugar.rb", "test/test_trigger.rb", "test/test_conditions_http_response_code.rb", "test/test_god.rb", "test/test_system_process.rb", "test/test_contact.rb"] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module God | ||
module Behaviors | ||
|
||
class CleanUnixSocket < Behavior | ||
def valid? | ||
valid = true | ||
valid &= complain("Attribute 'unix_socket' must be specified", self) if self.watch.unix_socket.nil? | ||
valid | ||
end | ||
|
||
def before_start | ||
File.delete(self.watch.unix_socket) | ||
|
||
"deleted unix socket" | ||
rescue | ||
"no unix socket to delete" | ||
end | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# To add Jabber notifications you must have xmpp4r gem installed. | ||
# Configure your watches like this: | ||
# | ||
# God::Contacts::Jabber.settings = { :jabber_id => 'sender@example.com', | ||
# :password => 'secret' } | ||
# God.contact(:jabber) do |c| | ||
# c.name = 'Tester' | ||
# c.jabber_id = 'receiver@example.com' | ||
# c.group = 'developers' | ||
# end | ||
|
||
module XMPP4R | ||
require 'rubygems' | ||
require 'xmpp4r' | ||
include Jabber | ||
end | ||
|
||
module God | ||
module Contacts | ||
class Jabber < Contact | ||
class << self | ||
attr_accessor :settings, :format | ||
end | ||
|
||
self.format = lambda do |message, priority, category, host| | ||
text = "Message: #{message}\n" | ||
text += "Host: #{host}\n" if host | ||
text += "Priority: #{priority}\n" if priority | ||
text += "Category: #{category}\n" if category | ||
return text | ||
end | ||
|
||
attr_accessor :jabber_id | ||
|
||
def valid? | ||
valid = true | ||
end | ||
|
||
def notify(message, time, priority, category, host) | ||
begin | ||
jabber_id = XMPP4R::JID::new "#{Jabber.settings[:jabber_id]}/God" | ||
jabber_client = XMPP4R::Client::new jabber_id | ||
jabber_client.connect | ||
jabber_client.auth Jabber.settings[:password] | ||
|
||
body = Jabber.format.call message, priority, category, host | ||
|
||
message = XMPP4R::Message::new self.jabber_id, body | ||
message.set_type :normal | ||
message.set_id '1' | ||
message.set_subject 'God' | ||
jabber_client.send message | ||
|
||
self.info = "sent jabber message to #{self.jabber_id}" | ||
rescue => e | ||
puts e.message | ||
puts e.backtrace.join("\n") | ||
|
||
self.info = "failed to send jabber message to #{self.jabber_id}: #{e.message}" | ||
end | ||
end | ||
end | ||
|
||
end | ||
end |
Oops, something went wrong.