sensu-plugins-mongodb-boutetnico 1.1.0 → 1.1.1

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: fa9b3240f7be758e7626dfcb72379e52d1e78cd9
4
- data.tar.gz: b98211137d85801c3f6c2cfc99115c89d60230ba
3
+ metadata.gz: ffc709ffc7e8052e326a4e74a4a4382039f07eb4
4
+ data.tar.gz: 5d4c88516eda7175370e534a68469a105ae02829
5
5
  SHA512:
6
- metadata.gz: a6b0bfb0215563fc0004e39aa40ec66bf0240b683430257dbb67e842fbb85b550816f60e98e1c647be5b926fbd46787521531f44ea7c4dbb69331d17d9093c74
7
- data.tar.gz: 8873f04c5b01a0d07a0eab49a1df659d0c4ec59ca337354ecfc27f933bb1b42e99007cbb0ccf9687e25b5f6bb2767f1c0d4cc035eba6f952800c26f835c16687
6
+ metadata.gz: 22bd4b61fca8b1665f2bf44650b082a9d25369c721e5d70e6a38778b1a17ef00539bdcbc6e653f10dec8eee251379b9abdd6dded4602c5e970d921b0591c8e6d
7
+ data.tar.gz: ef2f19166c6f4e633c20cfd99d45492cdddc5191724f4680bc6320e473f98905ccfe87ce9cec0560ad0775d6dffd7c92303d8248683f20392a06485c5e2b965e
@@ -152,7 +152,6 @@ def main(argv):
152
152
  p.add_option('-M', '--mongoversion', action='store', type='choice', dest='mongo_version', default='2', help='The MongoDB version you are talking with, either 2 or 3',
153
153
  choices=['2','3'])
154
154
  p.add_option('-a', '--authdb', action='store', type='string', dest='authdb', default='admin', help='The database you want to authenticate against')
155
- p.add_option('--insecure', action='store_true', dest='insecure', default=False, help="Don't verify SSL/TLS certificates")
156
155
  p.add_option('--ssl-ca-cert-file', action='store', type='string', dest='ssl_ca_cert_file', default=None, help='Path to Certificate Authority file for SSL')
157
156
  p.add_option('-f', '--ssl-cert-file', action='store', type='string', dest='cert_file', default=None, help='Path to PEM encoded key and cert for client authentication')
158
157
  p.add_option('-m','--auth-mechanism', action='store', type='choice', dest='auth_mechanism', default=None, help='Auth mechanism used for auth with mongodb',
@@ -184,7 +183,6 @@ def main(argv):
184
183
  database = options.database
185
184
  ssl = options.ssl
186
185
  replicaset = options.replicaset
187
- insecure = options.insecure
188
186
  ssl_ca_cert_file = options.ssl_ca_cert_file
189
187
  cert_file = options.cert_file
190
188
  auth_mechanism = options.auth_mechanism
@@ -198,7 +196,7 @@ def main(argv):
198
196
  # moving the login up here and passing in the connection
199
197
  #
200
198
  start = time.time()
201
- err, con = mongo_connect(host, port, ssl, user, passwd, replicaset, authdb, insecure, ssl_ca_cert_file, cert_file)
199
+ err, con = mongo_connect(host, port, ssl, user, passwd, replicaset, authdb, ssl_ca_cert_file, cert_file)
202
200
 
203
201
  if err != 0:
204
202
  return err
@@ -215,7 +213,7 @@ def main(argv):
215
213
  elif action == "replication_lag":
216
214
  return check_rep_lag(con, host_to_check, port_to_check, warning, critical, False, perf_data, max_lag, user, passwd)
217
215
  elif action == "replication_lag_percent":
218
- return check_rep_lag(con, host_to_check, port_to_check, warning, critical, True, perf_data, max_lag, user, passwd, ssl, insecure, ssl_ca_cert_file, cert_file)
216
+ return check_rep_lag(con, host_to_check, port_to_check, warning, critical, True, perf_data, max_lag, user, passwd, ssl, ssl_ca_cert_file, cert_file)
219
217
  elif action == "replset_state":
220
218
  return check_replset_state(con, perf_data, warning, critical)
221
219
  elif action == "memory":
@@ -285,18 +283,13 @@ def main(argv):
285
283
  return check_connect(host, port, warning, critical, perf_data, user, passwd, conn_time)
286
284
 
287
285
 
288
- def mongo_connect(host=None, port=None, ssl=False, user=None, passwd=None, replica=None, authdb="admin", insecure=False, ssl_ca_cert_file=None, ssl_cert=None, auth_mechanism=None):
286
+ def mongo_connect(host=None, port=None, ssl=False, user=None, passwd=None, replica=None, authdb="admin", ssl_ca_cert_file=None, ssl_cert=None, auth_mechanism=None):
289
287
  from pymongo.errors import ConnectionFailure
290
288
  from pymongo.errors import PyMongoError
291
- import ssl as SSL
292
289
 
293
290
  con_args = dict()
294
291
 
295
292
  if ssl:
296
- if insecure:
297
- con_args['ssl_cert_reqs'] = SSL.CERT_NONE
298
- else:
299
- con_args['ssl_cert_reqs'] = SSL.CERT_REQUIRED
300
293
  con_args['ssl'] = ssl
301
294
  if ssl_ca_cert_file:
302
295
  con_args['ssl_ca_certs'] = ssl_ca_cert_file
@@ -412,7 +405,7 @@ def check_connections(con, warning, critical, perf_data):
412
405
  return exit_with_general_critical(e)
413
406
 
414
407
 
415
- def check_rep_lag(con, host, port, warning, critical, percent, perf_data, max_lag, user, passwd, ssl=None, insecure=None, ssl_ca_cert_file=None, cert_file=None):
408
+ def check_rep_lag(con, host, port, warning, critical, percent, perf_data, max_lag, user, passwd, ssl=None, ssl_ca_cert_file=None, cert_file=None):
416
409
  # Get mongo to tell us replica set member name when connecting locally
417
410
  if "127.0.0.1" == host:
418
411
  if not "me" in list(con.admin.command("ismaster","1").keys()):
@@ -521,7 +514,7 @@ def check_rep_lag(con, host, port, warning, critical, percent, perf_data, max_la
521
514
  lag = float(optime_lag.seconds + optime_lag.days * 24 * 3600)
522
515
 
523
516
  if percent:
524
- err, con = mongo_connect(primary_node['name'].split(':')[0], int(primary_node['name'].split(':')[1]), ssl, user, passwd, None, None, insecure, ssl_ca_cert_file, cert_file)
517
+ err, con = mongo_connect(primary_node['name'].split(':')[0], int(primary_node['name'].split(':')[1]), ssl, user, passwd, None, None, ssl_ca_cert_file, cert_file)
525
518
  if err != 0:
526
519
  return err
527
520
  primary_timediff = replication_get_time_diff(con)
@@ -2,7 +2,7 @@ module SensuPluginsMongoDB
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
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-mongodb-boutetnico
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors