monitoring-client 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -91,7 +91,7 @@ module Monitoring
91
91
  ].each do |expected_key|
92
92
  unless @config.has_key?(expected_key) &&
93
93
  !@config[expected_key].nil? &&
94
- !@config[expected_key].size > 0
94
+ @config[expected_key].size > 0
95
95
  die("Bad config at #{@config_fn}: "\
96
96
  "Expected #{expected_key} to exist and not be blank")
97
97
  end
@@ -163,9 +163,7 @@ module Monitoring
163
163
  end
164
164
 
165
165
  def post_samples(uri, samples)
166
- Timeout.timeout(3) do
167
- generic_http_post(uri, "/api/samples", nil, nil, { "samples" => samples.to_json })
168
- end
166
+ generic_http_post(uri, "/api/samples", nil, nil, 3, { "samples" => samples.to_json })
169
167
  rescue Timeout::Error => e
170
168
  STDOUT.puts("Could not post sample (will requeue): " + samples.inspect()) rescue nil
171
169
  STDERR.puts([[e.class.name, e.message].join(": "),
@@ -177,8 +175,10 @@ module Monitoring
177
175
  e.backtrace.join("\n")].join("\n")) rescue nil
178
176
  end
179
177
 
180
- def generic_http_post(uri, path, user, pass, post_params={}, &block)
178
+ def generic_http_post(uri, path, user, pass, timeout, post_params={}, &block)
181
179
  http = Net::HTTP.new(uri.host, uri.port)
180
+ http.open_timeout = timeout
181
+ http.read_timeout = timeout
182
182
  http.use_ssl = uri.is_a?(URI::HTTPS)
183
183
  req = Net::HTTP::Post.new(path)
184
184
  req.set_form_data(post_params)
@@ -1,5 +1,5 @@
1
1
  module Monitoring
2
2
  module Client
3
- VERSION = "0.2.5"
3
+ VERSION = "0.2.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,62 +1,48 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: monitoring-client
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.6
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 5
10
- version: 0.2.5
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Marc Bowes
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-08-30 00:00:00 +02:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-09-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: json
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &11494580 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rspec
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *11494580
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &11493980 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
47
33
  type: :development
48
- version_requirements: *id002
49
- description: Ruby client which uses UDP to communicate with a daemon which uses HTTP POST to communicate with a Web server
50
- email:
34
+ prerelease: false
35
+ version_requirements: *11493980
36
+ description: Ruby client which uses UDP to communicate with a daemon which uses HTTP
37
+ POST to communicate with a Web server
38
+ email:
51
39
  - marcbowes+monitoring+client@gmail.com
52
- executables:
40
+ executables:
53
41
  - monitor-system-info
54
42
  - monitoringd
55
43
  extensions: []
56
-
57
44
  extra_rdoc_files: []
58
-
59
- files:
45
+ files:
60
46
  - .gitignore
61
47
  - Gemfile
62
48
  - Gemfile.lock
@@ -75,42 +61,28 @@ files:
75
61
  - spec/config_spec.rb
76
62
  - spec/profiler_spec.rb
77
63
  - spec/spec_helper.rb
78
- has_rdoc: true
79
64
  homepage: http://rubygems.org/gems/monitoring-client
80
65
  licenses: []
81
-
82
66
  post_install_message:
83
67
  rdoc_options: []
84
-
85
- require_paths:
68
+ require_paths:
86
69
  - lib
87
- required_ruby_version: !ruby/object:Gem::Requirement
70
+ required_ruby_version: !ruby/object:Gem::Requirement
88
71
  none: false
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- hash: 3
93
- segments:
94
- - 0
95
- version: "0"
96
- required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
77
  none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
- version: "0"
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
105
82
  requirements: []
106
-
107
83
  rubyforge_project: monitoring-client
108
- rubygems_version: 1.6.2
84
+ rubygems_version: 1.8.5
109
85
  signing_key:
110
86
  specification_version: 3
111
87
  summary: Simple client & daemon to post metrics
112
- test_files:
113
- - spec/compiler_spec.rb
114
- - spec/config_spec.rb
115
- - spec/profiler_spec.rb
116
- - spec/spec_helper.rb
88
+ test_files: []