Modernize mongodb docs

This commit is contained in:
Daniel Nelson 2018-04-03 16:58:56 -07:00
parent 9c2bd062a8
commit ee94fd6a4e
2 changed files with 80 additions and 16 deletions

View File

@ -1,6 +1,6 @@
# Telegraf plugin: MongoDB # MongoDB Input Plugin
#### Configuration ### Configuration:
```toml ```toml
[[inputs.mongodb]] [[inputs.mongodb]]
@ -10,7 +10,9 @@
## mongodb://user:auth_key@10.10.3.30:27017, ## mongodb://user:auth_key@10.10.3.30:27017,
## mongodb://10.10.3.33:18832, ## mongodb://10.10.3.33:18832,
servers = ["mongodb://127.0.0.1:27017"] servers = ["mongodb://127.0.0.1:27017"]
gather_perdb_stats = false
## When true, collect per database stats
# gather_perdb_stats = false
## Optional SSL Config ## Optional SSL Config
# ssl_ca = "/etc/telegraf/ca.pem" # ssl_ca = "/etc/telegraf/ca.pem"
@ -27,7 +29,58 @@ command the you will get this error on telegraf
Error in input [mongodb]: not authorized on admin to execute command { serverStatus: 1, recordStats: 0 } Error in input [mongodb]: not authorized on admin to execute command { serverStatus: 1, recordStats: 0 }
``` ```
#### Description ### Metrics:
- mongodb
- tags:
- hostname
- fields:
- active_reads (integer)
- active_writes (integer)
- commands_per_sec (integer)
- deletes_per_sec (integer)
- flushes_per_sec (integer)
- getmores_per_sec (integer)
- inserts_per_sec (integer)
- jumbo_chunks (integer)
- member_status (string)
- net_in_bytes (integer)
- net_out_bytes (integer)
- open_connections (integer)
- percent_cache_dirty (float)
- percent_cache_used (float)
- queries_per_sec (integer)
- queued_reads (integer)
- queued_writes (integer)
- repl_commands_per_sec (integer)
- repl_deletes_per_sec (integer)
- repl_getmores_per_sec (integer)
- repl_inserts_per_sec (integer)
- repl_lag (integer)
- repl_queries_per_sec (integer)
- repl_updates_per_sec (integer)
- resident_megabytes (integer)
- state (string)
- total_available (integer)
- total_created (integer)
- total_in_use (integer)
- total_refreshing (integer)
- ttl_deletes_per_sec (integer)
- ttl_passes_per_sec (integer)
- updates_per_sec (integer)
- vsize_megabytes (integer)
- wtcache_app_threads_page_read_count (integer)
- wtcache_app_threads_page_read_time (integer)
- wtcache_app_threads_page_write_count (integer)
- wtcache_bytes_read_into (integer)
- wtcache_bytes_written_from (integer)
- wtcache_current_bytes (integer)
- wtcache_max_bytes_configured (integer)
- wtcache_pages_evicted_by_app_thread (integer)
- wtcache_pages_queued_for_eviction (integer)
- wtcache_server_evicting_pages (integer)
- wtcache_tracked_dirty_bytes (integer)
- wtcache_worker_thread_evictingpages (integer)
The telegraf plugin collects mongodb stats exposed by serverStatus and few more The telegraf plugin collects mongodb stats exposed by serverStatus and few more
and create a single measurement containing values e.g. and create a single measurement containing values e.g.
@ -58,15 +111,24 @@ and create a single measurement containing values e.g.
* repl_lag * repl_lag
* repl_oplog_window_s * repl_oplog_window_s
* jumbo_chunks (only if mongos or mongo config) * jumbo_chunks (only if mongos or mongo config)
- mongodb_db_stats
- tags:
- db_name
- hostname
- fields:
- avg_obj_size (float)
- collections (integer)
- data_size (integer)
- index_size (integer)
- indexes (integer)
- num_extents (integer)
- objects (integer)
- ok (integer)
- storage_size (integer)
- type (string)
If gather_db_stats is set to true, it will also collect per database stats exposed by db.stats() ### Example Output:
creating another measurement called mongodb_db_stats and containing values: ```
* collections 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
* objects 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
* avg_obj_size ```
* data_size
* storage_size
* num_extents
* indexes
* index_size
* ok

View File

@ -45,7 +45,9 @@ var sampleConfig = `
## mongodb://user:auth_key@10.10.3.30:27017, ## mongodb://user:auth_key@10.10.3.30:27017,
## mongodb://10.10.3.33:18832, ## mongodb://10.10.3.33:18832,
servers = ["mongodb://127.0.0.1:27017"] servers = ["mongodb://127.0.0.1:27017"]
gather_perdb_stats = false
## When true, collect per database stats
# gather_perdb_stats = false
## Optional SSL Config ## Optional SSL Config
# ssl_ca = "/etc/telegraf/ca.pem" # ssl_ca = "/etc/telegraf/ca.pem"