sensu-plugins-mongodb-boutetnico 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/metrics-mongodb-replication.rb +15 -30
- data/lib/sensu-plugins-mongodb/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20bd487d838baf2695377d4f9427abb2ab216b42
|
4
|
+
data.tar.gz: ba4b4e0e4d895b9f1df4c20dd598e1cf3df67ac9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6489d8a793494b7cccd8b141f6d1b0414764692149289a4bfb201af868fdf81106d77c0e0b48b8841524dd8d2d6d6b0147df3cd8c0f6dfcc3d9437951243f598
|
7
|
+
data.tar.gz: f1b84acd7d5a6afc1e0fac77d6612fb241a139b01b5448d61588a54a5cab8e69f8df34e5a0ac73dd50aaf6711bf532fb4cb210dc2515097e62a2bb0b507c7502
|
@@ -112,30 +112,23 @@ class MongoDB < Sensu::Plugin::Metric::CLI::Graphite
|
|
112
112
|
rs.documents[0]
|
113
113
|
end
|
114
114
|
|
115
|
-
# connects to mongo and sets @db, works with MongoClient < 2.0.0
|
116
115
|
def connect_mongo_db
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
client_opts[:ssl] = true
|
131
|
-
client_opts[:ssl_cert] = config[:ssl_cert]
|
132
|
-
client_opts[:ssl_key] = config[:ssl_key]
|
133
|
-
client_opts[:ssl_ca_cert] = config[:ssl_ca_cert]
|
134
|
-
client_opts[:ssl_verify] = config[:ssl_verify]
|
135
|
-
end
|
136
|
-
mongo_client = Mongo::Client.new([address_str], client_opts)
|
137
|
-
@db = mongo_client.database
|
116
|
+
address_str = "#{config[:host]}:#{config[:port]}"
|
117
|
+
client_opts = {}
|
118
|
+
client_opts[:database] = 'admin'
|
119
|
+
unless config[:user].nil?
|
120
|
+
client_opts[:user] = config[:user]
|
121
|
+
client_opts[:password] = config[:password]
|
122
|
+
end
|
123
|
+
if config[:ssl]
|
124
|
+
client_opts[:ssl] = true
|
125
|
+
client_opts[:ssl_cert] = config[:ssl_cert]
|
126
|
+
client_opts[:ssl_key] = config[:ssl_key]
|
127
|
+
client_opts[:ssl_ca_cert] = config[:ssl_ca_cert]
|
128
|
+
client_opts[:ssl_verify] = config[:ssl_verify]
|
138
129
|
end
|
130
|
+
mongo_client = Mongo::Client.new([address_str], client_opts)
|
131
|
+
@db = mongo_client.database
|
139
132
|
end
|
140
133
|
|
141
134
|
def run
|
@@ -225,8 +218,6 @@ class MongoDB < Sensu::Plugin::Metric::CLI::Graphite
|
|
225
218
|
def gather_replication_metrics(replication_status)
|
226
219
|
replication_metrics = {}
|
227
220
|
|
228
|
-
replication_metrics['replica_set'] = replication_status['set']
|
229
|
-
replication_metrics['date'] = replication_status['date']
|
230
221
|
replication_metrics['myState'] = replication_status['myState']
|
231
222
|
replication_metrics['term'] = replication_status['term']
|
232
223
|
replication_metrics['heartbeatIntervalMillis'] = replication_status['heartbeatIntervalMillis']
|
@@ -238,14 +229,11 @@ class MongoDB < Sensu::Plugin::Metric::CLI::Graphite
|
|
238
229
|
replication_member_metrics = {}
|
239
230
|
|
240
231
|
replication_member_metrics['id'] = replication_member_details['_id']
|
241
|
-
replication_member_metrics['name'] = replication_member_details['name']
|
242
232
|
replication_member_metrics['health'] = replication_member_details['health']
|
243
233
|
replication_member_metrics['state'] = replication_member_details['state']
|
244
|
-
replication_member_metrics['stateStr'] = replication_member_details['stateStr']
|
245
234
|
member_hierarchy = replication_member_details['stateStr']
|
246
235
|
if member_hierarchy == 'PRIMARY'
|
247
236
|
@primary_optime_date = replication_member_details['optimeDate']
|
248
|
-
replication_member_metrics['primary.startOptimeDate'] = @primary_optime_date
|
249
237
|
end
|
250
238
|
if member_hierarchy == 'SECONDARY'
|
251
239
|
@secondary_optime_date = replication_member_details['optimeDate']
|
@@ -256,12 +244,9 @@ class MongoDB < Sensu::Plugin::Metric::CLI::Graphite
|
|
256
244
|
replication_member_metrics['minutesBehindPrimary'] = difference_in_minutes
|
257
245
|
replication_member_metrics['hoursBehindPrimary'] = difference_in_hours
|
258
246
|
end
|
259
|
-
replication_member_metrics['optimeDate'] = replication_member_details['optimeDate']
|
260
247
|
replication_member_metrics['uptime'] = replication_member_details['uptime']
|
261
|
-
replication_member_metrics['lastHeartbeat'] = replication_member_details['lastHeartbeat']
|
262
248
|
replication_member_metrics['lastHeartbeatRecv'] = replication_member_details['lastHeartbeatiRecv']
|
263
249
|
replication_member_metrics['pingMs'] = replication_member_details['pingMs']
|
264
|
-
replication_member_metrics['syncingTo'] = replication_member_details['syncingTo']
|
265
250
|
replication_member_metrics['configVersion'] = replication_member_details['configVersion']
|
266
251
|
|
267
252
|
replication_member_metrics
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-mongodb-boutetnico
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
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: 2020-
|
11
|
+
date: 2020-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bson
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.
|
159
|
+
version: 0.93.1
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.
|
166
|
+
version: 0.93.1
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: yard
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -187,11 +187,11 @@ description: |-
|
|
187
187
|
more.
|
188
188
|
email: "<sensu-users@googlegroups.com>"
|
189
189
|
executables:
|
190
|
-
- check-mongodb.rb
|
191
190
|
- check-mongodb-query-count.rb
|
192
191
|
- metrics-mongodb.rb
|
193
|
-
- check-mongodb
|
192
|
+
- check-mongodb.rb
|
194
193
|
- metrics-mongodb-replication.rb
|
194
|
+
- check-mongodb-metric.rb
|
195
195
|
extensions: []
|
196
196
|
extra_rdoc_files: []
|
197
197
|
files:
|