sensu-plugins-mongodb 1.3.0 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66b2d5a053085a584cd966e891d11bbff8500999
4
- data.tar.gz: 19ae5997b3440b58fe9b60f96b31faa50e9ba503
3
+ metadata.gz: f5a4fa2fe0f52f7a107ccfec6ad768427c47d82f
4
+ data.tar.gz: 8524da816b927dd07165b164ce59eb78b7278ef6
5
5
  SHA512:
6
- metadata.gz: 34e01de3b9d4aa25022540fa4f6774d9e5a1a442323a7247f3c65de126512193210ed144268cf0c6d9c865ec1cd5e3a8176e9c2ae4f5c556120c61441489ee38
7
- data.tar.gz: 945d1d2cfe04f5f842b1109560a28af11ef0411fbadde16d8aa67833f2cfac242d97a19414c14b83af1c4aaff19cf889cd9468ed1fce27f715cdda4b1c3270cd
6
+ metadata.gz: 7687fb628e6535238a8696e074acdef4b63a82a2d6ec69816244504391ee69450bc0128b37752cff562435111b5240af27a151d35b202e25421afa599634260d
7
+ data.tar.gz: ff6611199f3c15b838d2bd1d51e91c455790b7df24e1ad5551c86fcd24b6d187b6a8842f3a3aa2439b48a57825e73d8a6bb02c3cfd6e4b0f7227542434cc42e8
@@ -5,12 +5,18 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
- ## [1.3.0]
8
+ ## [1.4.0] - 2017-09-05
9
+ ### Added
10
+ - Support for returning replicaset state metrics (@naemono)
11
+ - Tests covering returning replicaset state metrics (@naemono)
12
+ - Ruby 2.4.1 testing
13
+
14
+ ## [1.3.0] - 2017-05-22
9
15
  ### Added
10
16
  - Support for database size metrics (@naemono)
11
17
  - Tests covering returning database size metrics (@naemono)
12
18
 
13
- ## [1.2.2]
19
+ ## [1.2.2] - 2017-05-08
14
20
  ### Fixed
15
21
  - `check-mongodb.py`: will now correctly crit on connection issues (@majormoses)
16
22
  ## [1.2.1] - 2017-05-07
@@ -101,7 +107,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
101
107
  ### Added
102
108
  - initial release
103
109
 
104
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mongodb/compare/1.3.0...HEAD
110
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mongodb/compare/1.4.0...HEAD
111
+ [1.4.0]: https://github.com/sensu-plugins/sensu-plugins-mongodb/compare/1.3.0...1.4.0
105
112
  [1.3.0]: https://github.com/sensu-plugins/sensu-plugins-mongodb/compare/1.2.1...1.3.0
106
113
  [1.2.1]: https://github.com/sensu-plugins/sensu-plugins-mongodb/compare/1.2.0...1.2.1
107
114
  [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-mongodb/compare/1.1.0...1.2.0
@@ -88,12 +88,27 @@ module SensuPluginsMongoDB
88
88
  end
89
89
  end
90
90
 
91
+ # Fetches the replicaset status of the server (which includes the metrics).
92
+ #
93
+ # @return [Mash, nil] the document showing the replicaset status or nil.
94
+ def replicaset_status
95
+ status = get_mongo_doc('replSetGetStatus' => 1)
96
+ return nil if status.nil?
97
+ return status
98
+ rescue StandardError => e
99
+ if @debug
100
+ puts 'Error checking replSetGetStatus: ' + e.message
101
+ puts e.backtrace.inspect
102
+ end
103
+ end
104
+
91
105
  # Fetches metrics for the server we are connected to.
92
106
  #
93
107
  # @return [Mash] the metrics for the server.
94
108
  # rubocop:disable Metrics/AbcSize
95
109
  def server_metrics
96
110
  server_status = self.server_status
111
+ replicaset_status = self.replicaset_status
97
112
  server_metrics = {}
98
113
  # Handle versions like "2.6.11-pre" etc
99
114
  mongo_version = server_status['version'].gsub(/[^0-9\.]/i, '')
@@ -308,6 +323,12 @@ module SensuPluginsMongoDB
308
323
  server_metrics['metrics.repl.preload.indexes_num'] = repl['preload']['indexes']['num']
309
324
  server_metrics['metrics.repl.preload.indexes_totalMillis'] = repl['preload']['indexes']['totalMillis']
310
325
 
326
+ # Metrics (replicaset status)
327
+ # MongoDB will fail if not running with --replSet, hence the check for nil
328
+ unless replicaset_status.nil?
329
+ server_metrics['metrics.replicaset.state'] = replicaset_status['myState']
330
+ end
331
+
311
332
  # Metrics (storage)
312
333
  if Gem::Version.new(mongo_version) >= Gem::Version.new('2.6.0')
313
334
  freelist = server_status['metrics']['storage']['freelist']
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsMongoDB
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 3
4
+ MINOR = 4
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-mongodb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-22 00:00:00.000000000 Z
11
+ date: 2017-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bson
@@ -231,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
231
  version: '0'
232
232
  requirements: []
233
233
  rubyforge_project:
234
- rubygems_version: 2.4.5
234
+ rubygems_version: 2.6.13
235
235
  signing_key:
236
236
  specification_version: 4
237
237
  summary: Sensu plugins for mongodb