sensu-plugins-mongodb 1.1.0 → 1.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: fb4941553a69ae6bcca4130d5b4b0f70f275fbcc
4
- data.tar.gz: 78c8ea6169c2d1276add39c49fd61bcf524f1c3f
3
+ metadata.gz: cfca8c42b794ef56479c399a096978b10d28c9fd
4
+ data.tar.gz: 1f53b3e58ad977a97dc38a99146e475494d0d30c
5
5
  SHA512:
6
- metadata.gz: 831b34ee26b5e760745c3239a9e2ddcf2ff5141f0c95aecc4e6d1b797da08b05ad6b0631a69295433f4c6c3194df84e8f4ef503b22b2f078150350793737d02f
7
- data.tar.gz: d6ca2cdba45c44e292f39cff53cb1bdb8de6bb063acf76ed7b5a6b80f0b04f85a95e0764327d0dd4e0553330363584d8001b5c766e3c61415616e91d35f804a4
6
+ metadata.gz: 257b8f1ba57cdd72d14fdcbaac5c371cf5e4161a5d71a10c21c0ad4510f0ada59c854e30b0f0c5d991419e59f506bf0b6069367f53c09ae4f8d59f5d7cdf6f62
7
+ data.tar.gz: 4c29b0c300008462a2f086b1eb40574abac0beca10ae2e334772a901107811a4397b76cfaf76285464c45c174b808d1c4d3f66b08ef862ec5d8d868f517f6845
data/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.2.0] - 2017-03-06
9
+ ### Fixed
10
+ - `check-mongodb.py`: Set read preference for pymongo 2.2+ to fix 'General MongoDB Error: can't set attribute' (@boutetnico)
11
+ - `check-mongodb.py`: Fix mongo replication lag percent check showing password in plain text (@furbiesandbeans)
12
+ - `metrics-mongodb-replication.rb`: Sort replication members to ensure the primary is the first element (@gonzalo-radio)
13
+
14
+ ### Changed
15
+ - Update `mongo` gem to 2.4.1, which adds support for MongoDB 3.4 (@eheydrick)
16
+
8
17
  ## [1.1.0] - 2016-10-17
9
18
  ### Added
10
19
  - Inclusion of check-mongodb-metrics.rb to perform checks against the same data metrics-mongodb.rb produces. (@stefano-pogliani)
@@ -80,7 +89,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
80
89
  ### Added
81
90
  - initial release
82
91
 
83
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mongodb/compare/1.1.0...HEAD
92
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mongodb/compare/1.2.0...HEAD
93
+ [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-mongodb/compare/1.1.0...1.2.0
84
94
  [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-mongodb/compare/1.0.0...1.1.0
85
95
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-mongodb/compare/0.0.8...1.0.0
86
96
  [0.0.8]: https://github.com/sensu-plugins/sensu-plugins-mongodb/compare/0.0.7...0.0.8
data/bin/check-mongodb.py CHANGED
@@ -319,7 +319,9 @@ def exit_with_general_critical(e):
319
319
 
320
320
 
321
321
  def set_read_preference(db):
322
- if pymongo.version >= "2.1":
322
+ if pymongo.version >= "2.2":
323
+ pymongo.read_preferences.Secondary
324
+ else:
323
325
  db.read_preference = pymongo.ReadPreference.SECONDARY
324
326
 
325
327
 
@@ -425,7 +427,7 @@ def check_rep_lag(con, host, port, warning, critical, percent, perf_data, max_la
425
427
  data = data + member['name'] + " lag=%d;" % replicationLag
426
428
  maximal_lag = max(maximal_lag, replicationLag)
427
429
  if percent:
428
- err, con = mongo_connect(primary_node['name'].split(':')[0], int(primary_node['name'].split(':')[1]), False, user, passwd)
430
+ err, con = mongo_connect(primary_node['name'].split(':')[0], int(primary_node['name'].split(':')[1]), False, user=user, passwd=passwd)
429
431
  if err != 0:
430
432
  return err
431
433
  primary_timediff = replication_get_time_diff(con)
@@ -457,7 +459,7 @@ def check_rep_lag(con, host, port, warning, critical, percent, perf_data, max_la
457
459
  lag = float(optime_lag.seconds + optime_lag.days * 24 * 3600)
458
460
 
459
461
  if percent:
460
- err, con = mongo_connect(primary_node['name'].split(':')[0], int(primary_node['name'].split(':')[1]), False, user, passwd)
462
+ err, con = mongo_connect(primary_node['name'].split(':')[0], int(primary_node['name'].split(':')[1]), False, user=user, passwd=passwd)
461
463
  if err != 0:
462
464
  return err
463
465
  primary_timediff = replication_get_time_diff(con)
@@ -191,6 +191,13 @@ class MongoDB < Sensu::Plugin::Metric::CLI::Graphite
191
191
  metrics = {}
192
192
  replication_members = replication_status['members']
193
193
  unless replication_members.nil?
194
+ state_map = {
195
+ 'PRIMARY' => 1,
196
+ 'SECONDARY' => 2
197
+ }
198
+ state_map.default = 3
199
+ replication_members.sort! { |x, y| state_map[x['stateStr']] <=> state_map[y['stateStr']] }
200
+
194
201
  replication_members.each do |replication_member_details|
195
202
  metrics.update(gather_replication_member_metrics(replication_member_details))
196
203
  member_id = replication_member_details['_id']
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsMongoDB
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 1
4
+ MINOR = 2
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.1.0
4
+ version: 1.2.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: 2016-10-17 00:00:00.000000000 Z
11
+ date: 2017-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bson
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.2.2
33
+ version: 2.4.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.2.2
40
+ version: 2.4.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sensu-plugin
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -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.5.1
234
+ rubygems_version: 2.4.5
235
235
  signing_key:
236
236
  specification_version: 4
237
237
  summary: Sensu plugins for mongodb