sensu-plugins-mongodb 0.0.4 → 0.0.6

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: 4e2ab74c7f77a0bfdebcab9aa2e160bf99ccb103
4
- data.tar.gz: 77a732675fa8c87c4a4f38edd48f65ae8673b45a
3
+ metadata.gz: 0c77f96e9ed54c0ebae93b22ef9d2c3ba3b31f6c
4
+ data.tar.gz: af8a77dffb87f0e09221a0156b5ea0a93074d481
5
5
  SHA512:
6
- metadata.gz: 31fe971def9daa515971c56c7265fe9782c427c34c2fc22a81d8bab89f8efffcf274132ca4b6408663de629113eeea9301052e202e585d94ffcf24b48c3b84a3
7
- data.tar.gz: cd4b1c87c141a300083fcfc7339743ae4e728eef78c2cdada8ab6c5601ca7846514ab3434c026092f5dc99d2808b3b38f2cd71061de8e3613c9d945ebb7aae4c
6
+ metadata.gz: 09d393f5829685dd5c9fd9143af1f87b67c74e7d836e7608f9353cf09d6c90fffb1b3e79c01888d22fb64bc1d1917eb5b601527e3abb05f6c0b498fb131e5084
7
+ data.tar.gz: 4108df7689502003b4b00662e46508d08c913c90ab0f6bc2dddf07d5fe479e3a50f83164060323c21032480c84075faf27301aa7ae87d721e17e8a3537f03167
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## [0.0.6] - 2015-10-13
9
+ ### Fixed
10
+ - Rename option to avoid naming conflict with class variable name
11
+ - Add message for replica set state 9 (rollback)
12
+ - Installation fix
13
+
14
+ ## [0.0.5] - 2015-09-04
15
+ ### Fixed
16
+ - Fixed non ssl mongo connections
17
+
8
18
  ## [0.0.4] - 2015-08-12
9
19
  ### Changed
10
20
  - general gem cleanup
data/bin/check-mongodb.py CHANGED
@@ -152,7 +152,7 @@ def main(argv):
152
152
  p.add_option('-D', '--perf-data', action='store_true', dest='perf_data', default=False, help='Enable output of Nagios performance data')
153
153
  p.add_option('-d', '--database', action='store', dest='database', default='admin', help='Specify the database to check')
154
154
  p.add_option('--all-databases', action='store_true', dest='all_databases', default=False, help='Check all databases (action database_size)')
155
- p.add_option('-s', '--ssl', dest='ssl', default=False, action='callback', callback=optional_arg(True), help='Connect using SSL')
155
+ p.add_option('-s', '--ssl-enabled', dest='ssl_enabled', default=False, action='callback', callback=optional_arg(True), help='Connect using SSL')
156
156
  p.add_option('-r', '--replicaset', dest='replicaset', default=None, action='callback', callback=optional_arg(True), help='Connect to replicaset')
157
157
  p.add_option('-q', '--querytype', action='store', dest='query_type', default='query', help='The query type to check [query|insert|update|delete|getmore|command] from queries_per_second')
158
158
  p.add_option('-c', '--collection', action='store', dest='collection', default='admin', help='Specify the collection to check')
@@ -177,7 +177,7 @@ def main(argv):
177
177
  perf_data = options.perf_data
178
178
  max_lag = options.max_lag
179
179
  database = options.database
180
- ssl = options.ssl
180
+ ssl_enabled = options.ssl_enabled
181
181
  replicaset = options.replicaset
182
182
 
183
183
  if action == 'replica_primary' and replicaset is None:
@@ -189,7 +189,7 @@ def main(argv):
189
189
  # moving the login up here and passing in the connection
190
190
  #
191
191
  start = time.time()
192
- err, con = mongo_connect(host, port, ssl, user, passwd, replicaset)
192
+ err, con = mongo_connect(host, port, ssl_enabled, user, passwd, replicaset)
193
193
  if err != 0:
194
194
  return err
195
195
 
@@ -267,14 +267,14 @@ def main(argv):
267
267
  return check_connect(host, port, warning, critical, perf_data, user, passwd, conn_time)
268
268
 
269
269
 
270
- def mongo_connect(host=None, port=None, ssl=False, user=None, passwd=None, replica=None):
270
+ def mongo_connect(host=None, port=None, ssl_enabled=False, user=None, passwd=None, replica=None):
271
271
  try:
272
272
  # ssl connection for pymongo > 2.3
273
273
  if pymongo.version >= "2.3":
274
274
  if replica is None:
275
- con = pymongo.MongoClient(host, port, ssl=ssl)
275
+ con = pymongo.MongoClient(host, port, ssl=ssl_enabled)
276
276
  else:
277
- con = pymongo.Connection(host, port, read_preference=pymongo.ReadPreference.SECONDARY, ssl=ssl, replicaSet=replica, network_timeout=10)
277
+ con = pymongo.Connection(host, port, read_preference=pymongo.ReadPreference.SECONDARY, ssl=ssl_enabled, replicaSet=replica, network_timeout=10)
278
278
  else:
279
279
  if replica is None:
280
280
  con = pymongo.Connection(host, port, slave_okay=True, network_timeout=10)
@@ -700,7 +700,7 @@ def check_replset_state(con, perf_data, warning="", critical=""):
700
700
  try:
701
701
  warning = [int(x) for x in warning.split(",")]
702
702
  except:
703
- warning = [0, 3, 5]
703
+ warning = [0, 3, 5, 9]
704
704
  try:
705
705
  critical = [int(x) for x in critical.split(",")]
706
706
  except:
@@ -735,6 +735,8 @@ def check_replset_state(con, perf_data, warning="", critical=""):
735
735
  message = "State: %i (Secondary)" % state
736
736
  elif state == 7:
737
737
  message = "State: %i (Arbiter)" % state
738
+ elif state == 9:
739
+ message = "State: %i (Rollback)" % state
738
740
  elif state == -1:
739
741
  message = "Not running with replSet"
740
742
  else:
@@ -92,9 +92,9 @@ class MongoDB < Sensu::Plugin::Metric::CLI::Graphite
92
92
  end
93
93
  end
94
94
 
95
- def gather_replication_metrics(server_status) # rubocop:disable all
95
+ def gather_replication_metrics(server_status)
96
96
  server_metrics = {}
97
- server_metrics['lock.ratio'] = "#{sprintf('%.5f', server_status['globalLock']['ratio'])}" unless server_status['globalLock']['ratio'].nil? # rubocop:disable all
97
+ server_metrics['lock.ratio'] = "#{sprintf('%.5f', server_status['globalLock']['ratio'])}" unless server_status['globalLock']['ratio'].nil?
98
98
 
99
99
  server_metrics['lock.queue.total'] = server_status['globalLock']['currentQueue']['total']
100
100
  server_metrics['lock.queue.readers'] = server_status['globalLock']['currentQueue']['readers']
@@ -104,11 +104,11 @@ class MongoDB < Sensu::Plugin::Metric::CLI::Graphite
104
104
  server_metrics['connections.available'] = server_status['connections']['available']
105
105
 
106
106
  if server_status['indexCounters']['btree'].nil?
107
- server_metrics['indexes.missRatio'] = "#{sprintf('%.5f', server_status['indexCounters']['missRatio'])}" # rubocop:disable all
107
+ server_metrics['indexes.missRatio'] = "#{sprintf('%.5f', server_status['indexCounters']['missRatio'])}"
108
108
  server_metrics['indexes.hits'] = server_status['indexCounters']['hits']
109
109
  server_metrics['indexes.misses'] = server_status['indexCounters']['misses']
110
110
  else
111
- server_metrics['indexes.missRatio'] = "#{sprintf('%.5f', server_status['indexCounters']['btree']['missRatio'])}" # rubocop:disable all
111
+ server_metrics['indexes.missRatio'] = "#{sprintf('%.5f', server_status['indexCounters']['btree']['missRatio'])}"
112
112
  server_metrics['indexes.hits'] = server_status['indexCounters']['btree']['hits']
113
113
  server_metrics['indexes.misses'] = server_status['indexCounters']['btree']['misses']
114
114
  end
@@ -2,7 +2,7 @@ module SensuPluginsMongoDB
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 4
5
+ PATCH = 6
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-mongodb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
@@ -30,7 +30,7 @@ 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-10-13 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: bson
@@ -224,6 +224,7 @@ description: |-
224
224
  email: "<sensu-users@googlegroups.com>"
225
225
  executables:
226
226
  - metrics-mongodb.rb
227
+ - check-mongodb.py
227
228
  extensions: []
228
229
  extra_rdoc_files: []
229
230
  files:
metadata.gz.sig CHANGED
Binary file