sensu-plugins-ceph 0.0.4 → 0.0.5

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: 82da058290436a2a50ca288a5cce48691721c71b
4
- data.tar.gz: 9f267a9dfb46ed3e0364d6053b434b4cc0de7646
3
+ metadata.gz: 93a68877548d810e932c6d3b36e3746543d8e4f0
4
+ data.tar.gz: dca6658840c0ce6a28b41f648fe41b66f9625b18
5
5
  SHA512:
6
- metadata.gz: e43b4a99c9cf26dc0c933660761e3ab4df621ab1cf55b6a153af63c8480e5cbd47b44e32003cf37680c32d6f032f8d999f9262f2a242bcd0d59e69f053e6dc2b
7
- data.tar.gz: d6da11a682a38a33fae3188c5c5c618201f5470b1a198b911bfa03079a89d2a6ce0981b322eccfe0d3abf31833ab614bfab6e5b48e2dbcc1317a4fef816fbc8c
6
+ metadata.gz: 6443f403216c08bf5615bae0052fa075445602fb58bf38c4ba1fe4e1bc6543b2dee9018f35dd2f4536b877dbbfa3eaf065af79f2c990500dd29b5b7665c31878
7
+ data.tar.gz: 0b1b600d1f443758359e3b4b596951832fca9cbae83bcd3e3f8bd6b4b23e89bdbe97d127f2c71c48892d871a9046533ffe031d42db02226cddfebc18b2c0769c
@@ -1,2 +1 @@
1
- A1���W]J�����@��s��O���w��U��Ӗެ�@���1�'�t�>c!�V��������ңȆ�Kٻݴ$"�vp�E���|��zKT�����1������v��%��K�t�$Nu/ZOZy
2
- ��vi��b���hM�[+�C��`�z����P�m���Z���[[��2qbR��A����x�!��rU#K���qzZ �mke�M�6U�za~�sn�ޘYV��P�<v�SR�����eo�o|��>�ar'r�c
1
+ Q��O��B���oHcD��v>D�=+�-pYY��Ǘ޽H���ҫq�O����m����9尞œ���~��X���)|2gIH{�v
data.tar.gz.sig CHANGED
Binary file
@@ -6,6 +6,14 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
6
6
  ## Unreleased
7
7
  - nothing
8
8
 
9
+ ## [0.0.5] - 2015-11-26
10
+ ### Added
11
+ - include client name option when interacting with ceph
12
+ - metrics script
13
+ ### Fixes
14
+ - use upstram output
15
+ - default prefix includes hostname
16
+
9
17
  ## [0.0.4] - 2015-07-31
10
18
  ### Changed
11
19
  - updated documentation links
@@ -64,6 +64,12 @@ class CheckCephHealth < Sensu::Plugin::Check::CLI
64
64
  long: '--cluster',
65
65
  proc: proc { |c| " --cluster=#{c}" }
66
66
 
67
+ option :name,
68
+ description: 'Optional client name',
69
+ short: '-n NAME',
70
+ long: '--name',
71
+ proc: proc { |n| " --name=#{n}" }
72
+
67
73
  option :timeout,
68
74
  description: 'Timeout (default 10)',
69
75
  short: '-t SEC',
@@ -91,12 +97,13 @@ class CheckCephHealth < Sensu::Plugin::Check::CLI
91
97
  boolean: true,
92
98
  default: false
93
99
 
94
- def run_cmd(cmd) # rubocop:disable all
100
+ def run_cmd(cmd)
95
101
  pipe, status = nil
96
102
  begin
97
103
  cmd += config[:cluster] if config[:cluster]
98
104
  cmd += config[:keyring] if config[:keyring]
99
105
  cmd += config[:monitor] if config[:monitor]
106
+ cmd += config[:name] if config[:name]
100
107
  cmd += ' 2>&1'
101
108
  Timeout.timeout(config[:timeout]) do
102
109
  pipe = IO.popen(cmd)
@@ -136,7 +143,7 @@ class CheckCephHealth < Sensu::Plugin::Check::CLI
136
143
  end
137
144
  end
138
145
 
139
- def run # rubocop:disable all
146
+ def run
140
147
  result = check_ceph_health
141
148
  ok result if result.start_with?('HEALTH_OK')
142
149
 
@@ -68,9 +68,9 @@ class CephOsdMetrics < Sensu::Plugin::Metric::CLI::Graphite
68
68
  end
69
69
  end
70
70
 
71
- def run # rubocop:disable all
71
+ def run
72
72
  # #YELLOW
73
- Dir.glob(config[:pattern]).each do |socket| # rubocop:disable Style/Next
73
+ Dir.glob(config[:pattern]).each do |socket|
74
74
  data = `ceph --admin-daemon #{socket} perf dump`
75
75
  if $CHILD_STATUS.exitstatus == 0
76
76
  # Left side of wildcard
@@ -0,0 +1,117 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # metrics-ceph
4
+ #
5
+ # DESCRIPTION:
6
+ # Overall ceph throughput
7
+ #
8
+ # OUTPUT:
9
+ # metric data
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ # gem: english
17
+ # ceph client
18
+ #
19
+ # USAGE:
20
+ # #YELLOW
21
+ #
22
+ # NOTES:
23
+ # Runs 'ceph status' command to output cluster status and metrics,
24
+ # May need read access to ceph keyring and/or root access for
25
+ # authentication.
26
+ #
27
+ # LICENSE:
28
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
29
+ # for details.
30
+ #
31
+
32
+ require 'sensu-plugin/metric/cli'
33
+ require 'json'
34
+ require 'timeout'
35
+ require 'English'
36
+ require 'socket'
37
+
38
+ class CephMetrics < Sensu::Plugin::Metric::CLI::Graphite
39
+ option :keyring,
40
+ description: 'Path to cephx authentication keyring file',
41
+ short: '-k KEY',
42
+ long: '--keyring',
43
+ proc: proc { |k| " -k #{k}" }
44
+
45
+ option :monitor,
46
+ description: 'Optional monitor IP',
47
+ short: '-m MON',
48
+ long: '--monitor',
49
+ proc: proc { |m| " -m #{m}" }
50
+
51
+ option :cluster,
52
+ description: 'Optional cluster name',
53
+ short: '-c NAME',
54
+ long: '--cluster',
55
+ proc: proc { |c| " --cluster=#{c}" }
56
+
57
+ option :name,
58
+ description: 'Optional client name',
59
+ short: '-n NAME',
60
+ long: '--name',
61
+ proc: proc { |n| " --name=#{n}" }
62
+
63
+ option :timeout,
64
+ description: 'Timeout (default 10)',
65
+ short: '-t SEC',
66
+ long: '--timeout',
67
+ proc: proc(&:to_i),
68
+ default: 10
69
+
70
+ option :prefix,
71
+ description: 'Metric prefix',
72
+ short: '-p PREFIX',
73
+ long: '--prefix',
74
+ default: "#{Socket.gethostname}.ceph"
75
+
76
+ def run_cmd(cmd)
77
+ pipe, status = nil
78
+ begin
79
+ cmd += config[:cluster] if config[:cluster]
80
+ cmd += config[:keyring] if config[:keyring]
81
+ cmd += config[:monitor] if config[:monitor]
82
+ cmd += config[:name] if config[:name]
83
+ cmd += ' 2>&1'
84
+ Timeout.timeout(config[:timeout]) do
85
+ pipe = IO.popen(cmd)
86
+ Process.wait(pipe.pid)
87
+ status = $CHILD_STATUS.exitstatus
88
+ end
89
+ rescue Timeout::Error
90
+ begin
91
+ Process.kill(9, pipe.pid)
92
+ Process.wait(pipe.pid)
93
+ rescue Errno::ESRCH, Errno::EPERM
94
+ # Catch errors from trying to kill the timed-out process
95
+ # We must do something here to stop travis complaining
96
+ critical 'Execution timed out'
97
+ ensure
98
+ critical 'Execution timed out'
99
+ end
100
+ end
101
+ output = pipe.read
102
+ critical "Command '#{cmd}' returned no output" if output.to_s == ''
103
+ critical output unless status == 0
104
+ output
105
+ end
106
+
107
+ def run
108
+ result = run_cmd('ceph status --format=json')
109
+ data = JSON.parse(result)
110
+ ignore_keys = %w(pgs_by_state version)
111
+ timestamp = Time.now.to_i
112
+ data['pgmap'].each do |key, val|
113
+ output "#{config[:prefix]}.#{key}", val, timestamp unless ignore_keys.include? key
114
+ end
115
+ ok
116
+ end
117
+ end
@@ -2,7 +2,7 @@ module SensuPluginsCeph
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 4
5
+ PATCH = 5
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-ceph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu Plugins and contributors
@@ -30,7 +30,7 @@ cert_chain:
30
30
  8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
31
  HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
32
  -----END CERTIFICATE-----
33
- date: 2015-07-31 00:00:00.000000000 Z
33
+ date: 2015-11-26 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: english
@@ -189,6 +189,7 @@ dependencies:
189
189
  description: Sensu plugins for ceph
190
190
  email: "<sensu-users@googlegroups.com>"
191
191
  executables:
192
+ - metrics-ceph.rb
192
193
  - metrics-ceph-osd.rb
193
194
  - check-ceph.rb
194
195
  extensions: []
@@ -199,6 +200,7 @@ files:
199
200
  - README.md
200
201
  - bin/check-ceph.rb
201
202
  - bin/metrics-ceph-osd.rb
203
+ - bin/metrics-ceph.rb
202
204
  - lib/sensu-plugins-ceph.rb
203
205
  - lib/sensu-plugins-ceph/version.rb
204
206
  homepage: https://github.com/sensu-plugins/sensu-plugins-ceph
@@ -227,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
229
  version: '0'
228
230
  requirements: []
229
231
  rubyforge_project:
230
- rubygems_version: 2.4.6
232
+ rubygems_version: 2.4.8
231
233
  signing_key:
232
234
  specification_version: 4
233
235
  summary: Sensu plugins for ceph
metadata.gz.sig CHANGED
Binary file