telegraf/plugins/inputs/mongodb
Daniel Nelson 1890efbb70
Rename repl_oplog_window_s to repl_oplog_window_sec
To match existing metric style.
2018-04-09 17:05:45 -07:00
..
README.md Rename repl_oplog_window_s to repl_oplog_window_sec 2018-04-09 17:05:45 -07:00
mongodb.go Modernize mongodb docs 2018-04-06 16:36:03 -07:00
mongodb_data.go Rename repl_oplog_window_s to repl_oplog_window_sec 2018-04-09 17:05:45 -07:00
mongodb_data_test.go Rename repl_oplog_window_s to repl_oplog_window_sec 2018-04-09 17:05:45 -07:00
mongodb_server.go Add repl_oplog_window_s metric to mongodb input (#3964) 2018-04-06 16:34:47 -07:00
mongodb_server_test.go Fixed inconsistency between HasIntField and IntField (#2813) 2017-05-16 15:25:30 -07:00
mongodb_test.go Use timeout smaller than 10 seconds 2016-04-04 16:10:23 -06:00
mongostat.go Add repl_oplog_window_s metric to mongodb input (#3964) 2018-04-06 16:34:47 -07:00

README.md

MongoDB Input Plugin

Configuration:

[[inputs.mongodb]]
  ## An array of URLs of the form:
  ##   "mongodb://" [user ":" pass "@"] host [ ":" port]
  ## For example:
  ##   mongodb://user:auth_key@10.10.3.30:27017,
  ##   mongodb://10.10.3.33:18832,
  servers = ["mongodb://127.0.0.1:27017"]

  ## When true, collect per database stats
  # gather_perdb_stats = false

  ## Optional SSL Config
  # ssl_ca = "/etc/telegraf/ca.pem"
  # ssl_cert = "/etc/telegraf/cert.pem"
  # ssl_key = "/etc/telegraf/key.pem"
  ## Use SSL but skip chain & host verification
  # insecure_skip_verify = false

Permissions:

If your MongoDB instance has access control enabled you will need to connect as a user with sufficient rights.

With MongoDB 3.4 and higher, the clusterMonitor role can be used. In version 3.2 you may also need these additional permissions:

> db.grantRolesToUser("user", [{role: "read", actions: "find", db: "local"}])

If the user is missing required privileges you may see an error in the Telegraf logs similar to:

Error in input [mongodb]: not authorized on admin to execute command { serverStatus: 1, recordStats: 0 }

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)
      • repl_oplog_window_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)
  • 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)

Example Output:

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
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