cephdetail 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +5 -1
- data/LICENSE.txt +1 -1
- data/README.md +31 -4
- data/cephdetail.gemspec +9 -1
- data/lib/cephdetail/version.rb +1 -1
- data/lib/cephdetail.rb +19 -2
- metadata +47 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ceee182aa8069023fbfc0b1e49781011ebe956ab
|
|
4
|
+
data.tar.gz: a4ce7cb5e50d0e10121f97d54847a03c4a0f62b6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75df302e460aeb2f68e8356640482577346fd16d49b220e3e3844c27a5e2bcfa836aa63a06989c0cf63358017c635843fcc0c078c753d1b8027c3b80f2738e34
|
|
7
|
+
data.tar.gz: 158f2b9ff8459b93344f332d6317c22e36fba15b5168cfcb85f96dbbcb0ff73976a413f619508880d5bd103190129d2f1ff9be2649958cc269c5c9947f8eab8d
|
data/.travis.yml
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Cephdetail
|
|
2
2
|
|
|
3
|
+
[](https://travis-ci.org/xnoder/cephdetail)
|
|
4
|
+
[](https://badge.fury.io/rb/cephdetail)
|
|
5
|
+
|
|
3
6
|
`Cephdetail` fetches Ceph capacity and monitoring data from the Ceph REST API, and returns the responses as
|
|
4
7
|
Ruby Hashes to be used in other code.
|
|
5
8
|
|
|
@@ -26,7 +29,7 @@ Or install it yourself as:
|
|
|
26
29
|
Using `cephdetail` is very straight forward. First though, you'll need an environment variable called
|
|
27
30
|
`CEPH_REST_API` so that the gem can find the URL of your WSGI service, such as `http://localhost:5000`.
|
|
28
31
|
|
|
29
|
-
Here's
|
|
32
|
+
Here's some examples on how to use the gem:
|
|
30
33
|
|
|
31
34
|
```ruby
|
|
32
35
|
require 'cephdetail'
|
|
@@ -35,7 +38,9 @@ health = Cephdetail::Health.new
|
|
|
35
38
|
|
|
36
39
|
df = health.df
|
|
37
40
|
status = health.status
|
|
41
|
+
cluster_health = health.cluster_health
|
|
38
42
|
osdstat = health.osdstat
|
|
43
|
+
osdperf = health.osdperf
|
|
39
44
|
```
|
|
40
45
|
|
|
41
46
|
What you get back are hashes constructed from the JSON returned by the API. The methods mock the following `ceph`
|
|
@@ -43,13 +48,33 @@ client commands:
|
|
|
43
48
|
|
|
44
49
|
* `df` = `ceph df`
|
|
45
50
|
* `status` = `ceph status`
|
|
51
|
+
* `cluster_health` = `ceph health detail`
|
|
46
52
|
* `osdstat` = `ceph osd stat`
|
|
53
|
+
* `osdperf` = `ceph osd perf`
|
|
54
|
+
|
|
55
|
+
### Notes on security
|
|
56
|
+
|
|
57
|
+
By default, when installing the Ceph REST API, there is no security. You use a `cephx` authentication key to authenticate
|
|
58
|
+
the API against your Ceph cluster, but insofar as the WSGI service is concerned, there's no authentication of
|
|
59
|
+
requests. In our environment, the VM that runs the Apache2 service that hosts the API service is buried deep within
|
|
60
|
+
our core network and protected by access lists and firewall rules limiting incoming to a handful of addresses. On the
|
|
61
|
+
surface, if you've hacked that far into my network, I'm screwed anyway, but figuring out some form of authentication
|
|
62
|
+
would definitely be a good idea. I'll also bake in support for using HTTPS and not plain old HTTP in coming versions.
|
|
63
|
+
|
|
64
|
+
The long and the short of it is this: the gem provides no mechanism for authentication as of `0.2.0`. This will be
|
|
65
|
+
baked into the gem in later releases, but for now, be aware that you are communicating with your Ceph API, and thus,
|
|
66
|
+
your cluster, using unauthenticated and unencrypted requests, and are encouraged to think and plan accordingly.
|
|
67
|
+
|
|
68
|
+
I'll only be updating this gem for PUT and POST paths when the above has been completed.
|
|
47
69
|
|
|
48
70
|
## Development
|
|
49
71
|
|
|
50
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can
|
|
72
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can
|
|
73
|
+
also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
51
74
|
|
|
52
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
|
75
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
|
76
|
+
version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
|
|
77
|
+
push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
53
78
|
|
|
54
79
|
## Contributing
|
|
55
80
|
|
|
@@ -58,5 +83,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/xnoder
|
|
|
58
83
|
|
|
59
84
|
## License
|
|
60
85
|
|
|
61
|
-
The gem is available as open source under the terms of the [MIT License
|
|
86
|
+
The gem is available as open source under the terms of the [MIT License (MIT)][1]
|
|
87
|
+
|
|
88
|
+
[1]: https://opensource.org/licenses/MIT
|
|
62
89
|
|
data/cephdetail.gemspec
CHANGED
|
@@ -19,9 +19,17 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
20
20
|
spec.require_paths = ['lib']
|
|
21
21
|
|
|
22
|
-
spec.
|
|
22
|
+
spec.required_ruby_version = '~> 2.0'
|
|
23
|
+
|
|
24
|
+
spec.add_runtime_dependency 'rest-client', '~> 1.8', '>= 1.8.0'
|
|
23
25
|
|
|
24
26
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
|
25
27
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
26
28
|
spec.add_development_dependency 'rspec'
|
|
29
|
+
spec.add_development_dependency 'webmock', '~> 1.21', '>= 1.21.0'
|
|
30
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '>= 0.4.8'
|
|
31
|
+
|
|
32
|
+
spec.requirements << 'A web server running the Ceph REST API.'
|
|
33
|
+
|
|
34
|
+
spec.post_install_message = 'Thank you for installing Cephdetail!'
|
|
27
35
|
end
|
data/lib/cephdetail/version.rb
CHANGED
data/lib/cephdetail.rb
CHANGED
|
@@ -19,7 +19,9 @@ module Cephdetail
|
|
|
19
19
|
# >> health = Cephdetail::Health.new
|
|
20
20
|
# >> df = health.df
|
|
21
21
|
# >> status = health.status
|
|
22
|
+
# >> cluster_health = health.cluster_health
|
|
22
23
|
# >> osdstat = health.osdstat
|
|
24
|
+
# >> osdperf = health.osdperf
|
|
23
25
|
|
|
24
26
|
class Health
|
|
25
27
|
|
|
@@ -42,19 +44,34 @@ module Cephdetail
|
|
|
42
44
|
return check("status")
|
|
43
45
|
end
|
|
44
46
|
|
|
47
|
+
# Return /health?detail data (ceph health detail) in the form of a Ruby Hash for manipulation by other code/applications.
|
|
48
|
+
# Uses the private check(attrib) method to make the HTTP request.
|
|
49
|
+
def cluster_health
|
|
50
|
+
return check("health?detail")
|
|
51
|
+
end
|
|
52
|
+
|
|
45
53
|
# Return /osd/stat data (ceph osd stat) in the form of a Ruby Hash for manipulation by other code/applications.
|
|
46
54
|
# Uses the private check(attrib) method to make the HTTP request.
|
|
47
55
|
def osdstat
|
|
48
56
|
return check("osd/stat")
|
|
49
57
|
end
|
|
50
58
|
|
|
59
|
+
# Return /osd/perf data (ceph osd perf) in the form of a Ruby Hash for manipulation by other code/applications.
|
|
60
|
+
# Uses the private check(attrib) method to make the HTTP request
|
|
61
|
+
def osdperf
|
|
62
|
+
return check("osd/perf")
|
|
63
|
+
end
|
|
64
|
+
|
|
51
65
|
private
|
|
52
66
|
|
|
53
67
|
# Send a request to the Ceph REST API and convert the response into a Ruby Hash.
|
|
54
68
|
def check(attrib)
|
|
55
69
|
url = "#{@api_url}/api/v0.1/#{attrib}"
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
begin
|
|
71
|
+
JSON.parse(RestClient.get "#{url}", { :accept => :json })
|
|
72
|
+
rescue => e
|
|
73
|
+
e.response
|
|
74
|
+
end
|
|
58
75
|
end
|
|
59
76
|
|
|
60
77
|
end
|
metadata
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cephdetail
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Paul Stevens
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-11-
|
|
11
|
+
date: 2015-11-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rest-client
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.8'
|
|
20
|
+
- - ">="
|
|
18
21
|
- !ruby/object:Gem::Version
|
|
19
22
|
version: 1.8.0
|
|
20
23
|
type: :runtime
|
|
@@ -22,6 +25,9 @@ dependencies:
|
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
24
27
|
- - "~>"
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '1.8'
|
|
30
|
+
- - ">="
|
|
25
31
|
- !ruby/object:Gem::Version
|
|
26
32
|
version: 1.8.0
|
|
27
33
|
- !ruby/object:Gem::Dependency
|
|
@@ -66,6 +72,40 @@ dependencies:
|
|
|
66
72
|
- - ">="
|
|
67
73
|
- !ruby/object:Gem::Version
|
|
68
74
|
version: '0'
|
|
75
|
+
- !ruby/object:Gem::Dependency
|
|
76
|
+
name: webmock
|
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '1.21'
|
|
82
|
+
- - ">="
|
|
83
|
+
- !ruby/object:Gem::Version
|
|
84
|
+
version: 1.21.0
|
|
85
|
+
type: :development
|
|
86
|
+
prerelease: false
|
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
88
|
+
requirements:
|
|
89
|
+
- - "~>"
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: '1.21'
|
|
92
|
+
- - ">="
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: 1.21.0
|
|
95
|
+
- !ruby/object:Gem::Dependency
|
|
96
|
+
name: codeclimate-test-reporter
|
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
|
98
|
+
requirements:
|
|
99
|
+
- - ">="
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: 0.4.8
|
|
102
|
+
type: :development
|
|
103
|
+
prerelease: false
|
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
+
requirements:
|
|
106
|
+
- - ">="
|
|
107
|
+
- !ruby/object:Gem::Version
|
|
108
|
+
version: 0.4.8
|
|
69
109
|
description: This gem relies on the presence of a Ceph REST API server to pull down
|
|
70
110
|
and parse health information for your Ceph cluster.
|
|
71
111
|
email:
|
|
@@ -88,21 +128,22 @@ homepage: https://github.com/xnoder/cephdetail
|
|
|
88
128
|
licenses:
|
|
89
129
|
- MIT
|
|
90
130
|
metadata: {}
|
|
91
|
-
post_install_message:
|
|
131
|
+
post_install_message: Thank you for installing Cephdetail!
|
|
92
132
|
rdoc_options: []
|
|
93
133
|
require_paths:
|
|
94
134
|
- lib
|
|
95
135
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
136
|
requirements:
|
|
97
|
-
- - "
|
|
137
|
+
- - "~>"
|
|
98
138
|
- !ruby/object:Gem::Version
|
|
99
|
-
version: '0'
|
|
139
|
+
version: '2.0'
|
|
100
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
141
|
requirements:
|
|
102
142
|
- - ">="
|
|
103
143
|
- !ruby/object:Gem::Version
|
|
104
144
|
version: '0'
|
|
105
|
-
requirements:
|
|
145
|
+
requirements:
|
|
146
|
+
- A web server running the Ceph REST API.
|
|
106
147
|
rubyforge_project:
|
|
107
148
|
rubygems_version: 2.4.5.1
|
|
108
149
|
signing_key:
|