mongodb

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2022 License: MIT Imports: 17 Imported by: 0

README

MongoDB Input Plugin

Configuration
[[inputs.mongodb]]
  instance_id = "" # unique instance identifier (REQUIRED)

  ## 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 cluster status.
  ## Note that the query that counts jumbo chunks triggers a COLLSCAN, which
  ## may have an impact on performance.
  # gather_cluster_status = true

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

  ## When true, collect per collection stats
  # gather_col_stats = false

  ## List of db where collections stats are collected
  ## If empty, all db are concerned
  # col_stats_dbs = ["local"]

  ## Optional TLS Config
  # tls_ca = "/etc/circonus-unified-agent/ca.pem"
  # tls_cert = "/etc/circonus-unified-agent/cert.pem"
  # tls_key = "/etc/circonus-unified-agent/key.pem"
  ## Use TLS 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 logs similar to:

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

Some permission related errors are logged at debug level, you can check these messages by setting debug = true in the agent section of the configuration or by running agent with the --debug argument.

Metrics
  • mongodb

    • tags:
      • hostname
      • node_type
      • rs_name
    • fields:
      • active_reads (integer)
      • active_writes (integer)
      • aggregate_command_failed (integer)
      • aggregate_command_total (integer)
      • assert_msg (integer)
      • assert_regular (integer)
      • assert_rollovers (integer)
      • assert_user (integer)
      • assert_warning (integer)
      • available_reads (integer)
      • available_writes (integer)
      • commands (integer)
      • connections_available (integer)
      • connections_current (integer)
      • connections_total_created (integer)
      • count_command_failed (integer)
      • count_command_total (integer)
      • cursor_no_timeout_count (integer)
      • cursor_pinned_count (integer)
      • cursor_timed_out_count (integer)
      • cursor_total_count (integer)
      • delete_command_failed (integer)
      • delete_command_total (integer)
      • deletes (integer)
      • distinct_command_failed (integer)
      • distinct_command_total (integer)
      • document_deleted (integer)
      • document_inserted (integer)
      • document_returned (integer)
      • document_updated (integer)
      • find_and_modify_command_failed (integer)
      • find_and_modify_command_total (integer)
      • find_command_failed (integer)
      • find_command_total (integer)
      • flushes (integer)
      • flushes_total_time_ns (integer)
      • get_more_command_failed (integer)
      • get_more_command_total (integer)
      • getmores (integer)
      • insert_command_failed (integer)
      • insert_command_total (integer)
      • inserts (integer)
      • jumbo_chunks (integer)
      • latency_commands_count (integer)
      • latency_commands (integer)
      • latency_reads_count (integer)
      • latency_reads (integer)
      • latency_writes_count (integer)
      • latency_writes (integer)
      • member_status (string)
      • net_in_bytes_count (integer)
      • net_out_bytes_count (integer)
      • open_connections (integer)
      • operation_scan_and_order (integer)
      • operation_write_conflicts (integer)
      • page_faults (integer)
      • percent_cache_dirty (float)
      • percent_cache_used (float)
      • queries (integer)
      • queued_reads (integer)
      • queued_writes (integer)
      • repl_apply_batches_num (integer)
      • repl_apply_batches_total_millis (integer)
      • repl_apply_ops (integer)
      • repl_buffer_count (integer)
      • repl_buffer_size_bytes (integer)
      • repl_commands (integer)
      • repl_deletes (integer)
      • repl_executor_pool_in_progress_count (integer)
      • repl_executor_queues_network_in_progress (integer)
      • repl_executor_queues_sleepers (integer)
      • repl_executor_unsignaled_events (integer)
      • repl_getmores (integer)
      • repl_inserts (integer)
      • repl_lag (integer)
      • repl_network_bytes (integer)
      • repl_network_getmores_num (integer)
      • repl_network_getmores_total_millis (integer)
      • repl_network_ops (integer)
      • repl_queries (integer)
      • repl_updates (integer)
      • repl_oplog_window_sec (integer)
      • repl_state (integer)
      • resident_megabytes (integer)
      • state (string)
      • storage_freelist_search_bucket_exhausted (integer)
      • storage_freelist_search_requests (integer)
      • storage_freelist_search_scanned (integer)
      • tcmalloc_central_cache_free_bytes (integer)
      • tcmalloc_current_allocated_bytes (integer)
      • tcmalloc_current_total_thread_cache_bytes (integer)
      • tcmalloc_heap_size (integer)
      • tcmalloc_max_total_thread_cache_bytes (integer)
      • tcmalloc_pageheap_commit_count (integer)
      • tcmalloc_pageheap_committed_bytes (integer)
      • tcmalloc_pageheap_decommit_count (integer)
      • tcmalloc_pageheap_free_bytes (integer)
      • tcmalloc_pageheap_reserve_count (integer)
      • tcmalloc_pageheap_scavenge_count (integer)
      • tcmalloc_pageheap_total_commit_bytes (integer)
      • tcmalloc_pageheap_total_decommit_bytes (integer)
      • tcmalloc_pageheap_total_reserve_bytes (integer)
      • tcmalloc_pageheap_unmapped_bytes (integer)
      • tcmalloc_spinlock_total_delay_ns (integer)
      • tcmalloc_thread_cache_free_bytes (integer)
      • tcmalloc_total_free_bytes (integer)
      • tcmalloc_transfer_cache_free_bytes (integer)
      • total_available (integer)
      • total_created (integer)
      • total_docs_scanned (integer)
      • total_in_use (integer)
      • total_keys_scanned (integer)
      • total_refreshing (integer)
      • total_tickets_reads (integer)
      • total_tickets_writes (integer)
      • ttl_deletes (integer)
      • ttl_passes (integer)
      • update_command_failed (integer)
      • update_command_total (integer)
      • updates (integer)
      • uptime_ns (integer)
      • version (string)
      • 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_pages_read_into (integer)
      • wtcache_pages_requested_from (integer)
      • wtcache_current_bytes (integer)
      • wtcache_max_bytes_configured (integer)
      • wtcache_internal_pages_evicted (integer)
      • wtcache_modified_pages_evicted (integer)
      • wtcache_unmodified_pages_evicted (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)
      • commands_per_sec (integer, deprecated in 1.10; use commands))
      • cursor_no_timeout (integer, opened/sec, deprecated in 1.10; use cursor_no_timeout_count))
      • cursor_pinned (integer, opened/sec, deprecated in 1.10; use cursor_pinned_count))
      • cursor_timed_out (integer, opened/sec, deprecated in 1.10; use cursor_timed_out_count))
      • cursor_total (integer, opened/sec, deprecated in 1.10; use cursor_total_count))
      • deletes_per_sec (integer, deprecated in 1.10; use deletes))
      • flushes_per_sec (integer, deprecated in 1.10; use flushes))
      • getmores_per_sec (integer, deprecated in 1.10; use getmores))
      • inserts_per_sec (integer, deprecated in 1.10; use inserts))
      • net_in_bytes (integer, bytes/sec, deprecated in 1.10; use net_out_bytes_count))
      • net_out_bytes (integer, bytes/sec, deprecated in 1.10; use net_out_bytes_count))
      • queries_per_sec (integer, deprecated in 1.10; use queries))
      • repl_commands_per_sec (integer, deprecated in 1.10; use repl_commands))
      • repl_deletes_per_sec (integer, deprecated in 1.10; use repl_deletes)
      • repl_getmores_per_sec (integer, deprecated in 1.10; use repl_getmores)
      • repl_inserts_per_sec (integer, deprecated in 1.10; use repl_inserts))
      • repl_queries_per_sec (integer, deprecated in 1.10; use repl_queries))
      • repl_updates_per_sec (integer, deprecated in 1.10; use repl_updates))
      • ttl_deletes_per_sec (integer, deprecated in 1.10; use ttl_deletes))
      • ttl_passes_per_sec (integer, deprecated in 1.10; use ttl_passes))
      • updates_per_sec (integer, deprecated in 1.10; use updates))
  • 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)
  • mongodb_col_stats

    • tags:
      • hostname
      • collection
      • db_name
    • fields:
      • size (integer)
      • avg_obj_size (integer)
      • storage_size (integer)
      • total_index_size (integer)
      • ok (integer)
      • count (integer)
      • type (string)
  • mongodb_shard_stats

    • tags:
      • hostname
    • fields:
      • in_use (integer)
      • available (integer)
      • created (integer)
      • refreshing (integer)
Example Output
mongodb,hostname=127.0.0.1:27017 active_reads=3i,active_writes=0i,aggregate_command_failed=0i,aggregate_command_total=87210i,assert_msg=0i,assert_regular=0i,assert_rollovers=0i,assert_user=0i,assert_warning=0i,available_reads=125i,available_writes=128i,commands=218126i,commands_per_sec=1876i,connections_available=838853i,connections_current=7i,connections_total_created=8i,count_command_failed=0i,count_command_total=7i,cursor_no_timeout=0i,cursor_no_timeout_count=0i,cursor_pinned=0i,cursor_pinned_count=0i,cursor_timed_out=0i,cursor_timed_out_count=0i,cursor_total=0i,cursor_total_count=0i,delete_command_failed=0i,delete_command_total=0i,deletes=0i,deletes_per_sec=0i,distinct_command_failed=0i,distinct_command_total=87190i,document_deleted=0i,document_inserted=0i,document_returned=7i,document_updated=43595i,find_and_modify_command_failed=0i,find_and_modify_command_total=43595i,find_command_failed=0i,find_command_total=348819i,flushes=1i,flushes_per_sec=0i,flushes_total_time_ns=5000000i,get_more_command_failed=0i,get_more_command_total=0i,getmores=7i,getmores_per_sec=1i,insert_command_failed=0i,insert_command_total=0i,inserts=0i,inserts_per_sec=0i,jumbo_chunks=0i,latency_commands=44179i,latency_commands_count=122i,latency_reads=36662189i,latency_reads_count=523229i,latency_writes=6768713i,latency_writes_count=87190i,net_in_bytes=837378i,net_in_bytes_count=97692502i,net_out_bytes=690836i,net_out_bytes_count=75377383i,open_connections=7i,operation_scan_and_order=87193i,operation_write_conflicts=7i,page_faults=0i,percent_cache_dirty=0.9,percent_cache_used=1,queries=348816i,queries_per_sec=2988i,queued_reads=0i,queued_writes=0i,resident_megabytes=77i,storage_freelist_search_bucket_exhausted=0i,storage_freelist_search_requests=0i,storage_freelist_search_scanned=0i,tcmalloc_central_cache_free_bytes=280136i,tcmalloc_current_allocated_bytes=77677288i,tcmalloc_current_total_thread_cache_bytes=1222608i,tcmalloc_heap_size=142659584i,tcmalloc_max_total_thread_cache_bytes=260046848i,tcmalloc_pageheap_commit_count=1898i,tcmalloc_pageheap_committed_bytes=130084864i,tcmalloc_pageheap_decommit_count=889i,tcmalloc_pageheap_free_bytes=50610176i,tcmalloc_pageheap_reserve_count=50i,tcmalloc_pageheap_scavenge_count=884i,tcmalloc_pageheap_total_commit_bytes=13021937664i,tcmalloc_pageheap_total_decommit_bytes=12891852800i,tcmalloc_pageheap_total_reserve_bytes=142659584i,tcmalloc_pageheap_unmapped_bytes=12574720i,tcmalloc_spinlock_total_delay_ns=9767500i,tcmalloc_thread_cache_free_bytes=1222608i,tcmalloc_total_free_bytes=1797400i,tcmalloc_transfer_cache_free_bytes=294656i,total_available=0i,total_created=0i,total_docs_scanned=43595i,total_in_use=0i,total_keys_scanned=130805i,total_refreshing=0i,total_tickets_reads=128i,total_tickets_writes=128i,ttl_deletes=0i,ttl_deletes_per_sec=0i,ttl_passes=0i,ttl_passes_per_sec=0i,update_command_failed=0i,update_command_total=43595i,updates=43595i,updates_per_sec=372i,uptime_ns=60023000000i,version="3.6.17",vsize_megabytes=1048i,wtcache_app_threads_page_read_count=108i,wtcache_app_threads_page_read_time=25995i,wtcache_app_threads_page_write_count=0i,wtcache_bytes_read_into=2487250i,wtcache_bytes_written_from=74i,wtcache_current_bytes=5014530i,wtcache_internal_pages_evicted=0i,wtcache_max_bytes_configured=505413632i,wtcache_modified_pages_evicted=0i,wtcache_pages_evicted_by_app_thread=0i,wtcache_pages_queued_for_eviction=0i,wtcache_pages_read_into=139i,wtcache_pages_requested_from=699135i,wtcache_server_evicting_pages=0i,wtcache_tracked_dirty_bytes=4797426i,wtcache_unmodified_pages_evicted=0i,wtcache_worker_thread_evictingpages=0i 1586379818000000000
mongodb,hostname=127.0.0.1:27017,node_type=SEC,rs_name=rs0 active_reads=1i,active_writes=0i,aggregate_command_failed=0i,aggregate_command_total=1i,assert_msg=0i,assert_regular=0i,assert_rollovers=0i,assert_user=79i,assert_warning=0i,available_reads=127i,available_writes=128i,commands=1121855i,commands_per_sec=10i,connections_available=51183i,connections_current=17i,connections_total_created=557i,count_command_failed=0i,count_command_total=46307i,cursor_no_timeout=0i,cursor_no_timeout_count=0i,cursor_pinned=0i,cursor_pinned_count=0i,cursor_timed_out=0i,cursor_timed_out_count=28i,cursor_total=0i,cursor_total_count=0i,delete_command_failed=0i,delete_command_total=0i,deletes=0i,deletes_per_sec=0i,distinct_command_failed=0i,distinct_command_total=0i,document_deleted=0i,document_inserted=0i,document_returned=2248129i,document_updated=0i,find_and_modify_command_failed=0i,find_and_modify_command_total=0i,find_command_failed=2i,find_command_total=8764i,flushes=7850i,flushes_per_sec=0i,flushes_total_time_ns=4535446000000i,get_more_command_failed=0i,get_more_command_total=1993i,getmores=2018i,getmores_per_sec=0i,insert_command_failed=0i,insert_command_total=0i,inserts=0i,inserts_per_sec=0i,jumbo_chunks=0i,latency_commands=112011949i,latency_commands_count=1072472i,latency_reads=1877142443i,latency_reads_count=57086i,latency_writes=0i,latency_writes_count=0i,member_status="SEC",net_in_bytes=1212i,net_in_bytes_count=263928689i,net_out_bytes=41051i,net_out_bytes_count=2475389483i,open_connections=17i,operation_scan_and_order=34i,operation_write_conflicts=0i,page_faults=317i,percent_cache_dirty=1.6,percent_cache_used=73,queries=8764i,queries_per_sec=0i,queued_reads=0i,queued_writes=0i,repl_apply_batches_num=17839419i,repl_apply_batches_total_millis=399929i,repl_apply_ops=23355263i,repl_buffer_count=0i,repl_buffer_size_bytes=0i,repl_commands=11i,repl_commands_per_sec=0i,repl_deletes=440608i,repl_deletes_per_sec=0i,repl_executor_pool_in_progress_count=0i,repl_executor_queues_network_in_progress=0i,repl_executor_queues_sleepers=4i,repl_executor_unsignaled_events=0i,repl_getmores=0i,repl_getmores_per_sec=0i,repl_inserts=1875729i,repl_inserts_per_sec=0i,repl_lag=0i,repl_network_bytes=39122199371i,repl_network_getmores_num=34908797i,repl_network_getmores_total_millis=434805356i,repl_network_ops=23199086i,repl_oplog_window_sec=619292i,repl_queries=0i,repl_queries_per_sec=0i,repl_updates=21034729i,repl_updates_per_sec=38i,repl_state=2,resident_megabytes=6721i,state="SECONDARY",storage_freelist_search_bucket_exhausted=0i,storage_freelist_search_requests=0i,storage_freelist_search_scanned=0i,tcmalloc_central_cache_free_bytes=358512400i,tcmalloc_current_allocated_bytes=5427379424i,tcmalloc_current_total_thread_cache_bytes=70349552i,tcmalloc_heap_size=10199310336i,tcmalloc_max_total_thread_cache_bytes=1073741824i,tcmalloc_pageheap_commit_count=790819i,tcmalloc_pageheap_committed_bytes=7064821760i,tcmalloc_pageheap_decommit_count=533347i,tcmalloc_pageheap_free_bytes=1207816192i,tcmalloc_pageheap_reserve_count=7706i,tcmalloc_pageheap_scavenge_count=426235i,tcmalloc_pageheap_total_commit_bytes=116127649792i,tcmalloc_pageheap_total_decommit_bytes=109062828032i,tcmalloc_pageheap_total_reserve_bytes=10199310336i,tcmalloc_pageheap_unmapped_bytes=3134488576i,tcmalloc_spinlock_total_delay_ns=2518474348i,tcmalloc_thread_cache_free_bytes=70349552i,tcmalloc_total_free_bytes=429626144i,tcmalloc_transfer_cache_free_bytes=764192i,total_available=0i,total_created=0i,total_docs_scanned=735004782i,total_in_use=0i,total_keys_scanned=6188216i,total_refreshing=0i,total_tickets_reads=128i,total_tickets_writes=128i,ttl_deletes=0i,ttl_deletes_per_sec=0i,ttl_passes=7892i,ttl_passes_per_sec=0i,update_command_failed=0i,update_command_total=0i,updates=0i,updates_per_sec=0i,uptime_ns=473590288000000i,version="3.6.17",vsize_megabytes=11136i,wtcache_app_threads_page_read_count=11467625i,wtcache_app_threads_page_read_time=1700336840i,wtcache_app_threads_page_write_count=13268184i,wtcache_bytes_read_into=348022587843i,wtcache_bytes_written_from=322571702254i,wtcache_current_bytes=5509459274i,wtcache_internal_pages_evicted=109108i,wtcache_max_bytes_configured=7547650048i,wtcache_modified_pages_evicted=911196i,wtcache_pages_evicted_by_app_thread=17366i,wtcache_pages_queued_for_eviction=16572754i,wtcache_pages_read_into=11689764i,wtcache_pages_requested_from=499825861i,wtcache_server_evicting_pages=0i,wtcache_tracked_dirty_bytes=117487510i,wtcache_unmodified_pages_evicted=11058458i,wtcache_worker_thread_evictingpages=11907226i 1586379707000000000
mongodb_db_stats,db_name=admin,hostname=127.0.0.1:27017 avg_obj_size=241,collections=2i,data_size=723i,index_size=49152i,indexes=3i,num_extents=0i,objects=3i,ok=1i,storage_size=53248i,type="db_stat" 1547159491000000000
mongodb_db_stats,db_name=local,hostname=127.0.0.1:27017 avg_obj_size=813.9705882352941,collections=6i,data_size=55350i,index_size=102400i,indexes=5i,num_extents=0i,objects=68i,ok=1i,storage_size=204800i,type="db_stat" 1547159491000000000
mongodb_col_stats,collection=foo,db_name=local,hostname=127.0.0.1:27017 size=375005928i,avg_obj_size=5494,type="col_stat",storage_size=249307136i,total_index_size=2138112i,ok=1i,count=68251i 1547159491000000000
mongodb_shard_stats,hostname=127.0.0.1:27017,in_use=3i,available=3i,created=4i,refreshing=0i 1522799074000000000

Documentation

Index

Constants

View Source
const (
	Always   = 1 << iota // always activate the column
	Discover             // only active when mongostat is in discover mode
	Repl                 // only active if one of the nodes being monitored is in a replset
	Locks                // only active if node is capable of calculating lock info
	AllOnly              // only active if mongostat was run with --all option
	MMAPOnly             // only active if node has mmap-specific fields
	WTOnly               // only active if node has wiredtiger-specific fields
)

Flags to determine cases when to activate/deactivate columns for output.

View Source
const (
	MongosProcess = "mongos"
)

Variables

View Source
var ColDataStats = map[string]string{
	"count":            "Count",
	"size":             "Size",
	"avg_obj_size":     "AvgObjSize",
	"storage_size":     "StorageSize",
	"total_index_size": "TotalIndexSize",
	"ok":               "Ok",
}
View Source
var DbDataStats = map[string]string{
	"collections":  "Collections",
	"objects":      "Objects",
	"avg_obj_size": "AvgObjSize",
	"data_size":    "DataSize",
	"storage_size": "StorageSize",
	"num_extents":  "NumExtents",
	"indexes":      "Indexes",
	"index_size":   "IndexSize",
	"ok":           "Ok",
}
View Source
var DefaultAssertsStats = map[string]string{
	"assert_regular":   "Regular",
	"assert_warning":   "Warning",
	"assert_msg":       "Msg",
	"assert_user":      "User",
	"assert_rollovers": "Rollovers",
}
View Source
var DefaultClusterStats = map[string]string{
	"jumbo_chunks": "JumboChunksCount",
}
View Source
var DefaultCommandsStats = map[string]string{
	"aggregate_command_total":        "AggregateCommandTotal",
	"aggregate_command_failed":       "AggregateCommandFailed",
	"count_command_total":            "CountCommandTotal",
	"count_command_failed":           "CountCommandFailed",
	"delete_command_total":           "DeleteCommandTotal",
	"delete_command_failed":          "DeleteCommandFailed",
	"distinct_command_total":         "DistinctCommandTotal",
	"distinct_command_failed":        "DistinctCommandFailed",
	"find_command_total":             "FindCommandTotal",
	"find_command_failed":            "FindCommandFailed",
	"find_and_modify_command_total":  "FindAndModifyCommandTotal",
	"find_and_modify_command_failed": "FindAndModifyCommandFailed",
	"get_more_command_total":         "GetMoreCommandTotal",
	"get_more_command_failed":        "GetMoreCommandFailed",
	"insert_command_total":           "InsertCommandTotal",
	"insert_command_failed":          "InsertCommandFailed",
	"update_command_total":           "UpdateCommandTotal",
	"update_command_failed":          "UpdateCommandFailed",
}
View Source
var DefaultLatencyStats = map[string]string{
	"latency_writes_count":   "WriteOpsCnt",
	"latency_writes":         "WriteLatency",
	"latency_reads_count":    "ReadOpsCnt",
	"latency_reads":          "ReadLatency",
	"latency_commands_count": "CommandOpsCnt",
	"latency_commands":       "CommandLatency",
}
View Source
var DefaultReplStats = map[string]string{
	"repl_inserts":                             "InsertRCnt",
	"repl_inserts_per_sec":                     "InsertR",
	"repl_queries":                             "QueryRCnt",
	"repl_queries_per_sec":                     "QueryR",
	"repl_updates":                             "UpdateRCnt",
	"repl_updates_per_sec":                     "UpdateR",
	"repl_deletes":                             "DeleteRCnt",
	"repl_deletes_per_sec":                     "DeleteR",
	"repl_getmores":                            "GetMoreRCnt",
	"repl_getmores_per_sec":                    "GetMoreR",
	"repl_commands":                            "CommandRCnt",
	"repl_commands_per_sec":                    "CommandR",
	"member_status":                            "NodeType",
	"state":                                    "NodeState",
	"repl_state":                               "NodeStateInt",
	"repl_lag":                                 "ReplLag",
	"repl_network_bytes":                       "ReplNetworkBytes",
	"repl_network_getmores_num":                "ReplNetworkGetmoresNum",
	"repl_network_getmores_total_millis":       "ReplNetworkGetmoresTotalMillis",
	"repl_network_ops":                         "ReplNetworkOps",
	"repl_buffer_count":                        "ReplBufferCount",
	"repl_buffer_size_bytes":                   "ReplBufferSizeBytes",
	"repl_apply_batches_num":                   "ReplApplyBatchesNum",
	"repl_apply_batches_total_millis":          "ReplApplyBatchesTotalMillis",
	"repl_apply_ops":                           "ReplApplyOps",
	"repl_executor_pool_in_progress_count":     "ReplExecutorPoolInProgressCount",
	"repl_executor_queues_network_in_progress": "ReplExecutorQueuesNetworkInProgress",
	"repl_executor_queues_sleepers":            "ReplExecutorQueuesSleepers",
	"repl_executor_unsignaled_events":          "ReplExecutorUnsignaledEvents",
}
View Source
var DefaultShardStats = map[string]string{
	"total_in_use":     "TotalInUse",
	"total_available":  "TotalAvailable",
	"total_created":    "TotalCreated",
	"total_refreshing": "TotalRefreshing",
}
View Source
var DefaultStats = map[string]string{
	"uptime_ns":                 "UptimeNanos",
	"inserts":                   "InsertCnt",
	"inserts_per_sec":           "Insert",
	"queries":                   "QueryCnt",
	"queries_per_sec":           "Query",
	"updates":                   "UpdateCnt",
	"updates_per_sec":           "Update",
	"deletes":                   "DeleteCnt",
	"deletes_per_sec":           "Delete",
	"getmores":                  "GetMoreCnt",
	"getmores_per_sec":          "GetMore",
	"commands":                  "CommandCnt",
	"commands_per_sec":          "Command",
	"flushes":                   "FlushesCnt",
	"flushes_per_sec":           "Flushes",
	"flushes_total_time_ns":     "FlushesTotalTime",
	"vsize_megabytes":           "Virtual",
	"resident_megabytes":        "Resident",
	"queued_reads":              "QueuedReaders",
	"queued_writes":             "QueuedWriters",
	"active_reads":              "ActiveReaders",
	"active_writes":             "ActiveWriters",
	"available_reads":           "AvailableReaders",
	"available_writes":          "AvailableWriters",
	"total_tickets_reads":       "TotalTicketsReaders",
	"total_tickets_writes":      "TotalTicketsWriters",
	"net_in_bytes_count":        "NetInCnt",
	"net_in_bytes":              "NetIn",
	"net_out_bytes_count":       "NetOutCnt",
	"net_out_bytes":             "NetOut",
	"open_connections":          "NumConnections",
	"ttl_deletes":               "DeletedDocumentsCnt",
	"ttl_deletes_per_sec":       "DeletedDocuments",
	"ttl_passes":                "PassesCnt",
	"ttl_passes_per_sec":        "Passes",
	"cursor_timed_out":          "TimedOutC",
	"cursor_timed_out_count":    "TimedOutCCnt",
	"cursor_no_timeout":         "NoTimeoutC",
	"cursor_no_timeout_count":   "NoTimeoutCCnt",
	"cursor_pinned":             "PinnedC",
	"cursor_pinned_count":       "PinnedCCnt",
	"cursor_total":              "TotalC",
	"cursor_total_count":        "TotalCCnt",
	"document_deleted":          "DeletedD",
	"document_inserted":         "InsertedD",
	"document_returned":         "ReturnedD",
	"document_updated":          "UpdatedD",
	"connections_current":       "CurrentC",
	"connections_available":     "AvailableC",
	"connections_total_created": "TotalCreatedC",
	"operation_scan_and_order":  "ScanAndOrderOp",
	"operation_write_conflicts": "WriteConflictsOp",
	"total_keys_scanned":        "TotalKeysScanned",
	"total_docs_scanned":        "TotalObjectsScanned",
}
View Source
var DefaultStorageStats = map[string]string{
	"storage_freelist_search_bucket_exhausted": "StorageFreelistSearchBucketExhausted",
	"storage_freelist_search_requests":         "StorageFreelistSearchRequests",
	"storage_freelist_search_scanned":          "StorageFreelistSearchScanned",
}
View Source
var DefaultTCMallocStats = map[string]string{
	"tcmalloc_current_allocated_bytes":          "TCMallocCurrentAllocatedBytes",
	"tcmalloc_heap_size":                        "TCMallocHeapSize",
	"tcmalloc_central_cache_free_bytes":         "TCMallocCentralCacheFreeBytes",
	"tcmalloc_current_total_thread_cache_bytes": "TCMallocCurrentTotalThreadCacheBytes",
	"tcmalloc_max_total_thread_cache_bytes":     "TCMallocMaxTotalThreadCacheBytes",
	"tcmalloc_total_free_bytes":                 "TCMallocTotalFreeBytes",
	"tcmalloc_transfer_cache_free_bytes":        "TCMallocTransferCacheFreeBytes",
	"tcmalloc_thread_cache_free_bytes":          "TCMallocThreadCacheFreeBytes",
	"tcmalloc_spinlock_total_delay_ns":          "TCMallocSpinLockTotalDelayNanos",
	"tcmalloc_pageheap_free_bytes":              "TCMallocPageheapFreeBytes",
	"tcmalloc_pageheap_unmapped_bytes":          "TCMallocPageheapUnmappedBytes",
	"tcmalloc_pageheap_committed_bytes":         "TCMallocPageheapComittedBytes",
	"tcmalloc_pageheap_scavenge_count":          "TCMallocPageheapScavengeCount",
	"tcmalloc_pageheap_commit_count":            "TCMallocPageheapCommitCount",
	"tcmalloc_pageheap_total_commit_bytes":      "TCMallocPageheapTotalCommitBytes",
	"tcmalloc_pageheap_decommit_count":          "TCMallocPageheapDecommitCount",
	"tcmalloc_pageheap_total_decommit_bytes":    "TCMallocPageheapTotalDecommitBytes",
	"tcmalloc_pageheap_reserve_count":           "TCMallocPageheapReserveCount",
	"tcmalloc_pageheap_total_reserve_bytes":     "TCMallocPageheapTotalReserveBytes",
}
View Source
var MmapStats = map[string]string{
	"mapped_megabytes":     "Mapped",
	"non-mapped_megabytes": "NonMapped",
	"page_faults":          "FaultsCnt",
	"page_faults_per_sec":  "Faults",
}
View Source
var ShardHostStats = map[string]string{
	"in_use":     "InUse",
	"available":  "Available",
	"created":    "Created",
	"refreshing": "Refreshing",
}
View Source
var StatHeaders = []StatHeader{
	{"", Always},
	{"insert", Always},
	{"query", Always},
	{"update", Always},
	{"delete", Always},
	{"getmore", Always},
	{"command", Always},
	{"% dirty", WTOnly},
	{"% used", WTOnly},
	{"flushes", Always},
	{"mapped", MMAPOnly},
	{"vsize", Always},
	{"res", Always},
	{"non-mapped", MMAPOnly | AllOnly},
	{"faults", MMAPOnly},
	{"lr|lw %", MMAPOnly | AllOnly},
	{"lrt|lwt", MMAPOnly | AllOnly},
	{"    locked db", Locks},
	{"qr|qw", Always},
	{"ar|aw", Always},
	{"netIn", Always},
	{"netOut", Always},
	{"conn", Always},
	{"set", Repl},
	{"repl", Repl},
	{"time", Always},
}

StatHeaders are the complete set of data metrics supported by mongostat.

View Source
var WiredTigerExtStats = map[string]string{
	"wtcache_tracked_dirty_bytes":          "TrackedDirtyBytes",
	"wtcache_current_bytes":                "CurrentCachedBytes",
	"wtcache_max_bytes_configured":         "MaxBytesConfigured",
	"wtcache_app_threads_page_read_count":  "AppThreadsPageReadCount",
	"wtcache_app_threads_page_read_time":   "AppThreadsPageReadTime",
	"wtcache_app_threads_page_write_count": "AppThreadsPageWriteCount",
	"wtcache_bytes_written_from":           "BytesWrittenFrom",
	"wtcache_bytes_read_into":              "BytesReadInto",
	"wtcache_pages_evicted_by_app_thread":  "PagesEvictedByAppThread",
	"wtcache_pages_queued_for_eviction":    "PagesQueuedForEviction",
	"wtcache_pages_read_into":              "PagesReadIntoCache",
	"wtcache_pages_written_from":           "PagesWrittenFromCache",
	"wtcache_pages_requested_from":         "PagesRequestedFromCache",
	"wtcache_server_evicting_pages":        "ServerEvictingPages",
	"wtcache_worker_thread_evictingpages":  "WorkerThreadEvictingPages",
	"wtcache_internal_pages_evicted":       "InternalPagesEvicted",
	"wtcache_modified_pages_evicted":       "ModifiedPagesEvicted",
	"wtcache_unmodified_pages_evicted":     "UnmodifiedPagesEvicted",
}
View Source
var WiredTigerStats = map[string]string{
	"percent_cache_dirty": "CacheDirtyPercent",
	"percent_cache_used":  "CacheUsedPercent",
}

Functions

func IsAuthorization

func IsAuthorization(err error) bool

Types

type AssertsStats

type AssertsStats struct {
	Regular   int64 `bson:"regular"`
	Warning   int64 `bson:"warning"`
	Msg       int64 `bson:"msg"`
	User      int64 `bson:"user"`
	Rollovers int64 `bson:"rollovers"`
}

AssertsStats stores information related to assertions raised since the MongoDB process started

type BasicStats

type BasicStats struct {
	Num         int64 `bson:"num"`
	TotalMillis int64 `bson:"totalMillis"`
}

BasicStats stores information about an operation

type CacheStats

type CacheStats struct {
	TrackedDirtyBytes         int64 `bson:"tracked dirty bytes in the cache"`
	CurrentCachedBytes        int64 `bson:"bytes currently in the cache"`
	MaxBytesConfigured        int64 `bson:"maximum bytes configured"`
	AppThreadsPageReadCount   int64 `bson:"application threads page read from disk to cache count"`
	AppThreadsPageReadTime    int64 `bson:"application threads page read from disk to cache time (usecs)"`
	AppThreadsPageWriteCount  int64 `bson:"application threads page write from cache to disk count"`
	AppThreadsPageWriteTime   int64 `bson:"application threads page write from cache to disk time (usecs)"`
	BytesWrittenFrom          int64 `bson:"bytes written from cache"`
	BytesReadInto             int64 `bson:"bytes read into cache"`
	PagesEvictedByAppThread   int64 `bson:"pages evicted by application threads"`
	PagesQueuedForEviction    int64 `bson:"pages queued for eviction"`
	PagesReadIntoCache        int64 `bson:"pages read into cache"`
	PagesWrittenFromCache     int64 `bson:"pages written from cache"`
	PagesRequestedFromCache   int64 `bson:"pages requested from the cache"`
	ServerEvictingPages       int64 `bson:"eviction server evicting pages"`
	WorkerThreadEvictingPages int64 `bson:"eviction worker thread evicting pages"`
	InternalPagesEvicted      int64 `bson:"internal pages evicted"`
	ModifiedPagesEvicted      int64 `bson:"modified pages evicted"`
	UnmodifiedPagesEvicted    int64 `bson:"unmodified pages evicted"`
}

CacheStats stores cache statistics for WiredTiger.

type ClientStats

type ClientStats struct {
	Total   int64 `bson:"total"`
	Readers int64 `bson:"readers"`
	Writers int64 `bson:"writers"`
}

ClientStats stores the number of active read/write operations.

type ClusterStatus

type ClusterStatus struct {
	JumboChunksCount int64
}

ClusterStatus stores information related to the whole cluster

type ColData

type ColData struct {
	Fields map[string]interface{}
	Name   string
	DbName string
}

type ColStatLine

type ColStatLine struct {
	Name           string
	DbName         string
	Count          int64
	Size           int64
	AvgObjSize     float64
	StorageSize    int64
	TotalIndexSize int64
	Ok             int64
}

type ColStats

type ColStats struct {
	Collections []Collection
}

type ColStatsData

type ColStatsData struct {
	Collection     string  `bson:"ns"`
	Count          int64   `bson:"count"`
	Size           int64   `bson:"size"`
	AvgObjSize     float64 `bson:"avgObjSize"`
	StorageSize    int64   `bson:"storageSize"`
	TotalIndexSize int64   `bson:"totalIndexSize"`
	Ok             int64   `bson:"ok"`
}

type Collection

type Collection struct {
	ColStatsData *ColStatsData
	Name         string
	DbName       string
}

type CollectionLockStatus

type CollectionLockStatus struct {
	ReadAcquireWaitsPercentage  float64
	WriteAcquireWaitsPercentage float64
	ReadAcquireTimeMicros       int64
	WriteAcquireTimeMicros      int64
}

CollectionLockStatus stores a collection's lock statistics.

type CommandsStats

type CommandsStats struct {
	Aggregate     *CommandsStatsValue `bson:"aggregate"`
	Count         *CommandsStatsValue `bson:"count"`
	Delete        *CommandsStatsValue `bson:"delete"`
	Distinct      *CommandsStatsValue `bson:"distinct"`
	Find          *CommandsStatsValue `bson:"find"`
	FindAndModify *CommandsStatsValue `bson:"findAndModify"`
	GetMore       *CommandsStatsValue `bson:"getMore"`
	Insert        *CommandsStatsValue `bson:"insert"`
	Update        *CommandsStatsValue `bson:"update"`
}

CommandsStats stores information related to document metrics.

type CommandsStatsValue

type CommandsStatsValue struct {
	Failed int64 `bson:"failed"`
	Total  int64 `bson:"total"`
}

type ConcurrentTransStats

type ConcurrentTransStats struct {
	Out          int64 `bson:"out"`
	Available    int64 `bson:"available"`
	TotalTickets int64 `bson:"totalTickets"`
}

type ConcurrentTransactions

type ConcurrentTransactions struct {
	Write ConcurrentTransStats `bson:"write"`
	Read  ConcurrentTransStats `bson:"read"`
}

type ConnectionStats

type ConnectionStats struct {
	Current      int64 `bson:"current"`
	Available    int64 `bson:"available"`
	TotalCreated int64 `bson:"totalCreated"`
}

ConnectionStats stores information related to incoming database connections.

type CursorStats

type CursorStats struct {
	Open     *OpenCursorStats `bson:"open"`
	TimedOut int64            `bson:"timedOut"`
}

CursorStats stores information related to cursor metrics.

type DBRecordStats

type DBRecordStats struct {
	DBRecordAccesses          map[string]RecordAccesses `bson:",inline"`
	AccessesNotInMemory       int64                     `bson:"accessesNotInMemory"`
	PageFaultExceptionsThrown int64                     `bson:"pageFaultExceptionsThrown"`
}

DBRecordStats stores data related to memory operations across databases.

type Db

type Db struct {
	DbStatsData *DbStatsData
	Name        string
}

Db represent a single DB

type DbData

type DbData struct {
	Fields map[string]interface{}
	Name   string
}

type DbStatLine

type DbStatLine struct {
	Name        string
	Collections int64
	Objects     int64
	AvgObjSize  float64
	DataSize    int64
	StorageSize int64
	NumExtents  int64
	Indexes     int64
	IndexSize   int64
	Ok          int64
}

type DbStats

type DbStats struct {
	Dbs []Db
}

DbStats stores stats from all dbs

type DbStatsData

type DbStatsData struct {
	GleStats    interface{} `bson:"gleStats"`
	Db          string      `bson:"db"`
	Collections int64       `bson:"collections"`
	Objects     int64       `bson:"objects"`
	AvgObjSize  float64     `bson:"avgObjSize"`
	DataSize    int64       `bson:"dataSize"`
	StorageSize int64       `bson:"storageSize"`
	NumExtents  int64       `bson:"numExtents"`
	Indexes     int64       `bson:"indexes"`
	IndexSize   int64       `bson:"indexSize"`
	Ok          int64       `bson:"ok"`
}

DbStatsData stores stats from a db

type DetailedTCMallocStats

type DetailedTCMallocStats struct {
	PageheapFreeBytes            int64 `bson:"pageheap_free_bytes"`
	PageheapUnmappedBytes        int64 `bson:"pageheap_unmapped_bytes"`
	MaxTotalThreadCacheBytes     int64 `bson:"max_total_thread_cache_bytes"`
	CurrentTotalThreadCacheBytes int64 `bson:"current_total_thread_cache_bytes"`
	TotalFreeBytes               int64 `bson:"total_free_bytes"`
	CentralCacheFreeBytes        int64 `bson:"central_cache_free_bytes"`
	TransferCacheFreeBytes       int64 `bson:"transfer_cache_free_bytes"`
	ThreadCacheFreeBytes         int64 `bson:"thread_cache_free_bytes"`
	PageheapComittedBytes        int64 `bson:"pageheap_committed_bytes"`
	PageheapScavengeCount        int64 `bson:"pageheap_scavenge_count"`
	PageheapCommitCount          int64 `bson:"pageheap_commit_count"`
	PageheapTotalCommitBytes     int64 `bson:"pageheap_total_commit_bytes"`
	PageheapDecommitCount        int64 `bson:"pageheap_decommit_count"`
	PageheapTotalDecommitBytes   int64 `bson:"pageheap_total_decommit_bytes"`
	PageheapReserveCount         int64 `bson:"pageheap_reserve_count"`
	PageheapTotalReserveBytes    int64 `bson:"pageheap_total_reserve_bytes"`
	SpinLockTotalDelayNanos      int64 `bson:"spinlock_total_delay_ns"`
}

DetailedTCMallocStats stores detailed TCMalloc memory allocator metrics

type DocumentStats

type DocumentStats struct {
	Deleted  int64 `bson:"deleted"`
	Inserted int64 `bson:"inserted"`
	Returned int64 `bson:"returned"`
	Updated  int64 `bson:"updated"`
}

DocumentStats stores information related to document metrics.

type DurStats

type DurStats struct {
	Commits            int64 `bson:"commits"`
	JournaledMB        int64 `bson:"journaledMB"`
	WriteToDataFilesMB int64 `bson:"writeToDataFilesMB"`
	Compression        int64 `bson:"compression"`
	CommitsInWriteLock int64 `bson:"commitsInWriteLock"`
	EarlyCommits       int64 `bson:"earlyCommits"`
	TimeMs             DurTiming
}

DurStats stores information related to journaling statistics.

type DurTiming

type DurTiming struct {
	Dt               int64 `bson:"dt"`
	PrepLogBuffer    int64 `bson:"prepLogBuffer"`
	WriteToJournal   int64 `bson:"writeToJournal"`
	WriteToDataFiles int64 `bson:"writeToDataFiles"`
	RemapPrivateView int64 `bson:"remapPrivateView"`
}

DurTiming stores information related to journaling.

type ExtraInfo

type ExtraInfo struct {
	PageFaults *int64 `bson:"page_faults"`
}

ExtraInfo stores additional platform specific information.

type FlushStats

type FlushStats struct {
	LastFinished time.Time `bson:"last_finished"`
	Flushes      int64     `bson:"flushes"`
	TotalMs      int64     `bson:"total_ms"`
	AverageMs    float64   `bson:"average_ms"`
	LastMs       int64     `bson:"last_ms"`
}

FlushStats stores information about memory flushes.

type GenericTCMAllocStats

type GenericTCMAllocStats struct {
	CurrentAllocatedBytes int64 `bson:"current_allocated_bytes"`
	HeapSize              int64 `bson:"heap_size"`
}

GenericTCMAllocStats stores generic TCMalloc memory allocator metrics

type GlobalLockStats

type GlobalLockStats struct {
	CurrentQueue  *QueueStats  `bson:"currentQueue"`
	ActiveClients *ClientStats `bson:"activeClients"`
	TotalTime     int64        `bson:"totalTime"`
	LockTime      int64        `bson:"lockTime"`
}

GlobalLockStats stores information related locks in the MMAP storage engine.

type LatencyStats

type LatencyStats struct {
	Latency int64 `bson:"latency"`
	Ops     int64 `bson:"ops"`
}

LatencyStats lists total latency in microseconds and count of operations, enabling you to obtain an average

type LockStats

type LockStats struct {
	AcquireCount        *ReadWriteLockTimes `bson:"acquireCount,omitempty"`
	AcquireWaitCount    *ReadWriteLockTimes `bson:"acquireWaitCount,omitempty"`
	TimeLockedMicros    ReadWriteLockTimes  `bson:"timeLockedMicros"`
	TimeAcquiringMicros ReadWriteLockTimes  `bson:"timeAcquiringMicros"`
}

LockStats stores information related to time spent acquiring/holding locks for a given database.

AcquireCount and AcquireWaitCount are new fields of the lock stats only populated on 3.0 or newer. Typed as a pointer so that if it is nil, mongostat can assume the field is not populated with real namespace data.

type LockStatus

type LockStatus struct {
	DBName     string
	Percentage float64
	Global     bool
}

LockStatus stores a database's lock statistics.

type LockUsage

type LockUsage struct {
	Namespace string
	Reads     int64
	Writes    int64
}

LockUsage stores information related to a namespace's lock usage.

type MDBData added in v0.0.12

type MDBData struct {
	StatLine      *StatLine
	Fields        map[string]interface{}
	Tags          map[string]string
	DbData        []DbData
	ColData       []ColData
	ShardHostData []DbData
}

func NewMongodbData

func NewMongodbData(statLine *StatLine, tags map[string]string) *MDBData

func (*MDBData) AddColStats added in v0.0.12

func (d *MDBData) AddColStats()

func (*MDBData) AddDbStats added in v0.0.12

func (d *MDBData) AddDbStats()

func (*MDBData) AddDefaultStats added in v0.0.12

func (d *MDBData) AddDefaultStats()

func (*MDBData) AddShardHostStats added in v0.0.12

func (d *MDBData) AddShardHostStats()

type MemStats

type MemStats struct {
	Supported         interface{} `bson:"supported"`
	Bits              int64       `bson:"bits"`
	Resident          int64       `bson:"resident"`
	Virtual           int64       `bson:"virtual"`
	Mapped            int64       `bson:"mapped"`
	MappedWithJournal int64       `bson:"mappedWithJournal"`
}

MemStats stores data related to memory statistics.

type MetricsStats

type MetricsStats struct {
	TTL           *TTLStats           `bson:"ttl"`
	Cursor        *CursorStats        `bson:"cursor"`
	Document      *DocumentStats      `bson:"document"`
	Commands      *CommandsStats      `bson:"commands"`
	Operation     *OperationStats     `bson:"operation"`
	QueryExecutor *QueryExecutorStats `bson:"queryExecutor"`
	Repl          *ReplStats          `bson:"repl"`
	Storage       *StorageStats       `bson:"storage"`
}

MetricsStats stores information related to metrics

type MongoDB

type MongoDB struct {
	Log cua.Logger

	tlsint.ClientConfig
	Servers             []string
	ColStatsDbs         []string
	Ssl                 Ssl
	GatherClusterStatus bool
	GatherPerdbStats    bool
	GatherColStats      bool
	// contains filtered or unexported fields
}

func (*MongoDB) Description

func (*MongoDB) Description() string

func (*MongoDB) Gather

func (m *MongoDB) Gather(ctx context.Context, acc cua.Accumulator) error

Reads stats from all configured servers accumulates stats. Returns one of the errors encountered while gather stats (if any).

func (*MongoDB) SampleConfig

func (m *MongoDB) SampleConfig() string

type MongoStatus

type MongoStatus struct {
	SampleTime    time.Time
	ServerStatus  *ServerStatus
	ReplSetStatus *ReplSetStatus
	ClusterStatus *ClusterStatus
	DbStats       *DbStats
	ColStats      *ColStats
	ShardStats    *ShardStats
	OplogStats    *OplogStats
}

type NamespacedLocks

type NamespacedLocks map[string]LockStatus

NamespacedLocks stores information on the LockStatus of namespaces.

type NetworkStats

type NetworkStats struct {
	BytesIn     int64 `bson:"bytesIn"`
	BytesOut    int64 `bson:"bytesOut"`
	NumRequests int64 `bson:"numRequests"`
}

NetworkStats stores information related to network traffic.

type OpLatenciesStats

type OpLatenciesStats struct {
	Reads    *LatencyStats `bson:"reads"`
	Writes   *LatencyStats `bson:"writes"`
	Commands *LatencyStats `bson:"commands"`
}

OpLatenciesStats stores information related to operation latencies for the database as a whole

type OpcountStats

type OpcountStats struct {
	Insert  int64 `bson:"insert"`
	Query   int64 `bson:"query"`
	Update  int64 `bson:"update"`
	Delete  int64 `bson:"delete"`
	GetMore int64 `bson:"getmore"`
	Command int64 `bson:"command"`
}

OpcountStats stores information related to commands and basic CRUD operations.

type OpenCursorStats

type OpenCursorStats struct {
	NoTimeout int64 `bson:"noTimeout"`
	Pinned    int64 `bson:"pinned"`
	Total     int64 `bson:"total"`
}

OpenCursorStats stores information related to open cursor metrics

type OperationStats

type OperationStats struct {
	ScanAndOrder   int64 `bson:"scanAndOrder"`
	WriteConflicts int64 `bson:"writeConflicts"`
}

OperationStats stores information related to query operations using special operation types

type OplogStats

type OplogStats struct {
	TimeDiff int64
}

OplogStatus stores information from getReplicationInfo

type QueryExecutorStats

type QueryExecutorStats struct {
	Scanned        int64 `bson:"scanned"`
	ScannedObjects int64 `bson:"scannedObjects"`
}

QueryExecutorStats stores information related to query execution

type QueueStats

type QueueStats struct {
	Total   int64 `bson:"total"`
	Readers int64 `bson:"readers"`
	Writers int64 `bson:"writers"`
}

QueueStats stores the number of queued read/write operations.

type ReadWriteLockTimes

type ReadWriteLockTimes struct {
	Read       int64 `bson:"R"`
	Write      int64 `bson:"W"`
	ReadLower  int64 `bson:"r"`
	WriteLower int64 `bson:"w"`
}

ReadWriteLockTimes stores time spent holding read/write locks.

type RecordAccesses

type RecordAccesses struct {
	AccessesNotInMemory       int64 `bson:"accessesNotInMemory"`
	PageFaultExceptionsThrown int64 `bson:"pageFaultExceptionsThrown"`
}

RecordAccesses stores data related to memory operations scoped to a database.

type ReplApplyStats

type ReplApplyStats struct {
	Batches *BasicStats `bson:"batches"`
	Ops     int64       `bson:"ops"`
}

ReplApplyStats stores information related to oplog application process

type ReplBufferStats

type ReplBufferStats struct {
	Count     int64 `bson:"count"`
	SizeBytes int64 `bson:"sizeBytes"`
}

ReplBufferStats stores information related to oplog buffer

type ReplExecutorStats

type ReplExecutorStats struct {
	Pool             map[string]int64 `bson:"pool"`
	Queues           map[string]int64 `bson:"queues"`
	UnsignaledEvents int64            `bson:"unsignaledEvents"`
}

ReplExecutorStats stores information related to replication executor

type ReplNetworkStats

type ReplNetworkStats struct {
	GetMores *BasicStats `bson:"getmores"`
	Bytes    int64       `bson:"bytes"`
	Ops      int64       `bson:"ops"`
}

ReplNetworkStats stores information related to network usage by replication process

type ReplSetMember

type ReplSetMember struct {
	OptimeDate time.Time `bson:"optimeDate"`
	Name       string    `bson:"name"`
	StateStr   string    `bson:"stateStr"`
	State      int64     `bson:"state"`
}

ReplSetMember stores information related to a replica set member

type ReplSetStatus

type ReplSetStatus struct {
	Members []ReplSetMember `bson:"members"`
	MyState int64           `bson:"myState"`
}

ReplSetStatus stores information from replSetGetStatus

type ReplStats

type ReplStats struct {
	Apply    *ReplApplyStats    `bson:"apply"`
	Buffer   *ReplBufferStats   `bson:"buffer"`
	Executor *ReplExecutorStats `bson:"executor,omitempty"`
	Network  *ReplNetworkStats  `bson:"network"`
}

ReplStats stores information related to replication process

type ReplStatus

type ReplStatus struct {
	SetName      interface{} `bson:"setName"`
	IsMaster     interface{} `bson:"ismaster"`
	Secondary    interface{} `bson:"secondary"`
	IsReplicaSet interface{} `bson:"isreplicaset"`
	ArbiterOnly  interface{} `bson:"arbiterOnly"`
	Me           string      `bson:"me"`
	Hosts        []string    `bson:"hosts"`
	Passives     []string    `bson:"passives"`
}

ReplStatus stores data related to replica sets.

type Server

type Server struct {
	URL     *url.URL
	Session *mgo.Session

	Log cua.Logger
	// contains filtered or unexported fields
}

type ServerStatus

type ServerStatus struct {
	LocalTime          time.Time              `bson:"localTime"`
	OpLatencies        *OpLatenciesStats      `bson:"opLatencies"`
	Mem                *MemStats              `bson:"mem"`
	Locks              map[string]LockStats   `bson:"locks,omitempty"`
	Network            *NetworkStats          `bson:"network"`
	GlobalLock         *GlobalLockStats       `bson:"globalLock"`
	Metrics            *MetricsStats          `bson:"metrics"`
	WiredTiger         *WiredTiger            `bson:"wiredTiger"`
	Asserts            *AssertsStats          `bson:"asserts"`
	BackgroundFlushing *FlushStats            `bson:"backgroundFlushing"`
	ExtraInfo          *ExtraInfo             `bson:"extra_info"`
	Connections        *ConnectionStats       `bson:"connections"`
	Dur                *DurStats              `bson:"dur"`
	TCMallocStats      *TCMallocStats         `bson:"tcmalloc"`
	StorageEngine      map[string]string      `bson:"storageEngine"`
	ShardCursorType    map[string]interface{} `bson:"shardCursorType"`
	Opcounters         *OpcountStats          `bson:"opcounters"`
	OpcountersRepl     *OpcountStats          `bson:"opcountersRepl"`
	Repl               *ReplStatus            `bson:"repl"`
	RecordStats        *DBRecordStats         `bson:"recordStats"`
	Process            string                 `bson:"process"`
	Host               string                 `bson:"host"`
	Version            string                 `bson:"version"`
	Uptime             int64                  `bson:"uptime"`
	Pid                int64                  `bson:"pid"`
	UptimeEstimate     int64                  `bson:"uptimeEstimate"`
	UptimeMillis       int64                  `bson:"uptimeMillis"`
}

type ShardHostStatLine

type ShardHostStatLine struct {
	InUse      int64
	Available  int64
	Created    int64
	Refreshing int64
}

type ShardHostStatsData

type ShardHostStatsData struct {
	InUse      int64 `bson:"inUse"`
	Available  int64 `bson:"available"`
	Created    int64 `bson:"created"`
	Refreshing int64 `bson:"refreshing"`
}

ShardHostStatsData is the host-specific stats from shardConnPoolStats database command.

type ShardStats

type ShardStats struct {
	Hosts          map[string]ShardHostStatsData `bson:"hosts"`
	ShardStatsData `bson:",inline"`
}

ShardStats stores information from shardConnPoolStats.

type ShardStatsData

type ShardStatsData struct {
	TotalInUse      int64 `bson:"totalInUse"`
	TotalAvailable  int64 `bson:"totalAvailable"`
	TotalCreated    int64 `bson:"totalCreated"`
	TotalRefreshing int64 `bson:"totalRefreshing"`
}

ShardStatsData is the total Shard Stats from shardConnPoolStats database command.

type Ssl

type Ssl struct {
	CaCerts []string `toml:"cacerts"`
	Enabled bool
}

type StatHeader

type StatHeader struct {
	// The text to appear in the column's header cell
	HeaderText string

	// Bitmask containing flags to determine if this header is active or not
	ActivateFlags int
}

StatHeader describes a single column for mongostat's terminal output, its formatting, and in which modes it should be displayed.

type StatLine

type StatLine struct {
	Time                                 time.Time
	LastPrinted                          time.Time
	Error                                error
	CollectionLocks                      *CollectionLockStatus
	ShardHostStatsLines                  map[string]ShardHostStatLine
	OplogStats                           *OplogStats
	HighestLocked                        *LockStatus
	Host                                 string
	NodeState                            string
	NodeType                             string
	ReplSetName                          string
	Version                              string
	Key                                  string
	StorageEngine                        string
	ColStatsLines                        []ColStatLine
	DbStatsLines                         []DbStatLine
	DeletedD                             int64
	AppThreadsPageReadTime               int64
	GetMoreCnt                           int64
	Command                              int64
	CommandCnt                           int64
	Regular                              int64
	Warning                              int64
	Msg                                  int64
	User                                 int64
	Rollovers                            int64
	WriteOpsCnt                          int64
	WriteLatency                         int64
	ReadOpsCnt                           int64
	ReadLatency                          int64
	CommandOpsCnt                        int64
	CommandLatency                       int64
	Passes                               int64
	PassesCnt                            int64
	DeletedDocuments                     int64
	DeletedDocumentsCnt                  int64
	TimedOutC                            int64
	TimedOutCCnt                         int64
	NoTimeoutC                           int64
	NoTimeoutCCnt                        int64
	PinnedC                              int64
	PinnedCCnt                           int64
	TotalC                               int64
	TotalCCnt                            int64
	DeleteCnt                            int64
	InsertedD                            int64
	ReturnedD                            int64
	UpdatedD                             int64
	AggregateCommandTotal                int64
	AggregateCommandFailed               int64
	CountCommandTotal                    int64
	CountCommandFailed                   int64
	DeleteCommandTotal                   int64
	DeleteCommandFailed                  int64
	DistinctCommandTotal                 int64
	DistinctCommandFailed                int64
	FindCommandTotal                     int64
	FindCommandFailed                    int64
	FindAndModifyCommandTotal            int64
	QueryR                               int64
	GetMoreCommandTotal                  int64
	GetMoreCommandFailed                 int64
	InsertCommandTotal                   int64
	InsertCommandFailed                  int64
	UpdateCommandTotal                   int64
	UpdateCommandFailed                  int64
	ScanAndOrderOp                       int64
	WriteConflictsOp                     int64
	TotalKeysScanned                     int64
	TotalObjectsScanned                  int64
	CurrentC                             int64
	AvailableC                           int64
	TotalCreatedC                        int64
	UpdateR                              int64
	CacheDirtyPercent                    float64
	CacheUsedPercent                     float64
	TrackedDirtyBytes                    int64
	CurrentCachedBytes                   int64
	MaxBytesConfigured                   int64
	AppThreadsPageReadCount              int64
	QueryRCnt                            int64
	AppThreadsPageWriteCount             int64
	BytesWrittenFrom                     int64
	BytesReadInto                        int64
	PagesEvictedByAppThread              int64
	PagesQueuedForEviction               int64
	PagesReadIntoCache                   int64
	PagesWrittenFromCache                int64
	PagesRequestedFromCache              int64
	ServerEvictingPages                  int64
	WorkerThreadEvictingPages            int64
	InternalPagesEvicted                 int64
	ModifiedPagesEvicted                 int64
	UnmodifiedPagesEvicted               int64
	InsertR                              int64
	InsertRCnt                           int64
	FindAndModifyCommandFailed           int64
	GetMore                              int64
	Delete                               int64
	UpdateRCnt                           int64
	DeleteR                              int64
	DeleteRCnt                           int64
	GetMoreR                             int64
	GetMoreRCnt                          int64
	CommandR                             int64
	CommandRCnt                          int64
	ReplLag                              int64
	UpdateCnt                            int64
	Flushes                              int64
	FlushesCnt                           int64
	FlushesTotalTime                     int64
	Mapped                               int64
	Virtual                              int64
	Resident                             int64
	NonMapped                            int64
	Faults                               int64
	FaultsCnt                            int64
	Update                               int64
	QueuedReaders                        int64
	QueuedWriters                        int64
	ActiveReaders                        int64
	ActiveWriters                        int64
	AvailableReaders                     int64
	AvailableWriters                     int64
	TotalTicketsReaders                  int64
	TotalTicketsWriters                  int64
	NetIn                                int64
	NetInCnt                             int64
	NetOut                               int64
	NetOutCnt                            int64
	NumConnections                       int64
	QueryCnt                             int64
	Query                                int64
	InsertCnt                            int64
	NodeStateInt                         int64
	ReplNetworkBytes                     int64
	ReplNetworkGetmoresNum               int64
	ReplNetworkGetmoresTotalMillis       int64
	ReplNetworkOps                       int64
	ReplBufferCount                      int64
	ReplBufferSizeBytes                  int64
	ReplApplyBatchesNum                  int64
	ReplApplyBatchesTotalMillis          int64
	ReplApplyOps                         int64
	ReplExecutorPoolInProgressCount      int64
	ReplExecutorQueuesNetworkInProgress  int64
	ReplExecutorQueuesSleepers           int64
	ReplExecutorUnsignaledEvents         int64
	JumboChunksCount                     int64
	Insert                               int64
	UptimeNanos                          int64
	TotalInUse                           int64
	TotalAvailable                       int64
	TotalCreated                         int64
	TotalRefreshing                      int64
	StorageFreelistSearchScanned         int64
	TCMallocCurrentAllocatedBytes        int64
	TCMallocHeapSize                     int64
	TCMallocCentralCacheFreeBytes        int64
	TCMallocCurrentTotalThreadCacheBytes int64
	TCMallocMaxTotalThreadCacheBytes     int64
	TCMallocTotalFreeBytes               int64
	TCMallocTransferCacheFreeBytes       int64
	TCMallocThreadCacheFreeBytes         int64
	TCMallocSpinLockTotalDelayNanos      int64
	TCMallocPageheapFreeBytes            int64
	TCMallocPageheapUnmappedBytes        int64
	TCMallocPageheapComittedBytes        int64
	TCMallocPageheapScavengeCount        int64
	TCMallocPageheapCommitCount          int64
	TCMallocPageheapTotalCommitBytes     int64
	TCMallocPageheapDecommitCount        int64
	TCMallocPageheapTotalDecommitBytes   int64
	TCMallocPageheapReserveCount         int64
	TCMallocPageheapTotalReserveBytes    int64
	StorageFreelistSearchBucketExhausted int64
	StorageFreelistSearchRequests        int64
	IsMongos                             bool
}

StatLine is a wrapper for all metrics reported by mongostat for monitored hosts.

func NewStatLine

func NewStatLine(oldMongo, newMongo MongoStatus, key string, all bool, sampleSecs int64) *StatLine

NewStatLine constructs a StatLine object from two MongoStatus objects.

type StorageStats

type StorageStats struct {
	FreelistSearchBucketExhausted int64 `bson:"freelist.search.bucketExhausted"`
	FreelistSearchRequests        int64 `bson:"freelist.search.requests"`
	FreelistSearchScanned         int64 `bson:"freelist.search.scanned"`
}

StorageStats stores information related to record allocations

type TCMallocStats

type TCMallocStats struct {
	Generic  *GenericTCMAllocStats  `bson:"generic"`
	TCMalloc *DetailedTCMallocStats `bson:"tcmalloc"`
}

TCMallocStats stores information related to TCMalloc memory allocator metrics

type TTLStats

type TTLStats struct {
	DeletedDocuments int64 `bson:"deletedDocuments"`
	Passes           int64 `bson:"passes"`
}

TTLStats stores information related to documents with a ttl index.

type TransactionStats

type TransactionStats struct {
	TransCheckpointsTotalTimeMsecs int64 `bson:"transaction checkpoint total time (msecs)"`
	TransCheckpoints               int64 `bson:"transaction checkpoints"`
}

TransactionStats stores transaction checkpoints in WiredTiger.

type WiredTiger

type WiredTiger struct {
	Transaction TransactionStats       `bson:"transaction"`
	Concurrent  ConcurrentTransactions `bson:"concurrentTransactions"`
	Cache       CacheStats             `bson:"cache"`
}

WiredTiger stores information related to the WiredTiger storage engine.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL