Skip to content

Commit

Permalink
Metricbeat: MongoDB collstats metricset (#5852)
Browse files Browse the repository at this point in the history
Add mongodb collstats metricset
  • Loading branch information
MerlinDMC authored and exekias committed Jan 8, 2018
1 parent 0fa5019 commit 1821662
Show file tree
Hide file tree
Showing 14 changed files with 671 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di
- Update gosigar to v0.6.0. {pull}5775[5775]
- Add experimental system/raid metricset. {pull}5642[5642]
- Add a dashboard for the Nginx module. {pull}5991[5991]
- Add experimental mongodb/collstats metricset. {pull}5852[5852]
- Update the MySQL dashboard to use the Time Series Visual Builder. {pull}5996[5996]

*Packetbeat*
Expand Down
176 changes: 176 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6459,6 +6459,182 @@ MongoDB metrics.
[float]
== collstats fields
MongoDB collection statistics metrics.
[float]
=== `mongodb.collstats.db`
type: keyword
Database name.
[float]
=== `mongodb.collstats.collection`
type: keyword
Collection name.
[float]
=== `mongodb.collstats.name`
type: keyword
Combination of database and collection name.
[float]
=== `mongodb.collstats.total.time`
type: long
Total waiting time for locks in microseconds.
[float]
=== `mongodb.collstats.total.count`
type: long
Total number of lock wait events.
[float]
=== `mongodb.collstats.lock.read.time.us`
type: long
Time waiting for read locks in microseconds.
[float]
=== `mongodb.collstats.lock.read.count`
type: long
Number of read lock wait events.
[float]
=== `mongodb.collstats.lock.write.time.us`
type: long
Time waiting for write locks in microseconds.
[float]
=== `mongodb.collstats.lock.write.count`
type: long
Number of write lock wait events.
[float]
=== `mongodb.collstats.queries.time.us`
type: long
Time running queries in microseconds.
[float]
=== `mongodb.collstats.queries.count`
type: long
Number of queries executed.
[float]
=== `mongodb.collstats.getmore.time.us`
type: long
Time asking for more cursor rows in microseconds.
[float]
=== `mongodb.collstats.getmore.count`
type: long
Number of times a cursor asked for more data.
[float]
=== `mongodb.collstats.insert.time.us`
type: long
Time inserting new documents in microseconds.
[float]
=== `mongodb.collstats.insert.count`
type: long
Number of document insert events.
[float]
=== `mongodb.collstats.update.time.us`
type: long
Time updating documents in microseconds.
[float]
=== `mongodb.collstats.update.count`
type: long
Number of document update events.
[float]
=== `mongodb.collstats.remove.time.us`
type: long
Time deleting documents in microseconds.
[float]
=== `mongodb.collstats.remove.count`
type: long
Number of document delete events.
[float]
=== `mongodb.collstats.commands.time.us`
type: long
Time executing database commands in microseconds.
[float]
=== `mongodb.collstats.commands.count`
type: long
Number of database commands executed.
[float]
== dbstats fields
Expand Down
4 changes: 4 additions & 0 deletions metricbeat/docs/modules/mongodb.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ metricbeat.modules:

The following metricsets are available:

* <<metricbeat-metricset-mongodb-collstats,collstats>>

* <<metricbeat-metricset-mongodb-dbstats,dbstats>>

* <<metricbeat-metricset-mongodb-status,status>>

include::mongodb/collstats.asciidoc[]

include::mongodb/dbstats.asciidoc[]

include::mongodb/status.asciidoc[]
Expand Down
23 changes: 23 additions & 0 deletions metricbeat/docs/modules/mongodb/collstats.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
////
This file is generated! See scripts/docs_collector.py
////

[[metricbeat-metricset-mongodb-collstats]]
=== MongoDB collstats metricset

experimental[]

include::../../../module/mongodb/collstats/_meta/docs.asciidoc[]


==== Fields

For a description of each field in the metricset, see the
<<exported-fields-mongodb,exported fields>> section.

Here is an example document generated by this metricset:

[source,json]
----
include::../../../module/mongodb/collstats/_meta/data.json[]
----
3 changes: 2 additions & 1 deletion metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ This file is generated! See scripts/docs_collector.py
|<<metricbeat-module-memcached,Memcached>> beta[] |
.1+| |<<metricbeat-metricset-memcached-stats,stats>> beta[]
|<<metricbeat-module-mongodb,MongoDB>> beta[] |
.2+| |<<metricbeat-metricset-mongodb-dbstats,dbstats>> beta[]
.3+| |<<metricbeat-metricset-mongodb-collstats,collstats>> experimental[]
|<<metricbeat-metricset-mongodb-dbstats,dbstats>> beta[]
|<<metricbeat-metricset-mongodb-status,status>> beta[]
|<<metricbeat-module-mysql,MySQL>> |
.1+| |<<metricbeat-metricset-mysql-status,status>>
Expand Down
1 change: 1 addition & 0 deletions metricbeat/include/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import (
_ "github.com/elastic/beats/metricbeat/module/memcached"
_ "github.com/elastic/beats/metricbeat/module/memcached/stats"
_ "github.com/elastic/beats/metricbeat/module/mongodb"
_ "github.com/elastic/beats/metricbeat/module/mongodb/collstats"
_ "github.com/elastic/beats/metricbeat/module/mongodb/dbstats"
_ "github.com/elastic/beats/metricbeat/module/mongodb/status"
_ "github.com/elastic/beats/metricbeat/module/mysql"
Expand Down
77 changes: 77 additions & 0 deletions metricbeat/module/mongodb/collstats/_meta/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"@timestamp": "2016-05-23T08:05:34.853Z",
"beat": {
"hostname": "beathost",
"name": "beathost"
},
"metricset": {
"host": "localhost",
"module": "mongodb",
"name": "collstats",
"rtt": 44269
},
"mongodb": {
"collstats": {
"db": "admin",
"collection": "system.users",
"name": "admin.system.users",
"total": {
"time": {
"us": 54756221
},
"count": 3159951
},
"lock": {
"read": {
"time": {
"us": 54747284
},
"count": 3159944
},
"write": {
"time": {
"us": 8937
},
"count": 7
}
},
"queries": {
"time": {
"us": 2310
},
"count": 15
},
"getmore": {
"time": {
"us": 0
},
"count": 0
},
"insert": {
"time": {
"us": 8937
},
"count": 7
},
"update": {
"time": {
"us": 0
},
"count": 0
},
"remove": {
"time": {
"us": 0
},
"count": 0
},
"commands": {
"time": {
"us": 50743698
},
"count": 45793
}
}
},
"type": "metricsets"
}
13 changes: 13 additions & 0 deletions metricbeat/module/mongodb/collstats/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This is the `collstats` metricset of the module mongodb.

It is using the `top` adminitrative command to return usage statistics for each collection. It provides the amount of time, in microseconds, used and a count of operations for the following types:

- total
- readLock
- writeLock
- queries
- getmore
- insert
- update
- remove
- commands
Loading

0 comments on commit 1821662

Please sign in to comment.