-
Notifications
You must be signed in to change notification settings - Fork 0
/
mongoc-plugin.xml
382 lines (344 loc) · 13.9 KB
/
mongoc-plugin.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2011 Clarity Services, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Document : mongoc-plugin.xml
Author : Reid Morrison
Home Page : https://github.com/ClarityServices/hyperic-mongodb
Version : 1.0
Description:
Hyperic HQ Plug-in to monitor MongoDB Configuration Servers
-->
<!DOCTYPE plugin [
<!ENTITY process-metrics SYSTEM "/pdk/plugins/process-metrics.xml">
]>
<plugin>
<!-- Invoke mongo shell and extract serverStatus -->
<script name="hq-mongoc-stat">
<![CDATA[
#!/bin/bash
# Parameters: %hostname% %port% %username% %password%
# username and password are optional, but must be supplied if the
# mongo server has been secured
JAVA_SCRIPT=$(cat <<EOF
// Print BSON as name value pairs
function flattenBson(hash, prefix) {
for(key in hash) {
value = hash[key];
klass = Object.prototype.toString.call(value).slice(8, -1);
if(klass == "bson_object") {
flattenBson(value, prefix+"_"+key)
} else {
print(prefix+"_"+key+"="+value)
};
}
};
// Authenticate first if username was supplied
if (("$3" != "") && ("$3" != "%username%")) {
if (db.auth("$3", "$4") != 1) {
print("Failed to authenticate. Bad Credentials");
exit(-1);
}
}
status = db.serverStatus();
flattenBson(status, "serverStatus");
EOF
)
mongo --host $1 --port $2 --quiet admin --eval "$JAVA_SCRIPT"
]]>
</script>
<property name="SERVER_STATUS" value="exec:timeout=10,file=pdk/work/scripts/mongoc/hq-mongoc-stat,args=%hostname% %port% %username% %password%,exec=%exec%"/>
<filter name="template" value="${SERVER_STATUS}:${alias}"/>
<metrics name="MongoDB Utilization">
<metric name="Connections"
alias="serverStatus_connections_current"
category="UTILIZATION"
interval="300000"
indicator="true"/>
<metric name="Connections Available"
alias="serverStatus_connections_available"
interval="600000"
category="UTILIZATION"/>
<metric name="Uptime"
alias="serverStatus_uptime"
category="UTILIZATION"
interval="600000"
units="sec"/>
<!-- This metric is platform specific -->
<metric name="Page faults"
alias="serverStatus_extra_info_page_faults"
category="UTILIZATION"
collectionType="trendsup"
interval="300000"/>
</metrics>
<metrics name="MongoDB Network">
<metric name="Network In"
alias="serverStatus_network_bytesIn"
category="UTILIZATION"
collectionType="trendsup"
interval="300000"
units="B"/>
<metric name="Network Out"
alias="serverStatus_network_bytesOut"
category="UTILIZATION"
collectionType="trendsup"
interval="300000"
units="B"/>
<metric name="Network Requests"
alias="serverStatus_network_numRequests"
collectionType="trendsup"
interval="300000"
category="UTILIZATION"/>
</metrics>
<metrics name="MongoDB Memory">
<metric name="Mapped Memory"
alias="serverStatus_mem_mapped"
category="UTILIZATION"
indicator="true"
interval="300000"
units="MB"/>
<metric name="Virtual Memory Size"
alias="serverStatus_mem_virtual"
category="UTILIZATION"
indicator="true"
interval="300000"
units="MB"/>
<metric name="Resident Memory Size"
alias="serverStatus_mem_resident"
category="UTILIZATION"
indicator="true"
interval="300000"
units="MB"/>
</metrics>
<metrics name="MongoDB IO">
<!-- Operations -->
<metric name="Inserts"
alias="serverStatus_opcounters_insert"
category="THROUGHPUT"
collectionType="trendsup"
interval="300000"/>
<metric name="Queries"
alias="serverStatus_opcounters_query"
category="THROUGHPUT"
collectionType="trendsup"
interval="300000"/>
<metric name="Updates"
alias="serverStatus_opcounters_update"
category="THROUGHPUT"
collectionType="trendsup"
interval="300000"/>
<metric name="Deletes"
alias="serverStatus_opcounters_delete"
category="THROUGHPUT"
collectionType="trendsup"
interval="300000"/>
<metric name="Getmores"
alias="serverStatus_opcounters_getmore"
category="THROUGHPUT"
collectionType="trendsup"
interval="300000"/>
<metric name="Commands"
alias="serverStatus_opcounters_command"
category="THROUGHPUT"
collectionType="trendsup"
interval="300000"
indicator="true"/>
</metrics>
<metrics name="MongoDB Global Lock">
<metric name="Lock Time"
alias="serverStatus_globalLock_lockTime"
category="UTILIZATION"
collectionType="trendsup"
units="mu"
interval="300000"
indicator="true"/>
<metric name="Queued Requests"
alias="serverStatus_globalLock_currentQueue_total"
interval="300000"
category="UTILIZATION"
indicator="true"/>
<metric name="Queued Readers"
alias="serverStatus_globalLock_currentQueue_readers"
category="UTILIZATION"
interval="300000"/>
<metric name="Queued Writers"
alias="serverStatus_globalLock_currentQueue_writers"
category="UTILIZATION"
interval="300000"/>
<metric name="Active Clients"
alias="serverStatus_globalLock_activeClients_total"
interval="300000"
category="UTILIZATION"/>
<metric name="Active Readers"
alias="serverStatus_globalLock_activeClients_readers"
category="UTILIZATION"
interval="300000"/>
<metric name="Active Writers"
alias="serverStatus_globalLock_activeClients_writers"
category="UTILIZATION"
interval="300000"/>
</metrics>
<metrics name="MongoDB Index">
<metric name="Index Accesses"
alias="serverStatus_indexCounters_btree_accesses"
category="UTILIZATION"
interval="300000"
collectionType="trendsup"/>
<metric name="Index Hits"
alias="serverStatus_indexCounters_btree_hits"
category="UTILIZATION"
interval="300000"
collectionType="trendsup"/>
<metric name="Index Misses"
alias="serverStatus_indexCounters_btree_misses"
category="UTILIZATION"
collectionType="trendsup"
interval="300000"/>
<metric name="Index Resets"
alias="serverStatus_indexCounters_btree_resets"
category="UTILIZATION"
interval="300000"
collectionType="trendsup"/>
<metric name="Index Miss Ratio"
alias="serverStatus_indexCounters_btree_missRatio"
category="UTILIZATION"
interval="600000"
units="percentage"/>
</metrics>
<metrics name="MongoDB Cursors">
<metric name="Cursors"
alias="serverStatus_cursors_totalOpen"
interval="300000"
category="UTILIZATION"/>
<metric name="Cursors Size"
alias="serverStatus_cursors_clientCursors_size"
interval="300000"
category="UTILIZATION"/>
<metric name="Cursors Timed Out"
alias="serverStatus_cursors_timedOut"
category="UTILIZATION"
interval="300000"
collectionType="trendsup"/>
</metrics>
<metrics name="MongoDB Asserts">
<metric name="Asserts Regular"
alias="serverStatus_asserts_regular"
category="UTILIZATION"
interval="600000"
collectionType="trendsup"/>
<metric name="Asserts Warning"
alias="serverStatus_asserts_warning"
category="UTILIZATION"
interval="600000"
collectionType="trendsup"/>
<metric name="Asserts Msg"
alias="serverStatus_asserts_msg"
category="UTILIZATION"
interval="600000"
collectionType="trendsup"/>
<metric name="Asserts User"
alias="serverStatus_asserts_user"
category="UTILIZATION"
interval="600000"
collectionType="trendsup"/>
<metric name="Asserts Rollovers"
alias="serverStatus_asserts_rollovers"
category="UTILIZATION"
interval="600000"
collectionType="trendsup"/>
</metrics>
<metrics name="MongoDB Background Flushing">
<metric name="Flushes"
alias="serverStatus_backgroundFlushing_flushes"
category="UTILIZATION"
collectionType="trendsup"
interval="300000"/>
<metric name="Flush Duration"
alias="serverStatus_backgroundFlushing_total_ms"
category="UTILIZATION"
collectionType="trendsup"
interval="300000"
units="ms"/>
<metric name="Flush Average Duration"
alias="serverStatus_backgroundFlushing_average_ms"
category="UTILIZATION"
interval="600000"
units="ms"/>
<metric name="Flush Last Duration"
alias="serverStatus_backgroundFlushing_last_ms"
category="UTILIZATION"
interval="300000"
units="ms"/>
</metrics>
<metrics name="MongoDB Process Metrics">
<metric name="Process Cpu Usage"
template="sigar:Type=ProcCpu,Arg=%process.query%:Percent"
indicator="true"
interval="300000"
units="percentage"/>
</metrics>
<server name="MongoDB Config Server" version="2.x">
<property name="PROC_QUERY" value="State.Name.eq=mongod,Args.*.eq=/etc/mongoc.conf"/>
<property name="DEFAULT_CONFIG_FILE" value="/etc/mongoc.conf"/>
<property name="DEFAULT_LOG_FILE" value="/var/log/mongo/mongoc.log"/>
<property name="DEFAULT_PID_FILE" value="/var/run/mongo/mongoc.pid"/>
<config>
<option name="process.query"
description="PTQL for MongoDB Config Process"
default="${PROC_QUERY}"/>
<option name="hostname"
description="Usually leave as localhost"
default="localhost"/>
<option name="port"
description="MongoDB Config server port number"
type="int"
default="27019"/>
<option name="username"
description="User name [Only if MongoDB Authorization has been enabled]"
optional="true"
default=""/>
<option name="password"
description="Password [Only if MongoDB Authorization has been enabled]"
type="secret"
optional="true"
default=""/>
</config>
<!--notifies the plugin to auto-discover one instance of each service-->
<property name="HAS_BUILTIN_SERVICES" value="true"/>
<plugin type="autoinventory"
class="org.hyperic.hq.product.DaemonDetector"/>
<plugin type="measurement"
class="org.hyperic.hq.product.MeasurementPlugin"/>
<plugin type="config_track"
class="org.hyperic.hq.product.ConfigFileTrackPlugin"/>
<plugin type="log_track"
class="org.hyperic.hq.product.LogFileTailPlugin"/>
<metric name="Availability"
template="sigar:Type=ProcState,Arg=%process.query%:State"
category="AVAILABILITY"
indicator="true"/>
<metrics include="MongoDB Utilization"/>
<metrics include="MongoDB Process Metrics"/>
<metrics include="MongoDB Network"/>
<metrics include="MongoDB Memory"/>
<metrics include="MongoDB IO"/>
<metrics include="MongoDB Global Lock"/>
<metrics include="MongoDB Index"/>
<metrics include="MongoDB Cursors"/>
<metrics include="MongoDB Asserts"/>
<metrics include="MongoDB Background Flushing"/>
</server>
<help name="MongoDB Config Server">
Configure Hyperic for monitoring MongoDB.
The port for Mongodb config server is by default 27019, please change the port above if required.
For servers that have more than one MongoDB instance, update the port.
</help>
</plugin>