god 0.7.19 → 0.7.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ == 0.7.20 / 2009-09-24
2
+ * Minor Enhancements
3
+ * Rewrite `god status` command to be not as horrible. Add ability to get
4
+ status for individual tasks.
5
+
1
6
  == 0.7.19 / 2009-09-21
2
7
  * Minor Enhancements
3
8
  * Teach `god status` to take a task name as a param and return
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 7
4
- :patch: 19
4
+ :patch: 20
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{god}
5
- s.version = "0.7.19"
5
+ s.version = "0.7.20"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Tom Preston-Werner"]
9
- s.date = %q{2009-09-21}
9
+ s.date = %q{2009-09-24}
10
10
  s.default_executable = %q{god}
11
11
  s.description = %q{God is an easy to configure, easy to extend monitoring framework written in Ruby.}
12
12
  s.email = %q{tom@mojombo.com}
@@ -66,46 +66,47 @@ module God
66
66
  end
67
67
 
68
68
  def status_command
69
- task = @args[1]
70
-
71
- watches = {}
72
- @server.status.each do |name, status|
69
+ exitcode = 0
70
+ statuses = @server.status
71
+ groups = {}
72
+ statuses.each do |name, status|
73
73
  g = status[:group] || ''
74
- unless watches.has_key?(g)
75
- watches[g] = {}
76
- end
77
- watches[g][name] = status
74
+ groups[g] ||= {}
75
+ groups[g][name] = status
78
76
  end
79
- if task
80
- failcount = 0
81
- if watches[task]
82
- puts "#{task}:"
83
- watches[task].keys.sort.each do |name|
84
- state = watches[task][name][:state]
85
- failcount += 1 if state != :up
86
- print " " unless task.empty?
87
- puts "#{name}: #{state}"
88
- end
89
- elsif watches['']
90
- watches[''].keys.sort.each do |name|
91
- state = watches[''][name][:state]
92
- failcount += 1 if state != :up
77
+
78
+ if item = @args[1]
79
+ if single = statuses[item]
80
+ # specified task (0 -> up, 1 -> unmonitored, 2 -> other)
81
+ state = single[:state]
82
+ puts "#{item}: #{state}"
83
+ exitcode = state == :up ? 0 : (state == :unmonitored ? 1 : 2)
84
+ elsif groups[item]
85
+ # specified group (0 -> up, N -> other)
86
+ puts "#{item}:"
87
+ groups[item].keys.sort.each do |name|
88
+ state = groups[item][name][:state]
89
+ print " "
93
90
  puts "#{name}: #{state}"
91
+ exitcode += 1 unless state == :up
94
92
  end
95
93
  else
96
- failcount = 1
94
+ puts "Task or Group '#{item}' not found."
95
+ exit(1)
97
96
  end
98
- exit!(failcount)
99
97
  else
100
- watches.keys.sort.each do |group|
98
+ # show all groups and watches
99
+ groups.keys.sort.each do |group|
101
100
  puts "#{group}:" unless group.empty?
102
- watches[group].keys.sort.each do |name|
103
- state = watches[group][name][:state]
101
+ groups[group].keys.sort.each do |name|
102
+ state = groups[group][name][:state]
104
103
  print " " unless group.empty?
105
104
  puts "#{name}: #{state}"
106
105
  end
107
106
  end
108
107
  end
108
+
109
+ exit(exitcode)
109
110
  end
110
111
 
111
112
  def signal_command
@@ -1,6 +1,6 @@
1
1
  God.watch do |w|
2
2
  w.name = 'child-polls'
3
- w.start = File.join(GOD_ROOT, *%w[test configs child_polls simple_server.rb]) + ' ' + ENV['RAILS_ENV']
3
+ w.start = File.join(GOD_ROOT, *%w[test configs child_polls simple_server.rb])
4
4
  w.interval = 5
5
5
  w.grace = 2
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: god
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.19
4
+ version: 0.7.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-21 00:00:00 -07:00
12
+ date: 2009-09-24 00:00:00 -07:00
13
13
  default_executable: god
14
14
  dependencies: []
15
15