sensu-plugins-mongodb 1.2.1 → 1.2.2

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: 1b8bad3ad77f99f2e12beec51387e77d4a6e0dbd
4
- data.tar.gz: c913acc5d643e0c75a504d607cef1c3540a3e942
3
+ metadata.gz: adbff6eb2e9cf5561f9934b9d1adb3113271c7fe
4
+ data.tar.gz: 9a5736e402cfb088cb0b07bb03a72d810c3d0bac
5
5
  SHA512:
6
- metadata.gz: 7b1ae24ee41dc1215e1cf156f2027ee7a91b81e1564f3e75c0f3c1d5d235276afa135344d55838d827787a41befcde5ae34b2d4642e5dee7f54ac2a69db8211f
7
- data.tar.gz: 3b17c793a350956c2f152465ead044152305b0df706975a88cf570007e19eb3014afd27d28ae39c99892b6842e0db3ec58b4ae0cd6a988cc69a2831c6772a1b8
6
+ metadata.gz: f57055be8c51424806f80ba63bc784f0d2d5865cc182e22c8ab64767842cd59793cf798f2a53c80e715469b7e96e1330460eed2897619560287483e1f9058977
7
+ data.tar.gz: 3cf34b90f91e2996c35bc975d2c3767c51c777da775896e168ffa72c9a8ff21ae4f5ad71dba7248d144e0be82d1326bb638dd700b1d3d6dafc8cec1e2ccfc1d9
data/CHANGELOG.md CHANGED
@@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
6
  ## [Unreleased]
7
+ ## [1.2.2]
8
+ ### Fixed
9
+ - `check-mongodb.py`: will now correctly crit on connection issues (@majormoses)
7
10
  ## [1.2.1] - 2017-05-07
8
11
  ### Fixed
9
12
  - `check-mongodb.py`: fixed issue of param building with not/using ssl connections (@s-schweer)
data/bin/check-mongodb.py CHANGED
@@ -278,15 +278,21 @@ def mongo_connect(host=None, port=None, ssl_enabled=False, ssl_certfile=None, ss
278
278
  # ssl connection for pymongo > 2.3
279
279
  if pymongo.version >= "2.3":
280
280
  if replica is None:
281
- if ssl_enabled:
281
+ if ssl_enabled:
282
282
  con = pymongo.MongoClient(host, port, ssl=ssl_enabled, ssl_certfile=ssl_certfile, ssl_keyfile=ssl_keyfile, ssl_ca_certs=ssl_ca_certs)
283
- else:
283
+ else:
284
284
  con = pymongo.MongoClient(host, port)
285
285
  else:
286
- if ssl_enabled:
286
+ if ssl_enabled:
287
287
  con = pymongo.Connection(host, port, read_preference=pymongo.ReadPreference.SECONDARY, ssl=ssl_enabled, ssl_certfile=ssl_certfile, ssl_keyfile=ssl_keyfile, ssl_ca_certs=ssl_ca_certs, replicaSet=replica, network_timeout=10)
288
- else:
288
+ else:
289
289
  con = pymongo.Connection(host, port, read_preference=pymongo.ReadPreference.SECONDARY, replicaSet=replica, network_timeout=10)
290
+ try:
291
+ # https://api.mongodb.com/python/current/api/pymongo/mongo_client.html
292
+ # The ismaster command is cheap and does not require auth.
293
+ con.admin.command('ismaster', connectTimeoutMS=10000)
294
+ except Exception, e:
295
+ return exit_with_general_critical(e), None
290
296
  else:
291
297
  if replica is None:
292
298
  con = pymongo.Connection(host, port, slave_okay=True, network_timeout=10)
@@ -2,7 +2,7 @@ module SensuPluginsMongoDB
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 2
5
- PATCH = 1
5
+ PATCH = 2
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
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.2.1
4
+ version: 1.2.2
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-07 00:00:00.000000000 Z
11
+ date: 2017-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bson