spoonsix-dognotgod-client 0.1.2

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 (3) hide show
  1. data/bin/dognotgod-client +6 -0
  2. data/client.rb +69 -0
  3. metadata +62 -0
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+
4
+ DOGNOTGOD_DIR = "#{File.dirname(__FILE__)}/.."
5
+ Dir.chdir(DOGNOTGOD_DIR)
6
+ load 'client.rb'
data/client.rb ADDED
@@ -0,0 +1,69 @@
1
+ require 'rubygems'
2
+ require 'optparse'
3
+ require 'restclient'
4
+ require 'lib/base.rb'
5
+ require 'lib/client_commands.rb'
6
+
7
+ module DogNotGod
8
+
9
+ class Client
10
+
11
+ capture [:load_stats, :disk_stats, :memory_stats]
12
+
13
+ def initialize(argv)
14
+
15
+ @argv = argv
16
+
17
+ # Default options values
18
+ @options = {
19
+ :server_addr => "127.0.0.1",
20
+ :server_port => "4567",
21
+ :timeout => 10
22
+ }
23
+
24
+ parse!
25
+
26
+ @resource = RestClient::Resource.new("http://#{@options[:server_addr]}:#{@options[:server_port]}")
27
+ end
28
+
29
+ def parser
30
+ # NOTE: If you add an option here make sure the key in the +options+ hash is the
31
+ # same as the name of the command line option.
32
+ # +option+ keys are used to build the command line to launch other processes,
33
+ # see <tt>lib/thin/command.rb</tt>.
34
+ @parser ||= OptionParser.new do |opts|
35
+ opts.banner = "Usage: dognotgod-client [options]"
36
+ opts.separator ""
37
+ opts.separator "Server options:"
38
+
39
+ opts.on("-a", "--server-addr HOST", "HOST address to call (default: #{@options[:server_addr]})") { |host| @options[:server_addr] = host }
40
+ opts.on("-p", "--server-port PORT", "use PORT (default: #{@options[:server_port]})") { |port| @options[:server_port] = port.to_i }
41
+ #opts.on("-t", "--timeout SECONDS", "timeout after SECONDS (default: #{@options[:timeout]})") { |port| @options[:timeout] = port.to_i }
42
+ opts.separator ""
43
+ end
44
+ end
45
+
46
+ # Parse the options.
47
+ def parse!
48
+ parser.parse! @argv
49
+ @arguments = @argv
50
+ end
51
+
52
+ def run!
53
+
54
+ @@command_symbols.each do |command_name_symbol|
55
+ begin
56
+ command = DogNotGod::Commands.factory(command_name_symbol)
57
+ command.run!(@resource)
58
+ rescue
59
+ raise
60
+ end
61
+ end
62
+
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+
69
+ DogNotGod::Client.new(ARGV).run!
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spoonsix-dognotgod-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Luis Correa d'Almeida
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-04 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rest-client
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0.9"
24
+ version:
25
+ description: dog not god is a performance monitoring tool.
26
+ email: luis.ca@gmail.com
27
+ executables:
28
+ - dognotgod-client
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - client.rb
35
+ has_rdoc: false
36
+ homepage: http://github.com/spoonsix/dognotgod
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ requirements: []
55
+
56
+ rubyforge_project:
57
+ rubygems_version: 1.2.0
58
+ signing_key:
59
+ specification_version: 2
60
+ summary: dog not god is a performance monitoring tool.
61
+ test_files: []
62
+