check_graphite 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 603d1010785574e54ebb2353fd075ab503c17a96
4
- data.tar.gz: fd8419b57ca05f96d2606b6b585a1e733a910dd9
3
+ metadata.gz: 7313494817c203061b8c0e7627d477f7b3bf3f91
4
+ data.tar.gz: 13d5de392c193c0d646dc60b96f8b6c52a402d7b
5
5
  SHA512:
6
- metadata.gz: 0c8b40d62478a0be9fcea816746b1943b5b5b178ad39f73e96412354f7afd30c71ef832f6fef26f0c4e447ef4d11e61a9f1351bc13bbb6b8b5360f1bfb33a6ff
7
- data.tar.gz: 58e4a59d104d66124ef651ad802642beaaf7d30c44c9e83a6b96962d190c2c9e2f61d53d26ad44a3b0f6d8f213a0a059ab179f4b6c36f2283ec941ff156774dc
6
+ metadata.gz: 29a569254d2894eb67691e8afdf703b67d336de22847de90fdf2ee6a1a38746495252559da63bb86eddc18d3b50b2af4cd2819702b330f99b9ed4f40be442b9e
7
+ data.tar.gz: 2ff72eb649135308850acff80194dffb4cd0a0df7c0245c1cdc28dd2abae31965def2577f31ea78bb568a7f8998f7ebc314c3829665fbf0b3c66b888d6e64b81
@@ -1,3 +1,3 @@
1
1
  module CheckGraphite
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -37,7 +37,7 @@ module CheckGraphite
37
37
  raise "HTTP error code #{res.code}" unless res.code == "200"
38
38
  raise "no data returned for target" if res.body == "[]"
39
39
 
40
- datapoints = JSON(res.body).first["datapoints"]
40
+ datapoints = JSON(res.body).map { |e| e["datapoints"] }.reduce { |a, b| a + b }
41
41
  datapoints = datapoints.slice(
42
42
  options.dropfirst,
43
43
  (datapoints.size - options.dropfirst - options.droplast)
@@ -103,6 +103,21 @@ describe CheckGraphite::Command do
103
103
  end
104
104
  end
105
105
 
106
+ describe "when Graphite returns multiple targets" do
107
+ before do
108
+ FakeWeb.register_uri(:get, "http://your.graphite.host/render?target=collectd.somebox*.load.load.midterm&from=-30seconds&format=json",
109
+ :body => '[{"target": "collectd.somebox2.load.load.midterm", "datapoints": [[null, 1339512060], [null, 1339512120], [null, 1339512180], [null, 1339512240]]},{"target": "collectd.somebox1.load.load.midterm", "datapoints": [[1.0, 1339512060], [2.0, 1339512120], [6.0, 1339512180], [7.0, 1339512240]]}]',
110
+ :content_type => "application/json")
111
+ end
112
+
113
+ it "should return OK" do
114
+ ARGV = %w{ -H http://your.graphite.host/render -M collectd.somebox*.load.load.midterm }
115
+ c = CheckGraphite::Command.new
116
+ STDOUT.should_receive(:puts).with("OK: value=4.0|value=4.0;;;;")
117
+ lambda { c.run }.should raise_error SystemExit
118
+ end
119
+ end
120
+
106
121
  describe "it should make http requests with basic auth and return data" do
107
122
  before do
108
123
  FakeWeb.register_uri(:get, "http://baduser:badpass@your.graphite.host/render?target=collectd.somebox.load.load.midterm&from=-30seconds&format=json",
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: check_graphite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre-Yves Ritschard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-25 00:00:00.000000000 Z
11
+ date: 2014-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nagios_check
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: fakeweb
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: check values from a graphite server
@@ -74,8 +74,8 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - .gitignore
78
- - .travis.yml
77
+ - ".gitignore"
78
+ - ".travis.yml"
79
79
  - Gemfile
80
80
  - README.md
81
81
  - Rakefile
@@ -93,17 +93,17 @@ require_paths:
93
93
  - lib
94
94
  required_ruby_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  requirements: []
105
105
  rubyforge_project: check_graphite
106
- rubygems_version: 2.0.0
106
+ rubygems_version: 2.2.2
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: check_graphite