Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge tag 'v0.13.1' into mgroups

  • Loading branch information...
commit 475eab719958f055b0443ad833c50700ee6528a9 2 parents 147ec3e + b0257b3
@icy icy authored
View
12 History.txt
@@ -1,8 +1,16 @@
-== 0.12.1
+== 0.13.1 / 2012-09-18
+ * Minor Changes
+ * Prevent auto-loading from bundler by requiring $load_god to require (#97)
+
+== 0.13.0 / 2012-09-17
+ * Minor Changes
+ * Reduce verbosity of non-failing conditions (#111)
+
+== 0.12.1 / 2012-01-21
* Bug Fixes
* Fix undefined variable problem in CLI (#82)
-== 0.12.0
+== 0.12.0 / 2012-01-13
* Minor Enhancements
* Add umask support
* Add socket response condition (#25)
View
4 bin/god
@@ -4,7 +4,6 @@ STDOUT.sync = true
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
-require 'rubygems'
require 'optparse'
require 'drb'
require 'yaml'
@@ -105,6 +104,9 @@ begin
abort("Invalid log level '#{options[:log_level]}'")
end
+ # Use this flag to actually load all of the god infrastructure
+ $load_god = true
+
# dispatch
if !options[:config] && options[:version]
require 'god'
View
4 god.gemspec
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.name = 'god'
- s.version = '0.12.1'
- s.date = '2012-01-21'
+ s.version = '0.13.1'
+ s.date = '2012-09-18'
s.summary = "Process monitoring framework."
s.description = "An easy to configure, easy to extend monitoring framework written in Ruby."
View
12 lib/god.rb
@@ -1,4 +1,8 @@
-$:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
+# Bail out before loading anything unless this flag is set.
+#
+# We are doing this to guard against bundler autoloading because there is
+# no value in loading god in most processes.
+if $load_god
# core
require 'stringio'
@@ -151,7 +155,7 @@ def safe_attr_accessor(*args)
module God
# The String version number for this package.
- VERSION = '0.12.1'
+ VERSION = '0.13.1'
# The Integer number of lines of backlog to keep for the logger.
LOG_BUFFER_SIZE_DEFAULT = 100
@@ -726,7 +730,7 @@ def self.at_exit
# private
# Match a shortened pattern against a list of String candidates.
- # The pattern is expanded into a regular expression by
+ # The pattern is expanded into a regular expression by
# inserting .* between each character.
#
# pattern - The String containing the abbreviation.
@@ -756,3 +760,5 @@ def self.pattern_match(pattern, list)
at_exit do
God.at_exit if $run
end
+
+end
View
2  lib/god/conditions/cpu_usage.rb
@@ -63,6 +63,7 @@ def valid?
def test
process = System::Process.new(self.pid)
@timeline.push(process.percent_cpu)
+ self.info = []
history = "[" + @timeline.map { |x| "#{x > self.above ? '*' : ''}#{x}%%" }.join(", ") + "]"
@@ -70,7 +71,6 @@ def test
self.info = "cpu out of bounds #{history}"
return true
else
- self.info = "cpu within bounds #{history}"
return false
end
end
View
2  lib/god/conditions/disk_usage.rb
@@ -18,12 +18,12 @@ def valid?
end
def test
+ self.info = []
usage = `df -P | grep -i " #{self.mount_point}$" | awk '{print $5}' | sed 's/%//'`
if usage.to_i > self.above
self.info = "disk space out of bounds"
return true
else
- self.info = "disk space ok"
return false
end
end
View
2  lib/god/conditions/memory_usage.rb
@@ -65,6 +65,7 @@ def valid?
def test
process = System::Process.new(self.pid)
@timeline.push(process.memory)
+ self.info = []
history = "[" + @timeline.map { |x| "#{x > self.above ? '*' : ''}#{x}kb" }.join(", ") + "]"
@@ -72,7 +73,6 @@ def test
self.info = "memory out of bounds #{history}"
return true
else
- self.info = "memory within bounds #{history}"
return false
end
end
View
3  lib/god/conditions/process_running.rb
@@ -46,7 +46,6 @@ def test
active = pid && System::Process.new(pid).exists?
if (self.running && active)
- self.info.concat(["process is running"])
true
elsif (!self.running && !active)
self.info.concat(["process is not running"])
@@ -54,8 +53,6 @@ def test
else
if self.running
self.info.concat(["process is not running"])
- else
- self.info.concat(["process is running"])
end
false
end
View
2  lib/god/conditions/socket_responding.rb
@@ -102,6 +102,7 @@ def valid?
end
def test
+ self.info = []
if self.family == 'tcp'
begin
s = TCPSocket.new(self.addr, self.port)
@@ -123,7 +124,6 @@ def test
self.info = "socket out of bounds #{history}"
return true
else
- self.info = "socket within bounds #{history}"
return false
end
end
View
6 test/helper.rb
@@ -1,4 +1,8 @@
-require 'rubygems'
+$:.unshift File.expand_path('../../lib', __FILE__) # For use/testing when no gem is installed
+
+# Use this flag to actually load all of the god infrastructure
+$load_god = true
+
require File.join(File.dirname(__FILE__), *%w[.. lib god sys_logger])
require File.join(File.dirname(__FILE__), *%w[.. lib god])
God::EventHandler.load
Please sign in to comment.
Something went wrong with that request. Please try again.