sensu-plugins-couchbase 0.1.0 → 0.2.0

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: 5aab37121a62f6578b8f1b3b4111a19d76afffb7
4
- data.tar.gz: e3fc6a269e5ff21b9595e56799d64df095c02579
3
+ metadata.gz: 0a03979385618140b020f45ce9cbe125f3027c7b
4
+ data.tar.gz: 9508376bc031b21d27c90138c5e77eccde015746
5
5
  SHA512:
6
- metadata.gz: 6f70878045a20540a290b1d48f50aa1026cda5e3f4f594514ca1c06345b99e6858afa9feea62526f707b919183e1abe098833158a94614f92c82a6c0e330ff15
7
- data.tar.gz: c735ec7f613d60827a74a3564929a0bb98672ab08446913af9e9b7ce1a4d893e786d687e29e1f89e449264c8d1fd0e9b0f6e409132f6e4b590bc51f70c0ca67a
6
+ metadata.gz: d06f86f523f0d683cd7e8e58c2403a1c0375e81239f380ab97627f6962ece865239642430de5b9c5465028c2ebd7891438986abe054675f7467cf2d48ad55607
7
+ data.tar.gz: a81521eedd800f106b54e00ad907e9a7db77b1c1978333c741448aa79e4efcdecef35da30be2df3897e72a7abd2b0f4cd79a12d35d3d05fa392a1852eb662e0a
checksums.yaml.gz.sig CHANGED
@@ -1 +1,3 @@
1
- Ns<Z����y×� \���4���t��CA���1�S�`M�R ��ȉQ�b��ףf�Y薊�ĎsK��n��dI��hNm��p��L�g��\(� ���Y��m�[)T ,�9��պuБ�O&}0t��(E�i�Q������������ڵ����$~�� ��I����E�)�Z�����Oqn|�.4b5�Ѹ� Ɲ�j�3^Glg8�2�-P�_��f�vy���)5ŃR�ïZ"���K:�sY��a�~
1
+ H @��)O�� ��oM��-��)�r*_���o0I
2
+ -C�d���^r�C
3
+ w��U��-�c���������Z����(������qb'
data/CHANGELOG.md CHANGED
@@ -5,7 +5,21 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## Unreleased
7
7
 
8
- ## 0.1.0 - 2015-08-11
8
+ ## [0.2.0] - 2015-11-20
9
+ ### Added
10
+ - add couchbase cluster check
11
+ - add couchbase bucket replica check
12
+ - metrics-couchbase.py: add ep_cache_miss_rate metric
13
+
14
+ ### Changed
15
+ - Switched to rest-client
16
+
17
+ ### Fixed
18
+ - check-couchbase-bucket-quota.rb: Fixed issue when only last bucket was shown in the output and/or check stopped on
19
+ the first problem found
20
+
21
+
22
+ ## [0.1.0] - 2015-08-11
9
23
  ### Added
10
24
  - add metrics-couchbase.py plugin (requires python requests,DNS modules)
11
25
 
@@ -26,7 +40,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
26
40
  ### Added
27
41
  - initial release
28
42
 
29
- [unreleased]: https://github.com/sensu-plugins/sensu-plugins-ssl/compare/0.1.0...HEAD
30
- [0.1.0]: https://github.com/sensu-plugins/sensu-plugins-ssl/compare/0.0.3...0.1.0
31
- [0.0.3]: https://github.com/sensu-plugins/sensu-plugins-ssl/compare/0.0.2...0.0.3
32
- [0.0.2]: https://github.com/sensu-plugins/sensu-plugins-ssl/compare/0.0.1...0.0.2
43
+ [unreleased]: https://github.com/sensu-plugins/sensu-plugins-couchbase/compare/0.2.0...HEAD
44
+ [0.2.0]: https://github.com/sensu-plugins/sensu-plugins-couchbase/compare/0.1.0...0.2.0
45
+ [0.1.0]: https://github.com/sensu-plugins/sensu-plugins-couchbase/compare/0.0.3...0.1.0
46
+ [0.0.3]: https://github.com/sensu-plugins/sensu-plugins-couchbase/compare/0.0.2...0.0.3
47
+ [0.0.2]: https://github.com/sensu-plugins/sensu-plugins-couchbase/compare/0.0.1...0.0.2
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Sensu-Plugins-couchbase
2
2
 
3
- [ ![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-couchbase.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-conntrack)
3
+ [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-couchbase.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-conntrack)
4
4
  [![Gem Version](https://badge.fury.io/rb/sensu-plugins-conntrack.svg)](http://badge.fury.io/rb/sensu-plugins-conntrack)
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-conntrack/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-conntrack)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-conntrack/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-conntrack)
@@ -11,6 +11,8 @@
11
11
 
12
12
  ## Files
13
13
  * bin/check-couchbase-bucket-quota.rb
14
+ * bin/check-couchbase-bucket-replica.rb
15
+ * bin/check-couchbase-cluster.rb
14
16
 
15
17
  ## Usage
16
18
 
@@ -30,7 +30,7 @@
30
30
  #
31
31
 
32
32
  require 'sensu-plugin/check/cli'
33
- require 'rest_client'
33
+ require 'rest-client'
34
34
  require 'json'
35
35
 
36
36
  #
@@ -97,14 +97,27 @@ class CheckCouchbase < Sensu::Plugin::Check::CLI
97
97
  unknown 'couchbase REST API returned invalid JSON'
98
98
  end
99
99
 
100
+ warning_found = false
101
+ critical_found = false
102
+
100
103
  results.each do |bucket|
101
104
  next if config[:bucket] && bucket[:name] != config[:bucket]
102
105
 
103
- message "Couchbase #{bucket[:name]} bucket quota usage is #{bucket[:basicStats][:quotaPercentUsed]}"
104
- critical if bucket[:basicStats][:quotaPercentUsed] > config[:crit]
105
- warning if bucket[:basicStats][:quotaPercentUsed] > config[:warn]
106
+ if bucket[:basicStats][:quotaPercentUsed] > config[:crit]
107
+ critical_found = true
108
+ status = 'CRITICAL'
109
+ elsif bucket[:basicStats][:quotaPercentUsed] > config[:warn]
110
+ warning_found = true
111
+ status = 'WARNING'
112
+ else
113
+ status = 'OK'
114
+ end
115
+
116
+ output "Couchbase #{bucket[:name]} bucket quota usage is #{bucket[:basicStats][:quotaPercentUsed]}: #{status}"
106
117
  end
107
118
 
119
+ critical if critical_found
120
+ warning if warning_found
108
121
  ok
109
122
  end
110
123
  end
@@ -0,0 +1,102 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # check-couchbase-bucket-replica
4
+ #
5
+ # DESCRIPTION:
6
+ # This plugin checks Couchbase bucket replication number.
7
+ #
8
+ # OUTPUT:
9
+ # plain text
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ # gem: rest-client
17
+ # Gem: json
18
+ #
19
+ # USAGE:
20
+ # check-couchbase-bucket-replica.rb -u admin -P secret -a http://<ip>:8091 -r 3
21
+ # check-couchbase-bucket-replica.rb -u admin -P secret -a http://<ip>:8091 -b superreplica -r 5
22
+ #
23
+ # NOTES:
24
+ # This plugin is tested against couchbase 3.0.x
25
+ #
26
+ # LICENSE:
27
+ # Copyright (c) 2015, Olivier Bazoud, olivier.bazoud@gmail.com
28
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
29
+ # for details.
30
+ #
31
+
32
+ require 'sensu-plugin/check/cli'
33
+ require 'rest-client'
34
+ require 'json'
35
+
36
+ #
37
+ # Check Couchbase
38
+ #
39
+ class CheckCouchbaseBucketReplica < Sensu::Plugin::Check::CLI
40
+ option :user,
41
+ description: 'Couchbase Admin Rest API auth username',
42
+ short: '-u USERNAME',
43
+ long: '--user USERNAME'
44
+
45
+ option :password,
46
+ description: 'Couchbase Admin Rest API auth password',
47
+ short: '-P PASSWORD',
48
+ long: '--password PASSWORD'
49
+
50
+ option :api,
51
+ description: 'Couchbase Admin Rest API base URL',
52
+ short: '-a URL',
53
+ long: '--api URL',
54
+ default: 'http://localhost:8091'
55
+
56
+ option :replica,
57
+ description: 'Replication number expected',
58
+ short: '-r REPLICA',
59
+ long: '--replica REPLICA',
60
+ proc: proc(&:to_f),
61
+ default: 1
62
+
63
+ option :bucket,
64
+ description: 'Bucket name, if ommited all buckets will be checked',
65
+ short: '-b BUCKET',
66
+ long: '--bucket BUCKET'
67
+
68
+ def run
69
+ begin
70
+ resource = '/pools/default/buckets'
71
+ response = RestClient::Request.new(
72
+ method: :get,
73
+ url: "#{config[:api]}/#{resource}",
74
+ user: config[:user],
75
+ password: config[:password],
76
+ headers: { accept: :json, content_type: :json }
77
+ ).execute
78
+ results = JSON.parse(response.to_str, symbolize_names: true)
79
+ rescue Errno::ECONNREFUSED
80
+ unknown 'Connection refused'
81
+ rescue RestClient::ResourceNotFound
82
+ unknown "Resource not found: #{resource}"
83
+ rescue RestClient::RequestFailed
84
+ unknown 'Request failed'
85
+ rescue RestClient::RequestTimeout
86
+ unknown 'Connection timed out'
87
+ rescue RestClient::Unauthorized
88
+ unknown 'Missing or incorrect Couchbase REST API credentials'
89
+ rescue JSON::ParserError
90
+ unknown 'couchbase REST API returned invalid JSON'
91
+ end
92
+
93
+ results.each do |bucket|
94
+ next if config[:bucket] && bucket[:name] != config[:bucket]
95
+
96
+ message "Couchbase #{bucket[:name]} bucket replica number is #{bucket[:replicaNumber]}"
97
+ critical if bucket[:replicaNumber] != config[:replica]
98
+ end
99
+
100
+ ok "Couchbase buckets replica number is #{config[:replica]}"
101
+ end
102
+ end
@@ -0,0 +1,111 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # check-couchbase-cluster
4
+ #
5
+ # DESCRIPTION:
6
+ # This plugin checks Couchbase cluster.
7
+ #
8
+ # OUTPUT:
9
+ # plain text
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ # gem: rest-client
17
+ # Gem: json
18
+ #
19
+ # USAGE:
20
+ # check-couchbase-cluster.rb -u admin -P secret -a http://<ip>:8091 -c 12
21
+ #
22
+ # NOTES:
23
+ # This plugin is tested against couchbase 3.0.1
24
+ #
25
+ # LICENSE:
26
+ # Copyright (c) 2015, Olivier Bazoud, olivier.bazoud@gmail.com
27
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
28
+ # for details.
29
+ #
30
+
31
+ require 'sensu-plugin/check/cli'
32
+ require 'rest-client'
33
+ require 'json'
34
+
35
+ #
36
+ # Check Couchbase cluster
37
+ #
38
+ class CheckCouchbaseCluster < Sensu::Plugin::Check::CLI
39
+ option :user,
40
+ description: 'Couchbase Admin Rest API auth username',
41
+ short: '-u USERNAME',
42
+ long: '--user USERNAME'
43
+
44
+ option :password,
45
+ description: 'Couchbase Admin Rest API auth password',
46
+ short: '-P PASSWORD',
47
+ long: '--password PASSWORD'
48
+
49
+ option :api,
50
+ description: 'Couchbase Admin Rest API base URL',
51
+ short: '-a URL',
52
+ long: '--api URL',
53
+ default: 'http://localhost:8091'
54
+
55
+ option :cluster_size,
56
+ description: 'Cluster size expected',
57
+ short: '-c CLUSTER_SIZE',
58
+ long: '--cluster-size CLUSTER_SIZE',
59
+ proc: proc(&:to_f)
60
+
61
+ option :couchbase_version,
62
+ description: 'Couchbase version expected',
63
+ short: '-v VERSION',
64
+ long: '--version VERSION',
65
+ proc: proc(&:to_f)
66
+
67
+ def run
68
+ begin
69
+ resource = '/pools/nodes'
70
+ response = RestClient::Request.execute(
71
+ method: :get,
72
+ url: "#{config[:api]}/#{resource}",
73
+ user: config[:user],
74
+ password: config[:password],
75
+ headers: { accept: :json, content_type: :json }
76
+ )
77
+ results = JSON.parse(response.to_str, symbolize_names: true)
78
+ rescue Errno::ECONNREFUSED
79
+ unknown 'Connection refused'
80
+ rescue RestClient::ResourceNotFound
81
+ unknown "Resource not found: #{resource}"
82
+ rescue RestClient::RequestFailed
83
+ unknown 'Request failed'
84
+ rescue RestClient::RequestTimeout
85
+ unknown 'Connection timed out'
86
+ rescue RestClient::Unauthorized
87
+ unknown 'Missing or incorrect Couchbase REST API credentials'
88
+ rescue JSON::ParserError
89
+ unknown 'couchbase REST API returned invalid JSON'
90
+ end
91
+
92
+ if config[:couchbase_version]
93
+ nodes_version = results[:nodes].select { |node| node[:version] != config[:couchbase_version] }
94
+ critical "Unexpected couchbase's version on nodes: #{nodes_version.map { |node| node[:hostname] }}" if nodes_version.size > 0
95
+ end
96
+
97
+ nodes_unhealthy = results[:nodes].select { |node| node[:status] != 'healthy' }
98
+ critical "These nodes are not 'healthy': #{nodes_unhealthy.map { |node| node[:hostname] }}" if nodes_unhealthy.size > 0
99
+
100
+ nodes_unactive = results[:nodes].select { |node| node[:clusterMembership] != 'active' }
101
+ critical "These nodes are not 'active' in the cluster: #{nodes_unactive.map { |node| node[:hostname] }}" if nodes_unactive.size > 0
102
+
103
+ critical "Cluster #{results[:alerts].size} alert(s)" if results[:alerts].size > 0
104
+
105
+ warning "Cluster rebalance status #{results[:rebalanceStatus]}" if results[:rebalanceStatus] != 'none'
106
+
107
+ critical "Cluster's size is #{results[:nodes].size}, #{config[:cluster_size]} expected" if results[:nodes].size != config[:cluster_size]
108
+
109
+ ok "Nodes: #{results[:nodes].size}"
110
+ end
111
+ end
@@ -54,6 +54,7 @@ PER_BUCKET_PER_NODE_STATS = [
54
54
  'ep_max_size',
55
55
  'ep_mem_high_wat',
56
56
  'ep_mem_low_wat',
57
+ 'ep_cache_miss_rate',
57
58
  'ep_tmp_oom_errors',
58
59
  'ep_queue_size',
59
60
  'incr_hits',
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsCouchbase
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 1
4
+ MINOR = 2
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- 2��W L����|k���?�Q��!�/Flc��3�*ߋ.�o��=wj7ox�������lj7��2��rP �Q@�7����t}U���hKP��߈��m��*.���0��6���%\]��ݒ-?N]A�d:��m��
1
+ ~G����[\ZbbMʧM��N��}��v��X�����ޤ�u�7�aPHĐ!�?��'��
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-couchbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu Plugins and contributors
@@ -30,22 +30,22 @@ cert_chain:
30
30
  8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
31
  HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
32
  -----END CERTIFICATE-----
33
- date: 2015-08-12 00:00:00.000000000 Z
33
+ date: 2015-11-20 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
- name: rest_client
36
+ name: rest-client
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 1.8.3
41
+ version: 1.8.0
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 1.8.3
48
+ version: 1.8.0
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: sensu-plugin
51
51
  requirement: !ruby/object:Gem::Requirement
@@ -189,6 +189,8 @@ dependencies:
189
189
  description: Sensu plugins for couchbase
190
190
  email: "<sensu-users@googlegroups.com>"
191
191
  executables:
192
+ - check-couchbase-cluster.rb
193
+ - check-couchbase-bucket-replica.rb
192
194
  - check-couchbase-bucket-quota.rb
193
195
  extensions: []
194
196
  extra_rdoc_files: []
@@ -197,6 +199,8 @@ files:
197
199
  - LICENSE
198
200
  - README.md
199
201
  - bin/check-couchbase-bucket-quota.rb
202
+ - bin/check-couchbase-bucket-replica.rb
203
+ - bin/check-couchbase-cluster.rb
200
204
  - bin/metrics-couchbase.py
201
205
  - lib/sensu-plugins-couchbase.rb
202
206
  - lib/sensu-plugins-couchbase/version.rb
metadata.gz.sig CHANGED
Binary file