Skip to content

Commit 36ef4f8

Browse files
grubernautJake Champlin
authored andcommitted
Update variable names and readme to new style
1 parent f36cfa2 commit 36ef4f8

File tree

3 files changed

+14
-51
lines changed

3 files changed

+14
-51
lines changed

plugins/inputs/mongodb/README.md

Lines changed: 10 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Error in input [mongodb]: not authorized on admin to execute command { serverSta
6969
- repl_lag (integer)
7070
- repl_queries_per_sec (integer)
7171
- repl_updates_per_sec (integer)
72+
- repl_oplog_window_sec (integer)
7273
- resident_megabytes (integer)
7374
- state (string)
7475
- total_available (integer)
@@ -92,35 +93,6 @@ Error in input [mongodb]: not authorized on admin to execute command { serverSta
9293
- wtcache_tracked_dirty_bytes (integer)
9394
- wtcache_worker_thread_evictingpages (integer)
9495

95-
The telegraf plugin collects mongodb stats exposed by serverStatus and few more
96-
and create a single measurement containing values e.g.
97-
* active_reads
98-
* active_writes
99-
* commands_per_sec
100-
* deletes_per_sec
101-
* flushes_per_sec
102-
* getmores_per_sec
103-
* inserts_per_sec
104-
* net_in_bytes
105-
* net_out_bytes
106-
* open_connections
107-
* percent_cache_dirty
108-
* percent_cache_used
109-
* queries_per_sec
110-
* queued_reads
111-
* queued_writes
112-
* resident_megabytes
113-
* updates_per_sec
114-
* vsize_megabytes
115-
* total_in_use
116-
* total_available
117-
* total_created
118-
* total_refreshing
119-
* ttl_deletes_per_sec
120-
* ttl_passes_per_sec
121-
* repl_lag
122-
* repl_oplog_window_s
123-
* jumbo_chunks (only if mongos or mongo config)
12496
- mongodb_db_stats
12597
- tags:
12698
- db_name
@@ -137,27 +109,18 @@ and create a single measurement containing values e.g.
137109
- storage_size (integer)
138110
- type (string)
139111

140-
If gather_db_stats is set to true, it will also collect per database stats exposed by db.stats()
141-
creating another measurement called mongodb_db_stats and containing values:
142-
* collections
143-
* objects
144-
* avg_obj_size
145-
* data_size
146-
* storage_size
147-
* num_extents
148-
* indexes
149-
* index_size
150-
* ok
151-
152-
If multiple shard hosts are found via the `shardConnPoolStats` command, it will also collect per-host shard stats exposed
153-
by `shardConnPoolStats` creating another measurement called `mongodb_shard_host_stats`, containing the following values:
154-
* in_use
155-
* available
156-
* created
157-
* refreshing
112+
- mongodb_shard_stats
113+
- tags:
114+
- hostname
115+
- fields:
116+
- in_use (integer)
117+
- available (integer)
118+
- created (integer)
119+
- refreshing (integer)
158120

159121
### Example Output:
160122
```
161123
mongodb,hostname=127.0.0.1:27017 active_reads=0i,active_writes=0i,commands_per_sec=6i,deletes_per_sec=0i,flushes_per_sec=0i,getmores_per_sec=1i,inserts_per_sec=0i,jumbo_chunks=0i,member_status="PRI",net_in_bytes=851i,net_out_bytes=23904i,open_connections=6i,percent_cache_dirty=0,percent_cache_used=0,queries_per_sec=2i,queued_reads=0i,queued_writes=0i,repl_commands_per_sec=0i,repl_deletes_per_sec=0i,repl_getmores_per_sec=0i,repl_inserts_per_sec=0i,repl_lag=0i,repl_queries_per_sec=0i,repl_updates_per_sec=0i,resident_megabytes=67i,state="PRIMARY",total_available=0i,total_created=0i,total_in_use=0i,total_refreshing=0i,ttl_deletes_per_sec=0i,ttl_passes_per_sec=0i,updates_per_sec=0i,vsize_megabytes=729i,wtcache_app_threads_page_read_count=4i,wtcache_app_threads_page_read_time=18i,wtcache_app_threads_page_write_count=6i,wtcache_bytes_read_into=10075i,wtcache_bytes_written_from=115711i,wtcache_current_bytes=86038i,wtcache_max_bytes_configured=1073741824i,wtcache_pages_evicted_by_app_thread=0i,wtcache_pages_queued_for_eviction=0i,wtcache_server_evicting_pages=0i,wtcache_tracked_dirty_bytes=0i,wtcache_worker_thread_evictingpages=0i 1522798796000000000
162124
mongodb_db_stats,db_name=local,hostname=127.0.0.1:27017 avg_obj_size=818.625,collections=5i,data_size=6549i,index_size=86016i,indexes=4i,num_extents=0i,objects=8i,ok=1i,storage_size=118784i,type="db_stat" 1522799074000000000
125+
mongodb_shard_stats,hostname=127.0.0.1:27017,in_use=3i,available=3i,created=4i,refreshing=0i 1522799074000000000
163126
```

plugins/inputs/mongodb/mongodb_data.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ func (d *MongodbData) flush(acc telegraf.Accumulator) {
204204
db.Fields = make(map[string]interface{})
205205
}
206206
for _, host := range d.ShardHostData {
207-
d.Tags["shard_host_name"] = host.Name
207+
d.Tags["hostname"] = host.Name
208208
acc.AddFields(
209-
"mongodb_shard_host_stats",
209+
"mongodb_shard_stats",
210210
host.Fields,
211211
d.Tags,
212212
d.StatLine.Time,

plugins/inputs/mongodb/mongodb_data_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ func TestAddShardHostStats(t *testing.T) {
146146
var hostsFound []string
147147
for host, _ := range hostStatLines {
148148
for key, _ := range ShardHostStats {
149-
assert.True(t, acc.HasInt64Field("mongodb_shard_host_stats", key))
149+
assert.True(t, acc.HasInt64Field("mongodb_shard_stats", key))
150150
}
151151

152-
assert.True(t, acc.HasTag("mongodb_shard_host_stats", "shard_host_name"))
152+
assert.True(t, acc.HasTag("mongodb_shard_stats", "hostname"))
153153
hostsFound = append(hostsFound, host)
154154
}
155155

0 commit comments

Comments
 (0)