From 6f87eddf7737a5ba067e7d21b6200242eb701486 Mon Sep 17 00:00:00 2001 From: Parin Date: Wed, 14 Feb 2018 14:22:46 -0500 Subject: [PATCH 1/6] added new metrics for wiredtiger --- lib/sensu-plugins-mongodb/metics.rb | 339 +++++++++++++++++++++++++++- 1 file changed, 338 insertions(+), 1 deletion(-) diff --git a/lib/sensu-plugins-mongodb/metics.rb b/lib/sensu-plugins-mongodb/metics.rb index 813a705..ed9c689 100644 --- a/lib/sensu-plugins-mongodb/metics.rb +++ b/lib/sensu-plugins-mongodb/metics.rb @@ -200,7 +200,6 @@ def server_metrics # Extra info extra_info = server_status['extra_info'] - server_metrics['mem.heap_usage_bytes'] = extra_info['heap_usage_bytes'] server_metrics['mem.pageFaults'] = extra_info['page_faults'] # Global Lock @@ -255,6 +254,15 @@ def server_metrics server_metrics['network.bytesOut'] = network['bytesOut'] server_metrics['network.numRequests'] = network['numRequests'] + # OpLatencies + oplatencies = server_status['opLatencies'] + server_metrics['oplatencies.read.latency'] = oplatencies['reads']['latency'] + server_metrics['oplatencies.read.operations'] = oplatencies['reads']['ops'] + server_metrics['oplatencies.write.latency'] = oplatencies['writes']['latency'] + server_metrics['oplatencies.write.operations'] = oplatencies['writes']['ops'] + server_metrics['oplatencies.command.latency'] = oplatencies['commands']['latency'] + server_metrics['oplatencies.command.operations'] = oplatencies['commands']['ops'] + # Opcounters opcounters = server_status['opcounters'] server_metrics['opcounters.insert'] = opcounters['insert'] @@ -280,6 +288,334 @@ def server_metrics server_metrics['mem.mapped'] = mem['mapped'] server_metrics['mem.mappedWithJournal'] = mem['mappedWithJournal'] + # Malloc + malloc = server_status['tcmalloc'] + server_metrics['mem.heap_size_bytes'] = malloc['generic']['heap_size'] + server_metrics['mem.current_allocated_bytes'] = malloc['generic']['current_allocated_bytes'] + + # WiredTiger specific Metrics + if server_status.key?('wiredTiger') + wiredTiger = server_status['wiredTiger'] + # data_handle Metrics + data_handle = wiredTiger['data-handle'] + server_metrics['wiredTiger.data_handle.session_dhandles_swept'] = data_handle['session dhandles swept'] + server_metrics['wiredTiger.data_handle.connection_sweeps'] = data_handle['connection sweeps'] + server_metrics['wiredTiger.data_handle.connection_sweep_dhandles_removed_from_hash_list'] = data_handle['connection sweep dhandles removed from hash list'] + server_metrics['wiredTiger.data_handle.connection_data_handles_currently_active'] = data_handle['connection data handles currently active'] + server_metrics['wiredTiger.data_handle.connection_sweep_dhandles_closed'] = data_handle['connection sweep dhandles closed'] + server_metrics['wiredTiger.data_handle.session_sweep_attempts'] = data_handle['session sweep attempts'] + server_metrics['wiredTiger.data_handle.connection_sweep_candidate_became_referenced'] = data_handle['connection sweep candidate became referenced'] + server_metrics['wiredTiger.data_handle.connection_sweep_time-of-death_sets'] = data_handle['connection sweep time-of-death sets'] + + + # reconciliation Metrics + reconciliation = wiredTiger['reconciliation'] + server_metrics['wiredTiger.reconciliation.fast-path_pages_deleted'] = reconciliation['fast-path pages deleted'] + server_metrics['wiredTiger.reconciliation.split_objects_currently_awaiting_free'] = reconciliation['split objects currently awaiting free'] + server_metrics['wiredTiger.reconciliation.split_bytes_currently_awaiting_free'] = reconciliation['split bytes currently awaiting free'] + server_metrics['wiredTiger.reconciliation.pages_deleted'] = reconciliation['pages deleted'] + server_metrics['wiredTiger.reconciliation.page_reconciliation_calls_for_eviction'] = reconciliation['page reconciliation calls for eviction'] + server_metrics['wiredTiger.reconciliation.page_reconciliation_calls'] = reconciliation['page reconciliation calls'] + + + # cache Metrics + cache = wiredTiger['cache'] + server_metrics['wiredTiger.cache.unmodified_pages_evicted'] = cache['unmodified pages evicted'] + server_metrics['wiredTiger.cache.eviction_server_evicting_pages'] = cache['eviction server evicting pages'] + server_metrics['wiredTiger.cache.tracked_dirty_pages_in_the_cache'] = cache['tracked dirty pages in the cache'] + server_metrics['wiredTiger.cache.overflow_values_cached_in_memory'] = cache['overflow values cached in memory'] + server_metrics['wiredTiger.cache.eviction_calls_to_get_a_page_found_queue_empty_after_locking'] = cache['eviction calls to get a page found queue empty after locking'] + server_metrics['wiredTiger.cache.internal_pages_split_during_eviction'] = cache['internal pages split during eviction'] + server_metrics['wiredTiger.cache.application_threads_page_write_from_cache_to_disk_time_(usecs)'] = cache['application threads page write from cache to disk time (usecs)'] + server_metrics['wiredTiger.cache.page_split_during_eviction_deepened_the_tree'] = cache['page split during eviction deepened the tree'] + server_metrics['wiredTiger.cache.leaf_pages_split_during_eviction'] = cache['leaf pages split during eviction'] + server_metrics['wiredTiger.cache.pages_walked_for_eviction'] = cache['pages walked for eviction'] + server_metrics['wiredTiger.cache.percentage_overhead'] = cache['percentage overhead'] + server_metrics['wiredTiger.cache.pages_evicted_by_application_threads'] = cache['pages evicted by application threads'] + server_metrics['wiredTiger.cache.tracked_dirty_bytes_in_the_cache'] = cache['tracked dirty bytes in the cache'] + server_metrics['wiredTiger.cache.maximum_page_size_at_eviction'] = cache['maximum page size at eviction'] + server_metrics['wiredTiger.cache.failed_eviction_of_pages_that_exceeded_the_in-memory_maximum'] = cache['failed eviction of pages that exceeded the in-memory maximum'] + server_metrics['wiredTiger.cache.application_threads_page_write_from_cache_to_disk_count'] = cache['application threads page write from cache to disk count'] + server_metrics['wiredTiger.cache.eviction_worker_thread_stable_number'] = cache['eviction worker thread stable number'] + server_metrics['wiredTiger.cache.pages_evicted_because_they_exceeded_the_in-memory_maximum'] = cache['pages evicted because they exceeded the in-memory maximum'] + server_metrics['wiredTiger.cache.tracked_bytes_belonging_to_leaf_pages_in_the_cache'] = cache['tracked bytes belonging to leaf pages in the cache'] + server_metrics['wiredTiger.cache.eviction_server_candidate_queue_empty_when_topping_up'] = cache['eviction server candidate queue empty when topping up'] + server_metrics['wiredTiger.cache.bytes_written_from_cache'] = cache['bytes written from cache'] + server_metrics['wiredTiger.cache.force_re-tuning_of_eviction_workers_once_in_a_while'] = cache['force re-tuning of eviction workers once in a while'] + server_metrics['wiredTiger.cache.eviction_empty_score'] = cache['eviction empty score'] + server_metrics['wiredTiger.cache.eviction_server_slept,_because_we_did_not_make_progress_with_eviction'] = cache['eviction server slept, because we did not make progress with eviction'] + server_metrics['wiredTiger.cache.pages_queued_for_urgent_eviction'] = cache['pages queued for urgent eviction'] + server_metrics['wiredTiger.cache.eviction_walks_abandoned'] = cache['eviction walks abandoned'] + server_metrics['wiredTiger.cache.eviction_currently_operating_in_aggressive_mode'] = cache['eviction currently operating in aggressive mode'] + server_metrics['wiredTiger.cache.application_threads_page_read_from_disk_to_cache_count'] = cache['application threads page read from disk to cache count'] + server_metrics['wiredTiger.cache.tracked_bytes_belonging_to_internal_pages_in_the_cache'] = cache['tracked bytes belonging to internal pages in the cache'] + server_metrics['wiredTiger.cache.bytes_currently_in_the_cache'] = cache['bytes currently in the cache'] + server_metrics['wiredTiger.cache.pages_selected_for_eviction_unable_to_be_evicted'] = cache['pages selected for eviction unable to be evicted'] + server_metrics['wiredTiger.cache.hazard_pointer_maximum_array_length'] = cache['hazard pointer maximum array length'] + server_metrics['wiredTiger.cache.lookaside_table_remove_calls'] = cache['lookaside table remove calls'] + server_metrics['wiredTiger.cache.in-memory_page_passed_criteria_to_be_split'] = cache['in-memory page passed criteria to be split'] + server_metrics['wiredTiger.cache.eviction_state'] = cache['eviction state'] + server_metrics['wiredTiger.cache.checkpoint_blocked_page_eviction'] = cache['checkpoint blocked page eviction'] + server_metrics['wiredTiger.cache.pages_queued_for_urgent_eviction_during_walk'] = cache['pages queued for urgent eviction during walk'] + server_metrics['wiredTiger.cache.eviction_calls_to_get_a_page_found_queue_empty'] = cache['eviction calls to get a page found queue empty'] + server_metrics['wiredTiger.cache.application_threads_page_read_from_disk_to_cache_time_(usecs)'] = cache['application threads page read from disk to cache time (usecs)'] + server_metrics['wiredTiger.cache.pages_written_from_cache'] = cache['pages written from cache'] + server_metrics['wiredTiger.cache.eviction_calls_to_get_a_page'] = cache['eviction calls to get a page'] + server_metrics['wiredTiger.cache.modified_pages_evicted_by_application_threads'] = cache['modified pages evicted by application threads'] + server_metrics['wiredTiger.cache.pages_seen_by_eviction_walk'] = cache['pages seen by eviction walk'] + server_metrics['wiredTiger.cache.eviction_worker_thread_evicting_pages'] = cache['eviction worker thread evicting pages'] + server_metrics['wiredTiger.cache.bytes_read_into_cache'] = cache['bytes read into cache'] + server_metrics['wiredTiger.cache.page_written_requiring_lookaside_records'] = cache['page written requiring lookaside records'] + server_metrics['wiredTiger.cache.hazard_pointer_blocked_page_eviction'] = cache['hazard pointer blocked page eviction'] + server_metrics['wiredTiger.cache.lookaside_table_insert_calls'] = cache['lookaside table insert calls'] + server_metrics['wiredTiger.cache.bytes_not_belonging_to_page_images_in_the_cache'] = cache['bytes not belonging to page images in the cache'] + server_metrics['wiredTiger.cache.pages_read_into_cache'] = cache['pages read into cache'] + server_metrics['wiredTiger.cache.pages_written_requiring_in-memory_restoration'] = cache['pages written requiring in-memory restoration'] + server_metrics['wiredTiger.cache.pages_evicted_because_they_had_chains_of_deleted_items'] = cache['pages evicted because they had chains of deleted items'] + server_metrics['wiredTiger.cache.files_with_new_eviction_walks_started'] = cache['files with new eviction walks started'] + server_metrics['wiredTiger.cache.pages_queued_for_eviction'] = cache['pages queued for eviction'] + server_metrics['wiredTiger.cache.eviction_worker_thread_removed'] = cache['eviction worker thread removed'] + server_metrics['wiredTiger.cache.eviction_worker_thread_active'] = cache['eviction worker thread active'] + server_metrics['wiredTiger.cache.pages_requested_from_the_cache'] = cache['pages requested from the cache'] + server_metrics['wiredTiger.cache.pages_read_into_cache_requiring_lookaside_entries'] = cache['pages read into cache requiring lookaside entries'] + server_metrics['wiredTiger.cache.eviction_server_candidate_queue_not_empty_when_topping_up'] = cache['eviction server candidate queue not empty when topping up'] + server_metrics['wiredTiger.cache.files_with_active_eviction_walks'] = cache['files with active eviction walks'] + server_metrics['wiredTiger.cache.hazard_pointer_check_entries_walked'] = cache['hazard pointer check entries walked'] + server_metrics['wiredTiger.cache.in-memory_page_splits'] = cache['in-memory page splits'] + server_metrics['wiredTiger.cache.internal_pages_evicted'] = cache['internal pages evicted'] + server_metrics['wiredTiger.cache.eviction_worker_thread_created'] = cache['eviction worker thread created'] + server_metrics['wiredTiger.cache.overflow_pages_read_into_cache'] = cache['overflow pages read into cache'] + server_metrics['wiredTiger.cache.maximum_bytes_configured'] = cache['maximum bytes configured'] + server_metrics['wiredTiger.cache.pages_currently_held_in_the_cache'] = cache['pages currently held in the cache'] + server_metrics['wiredTiger.cache.modified_pages_evicted'] = cache['modified pages evicted'] + server_metrics['wiredTiger.cache.eviction_server_unable_to_reach_eviction_goal'] = cache['eviction server unable to reach eviction goal'] + server_metrics['wiredTiger.cache.bytes_belonging_to_page_images_in_the_cache'] = cache['bytes belonging to page images in the cache'] + server_metrics['wiredTiger.cache.hazard_pointer_check_calls'] = cache['hazard pointer check calls'] + + + # log Metrics + log = wiredTiger['log'] + server_metrics['wiredTiger.log.log_sync_dir_operations'] = log['log sync_dir operations'] + server_metrics['wiredTiger.log.log_sync_dir_time_duration_(usecs)'] = log['log sync_dir time duration (usecs)'] + server_metrics['wiredTiger.log.log_write_operations'] = log['log write operations'] + server_metrics['wiredTiger.log.log_server_thread_advances_write_LSN'] = log['log server thread advances write LSN'] + server_metrics['wiredTiger.log.consolidated_slot_join_races'] = log['consolidated slot join races'] + server_metrics['wiredTiger.log.maximum_log_file_size'] = log['maximum log file size'] + server_metrics['wiredTiger.log.records_processed_by_log_scan'] = log['records processed by log scan'] + server_metrics['wiredTiger.log.total_log_buffer_size'] = log['total log buffer size'] + server_metrics['wiredTiger.log.log_records_too_small_to_compress'] = log['log records too small to compress'] + server_metrics['wiredTiger.log.log_force_write_operations_skipped'] = log['log force write operations skipped'] + server_metrics['wiredTiger.log.log_scan_operations'] = log['log scan operations'] + server_metrics['wiredTiger.log.pre-allocated_log_files_used'] = log['pre-allocated log files used'] + server_metrics['wiredTiger.log.pre-allocated_log_files_not_ready_and_missed'] = log['pre-allocated log files not ready and missed'] + server_metrics['wiredTiger.log.total_size_of_compressed_records'] = log['total size of compressed records'] + server_metrics['wiredTiger.log.pre-allocated_log_files_prepared'] = log['pre-allocated log files prepared'] + server_metrics['wiredTiger.log.log_sync_time_duration_(usecs)'] = log['log sync time duration (usecs)'] + server_metrics['wiredTiger.log.total_in-memory_size_of_compressed_records'] = log['total in-memory size of compressed records'] + server_metrics['wiredTiger.log.yields_waiting_for_previous_log_file_close'] = log['yields waiting for previous log file close'] + server_metrics['wiredTiger.log.log_records_not_compressed'] = log['log records not compressed'] + server_metrics['wiredTiger.log.log_force_write_operations'] = log['log force write operations'] + server_metrics['wiredTiger.log.consolidated_slot_unbuffered_writes'] = log['consolidated slot unbuffered writes'] + server_metrics['wiredTiger.log.written_slots_coalesced'] = log['written slots coalesced'] + server_metrics['wiredTiger.log.consolidated_slot_join_active_slot_closed'] = log['consolidated slot join active slot closed'] + server_metrics['wiredTiger.log.log_records_compressed'] = log['log records compressed'] + server_metrics['wiredTiger.log.number_of_pre-allocated_log_files_to_create'] = log['number of pre-allocated log files to create'] + server_metrics['wiredTiger.log.log_bytes_written'] = log['log bytes written'] + server_metrics['wiredTiger.log.busy_returns_attempting_to_switch_slots'] = log['busy returns attempting to switch slots'] + server_metrics['wiredTiger.log.consolidated_slot_transitions_unable_to_find_free_slot'] = log['consolidated slot transitions unable to find free slot'] + server_metrics['wiredTiger.log.consolidated_slot_joins'] = log['consolidated slot joins'] + server_metrics['wiredTiger.log.log_files_manually_zero-filled'] = log['log files manually zero-filled'] + server_metrics['wiredTiger.log.log_bytes_of_payload_data'] = log['log bytes of payload data'] + server_metrics['wiredTiger.log.log_flush_operations'] = log['log flush operations'] + server_metrics['wiredTiger.log.log_sync_operations'] = log['log sync operations'] + server_metrics['wiredTiger.log.log_scan_records_requiring_two_reads'] = log['log scan records requiring two reads'] + server_metrics['wiredTiger.log.logging_bytes_consolidated'] = log['logging bytes consolidated'] + server_metrics['wiredTiger.log.log_server_thread_write_LSN_walk_skipped'] = log['log server thread write LSN walk skipped'] + server_metrics['wiredTiger.log.consolidated_slot_join_transitions'] = log['consolidated slot join transitions'] + server_metrics['wiredTiger.log.log_release_advances_write_LSN'] = log['log release advances write LSN'] + server_metrics['wiredTiger.log.consolidated_slot_closures'] = log['consolidated slot closures'] + + + # lock Metrics + lock = wiredTiger['lock'] + server_metrics['wiredTiger.lock.schema_lock_application_thread_wait_time_(usecs)'] = lock['schema lock application thread wait time (usecs)'] + server_metrics['wiredTiger.lock.table_lock_application_thread_time_waiting_for_the_table_lock_(usecs)'] = lock['table lock application thread time waiting for the table lock (usecs)'] + server_metrics['wiredTiger.lock.checkpoint_lock_internal_thread_wait_time_(usecs)'] = lock['checkpoint lock internal thread wait time (usecs)'] + server_metrics['wiredTiger.lock.schema_lock_acquisitions'] = lock['schema lock acquisitions'] + server_metrics['wiredTiger.lock.handle-list_lock_eviction_thread_wait_time_(usecs)'] = lock['handle-list lock eviction thread wait time (usecs)'] + server_metrics['wiredTiger.lock.checkpoint_lock_acquisitions'] = lock['checkpoint lock acquisitions'] + server_metrics['wiredTiger.lock.table_lock_internal_thread_time_waiting_for_the_table_lock_(usecs)'] = lock['table lock internal thread time waiting for the table lock (usecs)'] + server_metrics['wiredTiger.lock.checkpoint_lock_application_thread_wait_time_(usecs)'] = lock['checkpoint lock application thread wait time (usecs)'] + server_metrics['wiredTiger.lock.table_lock_acquisitions'] = lock['table lock acquisitions'] + server_metrics['wiredTiger.lock.metadata_lock_application_thread_wait_time_(usecs)'] = lock['metadata lock application thread wait time (usecs)'] + server_metrics['wiredTiger.lock.schema_lock_internal_thread_wait_time_(usecs)'] = lock['schema lock internal thread wait time (usecs)'] + server_metrics['wiredTiger.lock.metadata_lock_internal_thread_wait_time_(usecs)'] = lock['metadata lock internal thread wait time (usecs)'] + server_metrics['wiredTiger.lock.metadata_lock_acquisitions'] = lock['metadata lock acquisitions'] + + + # # LSM Metrics + # LSM = wiredTiger['LSM'] + # server_metrics['wiredTiger.LSM.sleep_for_LSM_merge_throttle'] = LSM['sleep for LSM merge throttle'] + # server_metrics['wiredTiger.LSM.application_work_units_currently_queued'] = LSM['application work units currently queued'] + # server_metrics['wiredTiger.LSM.rows_merged_in_an_LSM_tree'] = LSM['rows merged in an LSM tree'] + # server_metrics['wiredTiger.LSM.switch_work_units_currently_queued'] = LSM['switch work units currently queued'] + # server_metrics['wiredTiger.LSM.merge_work_units_currently_queued'] = LSM['merge work units currently queued'] + # server_metrics['wiredTiger.LSM.tree_maintenance_operations_discarded'] = LSM['tree maintenance operations discarded'] + # server_metrics['wiredTiger.LSM.sleep_for_LSM_checkpoint_throttle'] = LSM['sleep for LSM checkpoint throttle'] + # server_metrics['wiredTiger.LSM.tree_maintenance_operations_executed'] = LSM['tree maintenance operations executed'] + # server_metrics['wiredTiger.LSM.tree_maintenance_operations_scheduled'] = LSM['tree maintenance operations scheduled'] + # server_metrics['wiredTiger.LSM.tree_queue_hit_maximum'] = LSM['tree queue hit maximum'] + + + # transaction Metrics + transaction = wiredTiger['transaction'] + server_metrics['wiredTiger.transaction.number_of_named_snapshots_dropped'] = transaction['number of named snapshots dropped'] + server_metrics['wiredTiger.transaction.transaction_checkpoint_currently_running'] = transaction['transaction checkpoint currently running'] + server_metrics['wiredTiger.transaction.transaction_begins'] = transaction['transaction begins'] + server_metrics['wiredTiger.transaction.transaction_fsync_calls_for_checkpoint_after_allocating_the_transaction_ID'] = transaction['transaction fsync calls for checkpoint after allocating the transaction ID'] + server_metrics['wiredTiger.transaction.transactions_committed'] = transaction['transactions committed'] + server_metrics['wiredTiger.transaction.transaction_checkpoint_most_recent_time_(msecs)'] = transaction['transaction checkpoint most recent time (msecs)'] + server_metrics['wiredTiger.transaction.transaction_checkpoints'] = transaction['transaction checkpoints'] + server_metrics['wiredTiger.transaction.transaction_range_of_IDs_currently_pinned_by_a_checkpoint'] = transaction['transaction range of IDs currently pinned by a checkpoint'] + server_metrics['wiredTiger.transaction.transaction_sync_calls'] = transaction['transaction sync calls'] + server_metrics['wiredTiger.transaction.transaction_checkpoint_scrub_dirty_target'] = transaction['transaction checkpoint scrub dirty target'] + server_metrics['wiredTiger.transaction.transaction_fsync_duration_for_checkpoint_after_allocating_the_transaction_ID_(usecs)'] = transaction['transaction fsync duration for checkpoint after allocating the transaction ID (usecs)'] + server_metrics['wiredTiger.transaction.transaction_checkpoints_skipped_because_database_was_clean'] = transaction['transaction checkpoints skipped because database was clean'] + server_metrics['wiredTiger.transaction.transaction_checkpoint_scrub_time_(msecs)'] = transaction['transaction checkpoint scrub time (msecs)'] + server_metrics['wiredTiger.transaction.transaction_checkpoint_max_time_(msecs)'] = transaction['transaction checkpoint max time (msecs)'] + server_metrics['wiredTiger.transaction.number_of_named_snapshots_created'] = transaction['number of named snapshots created'] + server_metrics['wiredTiger.transaction.transaction_checkpoint_min_time_(msecs)'] = transaction['transaction checkpoint min time (msecs)'] + server_metrics['wiredTiger.transaction.transaction_checkpoint_total_time_(msecs)'] = transaction['transaction checkpoint total time (msecs)'] + server_metrics['wiredTiger.transaction.transaction_checkpoint_generation'] = transaction['transaction checkpoint generation'] + server_metrics['wiredTiger.transaction.transaction_failures_due_to_cache_overflow'] = transaction['transaction failures due to cache overflow'] + server_metrics['wiredTiger.transaction.transaction_range_of_IDs_currently_pinned_by_named_snapshots'] = transaction['transaction range of IDs currently pinned by named snapshots'] + server_metrics['wiredTiger.transaction.transactions_rolled_back'] = transaction['transactions rolled back'] + server_metrics['wiredTiger.transaction.transaction_range_of_IDs_currently_pinned'] = transaction['transaction range of IDs currently pinned'] + + + # cursor Metrics + cursor = wiredTiger['cursor'] + server_metrics['wiredTiger.cursor.cursor_restarted_searches'] = cursor['cursor restarted searches'] + server_metrics['wiredTiger.cursor.cursor_prev_calls'] = cursor['cursor prev calls'] + server_metrics['wiredTiger.cursor.cursor_insert_calls'] = cursor['cursor insert calls'] + server_metrics['wiredTiger.cursor.cursor_reset_calls'] = cursor['cursor reset calls'] + server_metrics['wiredTiger.cursor.cursor_update_calls'] = cursor['cursor update calls'] + server_metrics['wiredTiger.cursor.cursor_search_near_calls'] = cursor['cursor search near calls'] + server_metrics['wiredTiger.cursor.cursor_search_calls'] = cursor['cursor search calls'] + server_metrics['wiredTiger.cursor.cursor_next_calls'] = cursor['cursor next calls'] + server_metrics['wiredTiger.cursor.cursor_create_calls'] = cursor['cursor create calls'] + server_metrics['wiredTiger.cursor.truncate_calls'] = cursor['truncate calls'] + server_metrics['wiredTiger.cursor.cursor_remove_calls'] = cursor['cursor remove calls'] + + + # connection Metrics + connection = wiredTiger['connection'] + server_metrics['wiredTiger.connection.total_read_I/Os'] = connection['total read I/Os'] + server_metrics['wiredTiger.connection.memory_re-allocations'] = connection['memory re-allocations'] + server_metrics['wiredTiger.connection.pthread_mutex_shared_lock_write-lock_calls'] = connection['pthread mutex shared lock write-lock calls'] + server_metrics['wiredTiger.connection.auto_adjusting_condition_resets'] = connection['auto adjusting condition resets'] + server_metrics['wiredTiger.connection.detected_system_time_went_backwards'] = connection['detected system time went backwards'] + server_metrics['wiredTiger.connection.pthread_mutex_condition_wait_calls'] = connection['pthread mutex condition wait calls'] + server_metrics['wiredTiger.connection.memory_frees'] = connection['memory frees'] + server_metrics['wiredTiger.connection.pthread_mutex_shared_lock_read-lock_calls'] = connection['pthread mutex shared lock read-lock calls'] + server_metrics['wiredTiger.connection.total_fsync_I/Os'] = connection['total fsync I/Os'] + server_metrics['wiredTiger.connection.files_currently_open'] = connection['files currently open'] + server_metrics['wiredTiger.connection.memory_allocations'] = connection['memory allocations'] + server_metrics['wiredTiger.connection.auto_adjusting_condition_wait_calls'] = connection['auto adjusting condition wait calls'] + server_metrics['wiredTiger.connection.total_write_I/Os'] = connection['total write I/Os'] + + + # session Metrics + session = wiredTiger['session'] + server_metrics['wiredTiger.session.table_drop_successful_calls'] = session['table drop successful calls'] + server_metrics['wiredTiger.session.table_alter_unchanged_and_skipped'] = session['table alter unchanged and skipped'] + server_metrics['wiredTiger.session.table_truncate_failed_calls'] = session['table truncate failed calls'] + server_metrics['wiredTiger.session.table_compact_failed_calls'] = session['table compact failed calls'] + server_metrics['wiredTiger.session.table_salvage_successful_calls'] = session['table salvage successful calls'] + server_metrics['wiredTiger.session.open_cursor_count'] = session['open cursor count'] + server_metrics['wiredTiger.session.table_create_failed_calls'] = session['table create failed calls'] + server_metrics['wiredTiger.session.table_create_successful_calls'] = session['table create successful calls'] + server_metrics['wiredTiger.session.table_verify_successful_calls'] = session['table verify successful calls'] + server_metrics['wiredTiger.session.table_drop_failed_calls'] = session['table drop failed calls'] + server_metrics['wiredTiger.session.open_session_count'] = session['open session count'] + server_metrics['wiredTiger.session.table_verify_failed_calls'] = session['table verify failed calls'] + server_metrics['wiredTiger.session.table_rename_successful_calls'] = session['table rename successful calls'] + server_metrics['wiredTiger.session.table_rebalance_failed_calls'] = session['table rebalance failed calls'] + server_metrics['wiredTiger.session.table_alter_failed_calls'] = session['table alter failed calls'] + server_metrics['wiredTiger.session.table_rebalance_successful_calls'] = session['table rebalance successful calls'] + server_metrics['wiredTiger.session.table_salvage_failed_calls'] = session['table salvage failed calls'] + server_metrics['wiredTiger.session.table_truncate_successful_calls'] = session['table truncate successful calls'] + server_metrics['wiredTiger.session.table_alter_successful_calls'] = session['table alter successful calls'] + server_metrics['wiredTiger.session.table_compact_successful_calls'] = session['table compact successful calls'] + server_metrics['wiredTiger.session.table_rename_failed_calls'] = session['table rename failed calls'] + + + # block_manager Metrics + block_manager = wiredTiger['block-manager'] + server_metrics['wiredTiger.block_manager.bytes_read'] = block_manager['bytes read'] + server_metrics['wiredTiger.block_manager.blocks_read'] = block_manager['blocks read'] + server_metrics['wiredTiger.block_manager.blocks_pre-loaded'] = block_manager['blocks pre-loaded'] + server_metrics['wiredTiger.block_manager.bytes_written'] = block_manager['bytes written'] + server_metrics['wiredTiger.block_manager.mapped_bytes_read'] = block_manager['mapped bytes read'] + server_metrics['wiredTiger.block_manager.bytes_written_for_checkpoint'] = block_manager['bytes written for checkpoint'] + server_metrics['wiredTiger.block_manager.blocks_written'] = block_manager['blocks written'] + server_metrics['wiredTiger.block_manager.mapped_blocks_read'] = block_manager['mapped blocks read'] + + + # thread_yield Metrics + thread_yield = wiredTiger['thread-yield'] + server_metrics['wiredTiger.thread_yield.page_acquire_busy_blocked'] = thread_yield['page acquire busy blocked'] + server_metrics['wiredTiger.thread_yield.page_reconciliation_yielded_due_to_child_modification'] = thread_yield['page reconciliation yielded due to child modification'] + server_metrics['wiredTiger.thread_yield.data_handle_lock_yielded'] = thread_yield['data handle lock yielded'] + server_metrics['wiredTiger.thread_yield.connection_close_blocked_waiting_for_transaction_state_stabilization'] = thread_yield['connection close blocked waiting for transaction state stabilization'] + server_metrics['wiredTiger.thread_yield.connection_close_yielded_for_lsm_manager_shutdown'] = thread_yield['connection close yielded for lsm manager shutdown'] + server_metrics['wiredTiger.thread_yield.application_thread_time_evicting_(usecs)'] = thread_yield['application thread time evicting (usecs)'] + server_metrics['wiredTiger.thread_yield.reference_for_page_index_and_slot_yielded'] = thread_yield['reference for page index and slot yielded'] + server_metrics['wiredTiger.thread_yield.page_acquire_read_blocked'] = thread_yield['page acquire read blocked'] + server_metrics['wiredTiger.thread_yield.log_server_sync_yielded_for_log_write'] = thread_yield['log server sync yielded for log write'] + server_metrics['wiredTiger.thread_yield.page_acquire_locked_blocked'] = thread_yield['page acquire locked blocked'] + server_metrics['wiredTiger.thread_yield.page_delete_rollback_yielded_for_instantiation'] = thread_yield['page delete rollback yielded for instantiation'] + server_metrics['wiredTiger.thread_yield.tree_descend_one_level_yielded_for_split_page_index_update'] = thread_yield['tree descend one level yielded for split page index update'] + server_metrics['wiredTiger.thread_yield.page_acquire_eviction_blocked'] = thread_yield['page acquire eviction blocked'] + server_metrics['wiredTiger.thread_yield.application_thread_time_waiting_for_cache_(usecs)'] = thread_yield['application thread time waiting for cache (usecs)'] + server_metrics['wiredTiger.thread_yield.page_acquire_time_sleeping_(usecs)'] = thread_yield['page acquire time sleeping (usecs)'] + + + # async Metrics + async = wiredTiger['async'] + server_metrics['wiredTiger.async.total_insert_calls'] = async['total insert calls'] + server_metrics['wiredTiger.async.total_remove_calls'] = async['total remove calls'] + server_metrics['wiredTiger.async.number_of_operation_slots_viewed_for_allocation'] = async['number of operation slots viewed for allocation'] + server_metrics['wiredTiger.async.total_allocations'] = async['total allocations'] + server_metrics['wiredTiger.async.current_work_queue_length'] = async['current work queue length'] + server_metrics['wiredTiger.async.number_of_flush_calls'] = async['number of flush calls'] + server_metrics['wiredTiger.async.maximum_work_queue_length'] = async['maximum work queue length'] + server_metrics['wiredTiger.async.total_compact_calls'] = async['total compact calls'] + server_metrics['wiredTiger.async.total_update_calls'] = async['total update calls'] + server_metrics['wiredTiger.async.number_of_allocation_state_races'] = async['number of allocation state races'] + server_metrics['wiredTiger.async.number_of_times_operation_allocation_failed'] = async['number of times operation allocation failed'] + server_metrics['wiredTiger.async.number_of_times_worker_found_no_work'] = async['number of times worker found no work'] + server_metrics['wiredTiger.async.total_search_calls'] = async['total search calls'] + + + # concurrentTransactions Metrics + concurrentTransactions = wiredTiger['concurrentTransactions'] + server_metrics['wiredTiger.concurrentTransactions.write.out'] = concurrentTransactions['write']['out'] + server_metrics['wiredTiger.concurrentTransactions.write.available'] = concurrentTransactions['write']['available'] + server_metrics['wiredTiger.concurrentTransactions.write.totalTickets'] = concurrentTransactions['write']['totalTickets'] + + server_metrics['wiredTiger.concurrentTransactions.read.out'] = concurrentTransactions['read']['out'] + server_metrics['wiredTiger.concurrentTransactions.read.available'] = concurrentTransactions['read']['available'] + server_metrics['wiredTiger.concurrentTransactions.read.totalTickets'] = concurrentTransactions['read']['totalTickets'] + + # thread-state Metrics + thread_state = wiredTiger['thread-state'] + server_metrics['wiredTiger.thread_state.active_filesystem_write_calls'] = thread_state['active filesystem write calls'] + server_metrics['wiredTiger.thread_state.active_filesystem_read_calls'] = thread_state['active filesystem read calls'] + server_metrics['wiredTiger.thread_state.active_filesystem_fsync_calls'] = thread_state['active filesystem fsync calls'] + + end + # Metrics (documents) document = server_status['metrics']['document'] server_metrics['metrics.document.deleted'] = document['deleted'] @@ -392,3 +728,4 @@ def get_mongo_client(db_name) end end end + From 926efbe1c3c6f7084b1ecae3db27161f93c2794b Mon Sep 17 00:00:00 2001 From: Parin Date: Wed, 14 Feb 2018 17:22:05 -0500 Subject: [PATCH 2/6] Minor fixes --- lib/sensu-plugins-mongodb/metics.rb | 36 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/sensu-plugins-mongodb/metics.rb b/lib/sensu-plugins-mongodb/metics.rb index ed9c689..44e59fa 100644 --- a/lib/sensu-plugins-mongodb/metics.rb +++ b/lib/sensu-plugins-mongodb/metics.rb @@ -201,7 +201,7 @@ def server_metrics # Extra info extra_info = server_status['extra_info'] server_metrics['mem.pageFaults'] = extra_info['page_faults'] - + server_metrics['mem.heap_size_bytes'] = extra_info['heap_size'] # Global Lock global_lock = server_status['globalLock'] server_metrics['lock.totalTime'] = global_lock['totalTime'] @@ -289,10 +289,11 @@ def server_metrics server_metrics['mem.mappedWithJournal'] = mem['mappedWithJournal'] # Malloc - malloc = server_status['tcmalloc'] - server_metrics['mem.heap_size_bytes'] = malloc['generic']['heap_size'] - server_metrics['mem.current_allocated_bytes'] = malloc['generic']['current_allocated_bytes'] - + if server_status.key?('wiredTiger') + malloc = server_status['tcmalloc'] + server_metrics['mem.heap_size_bytes'] = malloc['generic']['heap_size'] + server_metrics['mem.current_allocated_bytes'] = malloc['generic']['current_allocated_bytes'] + end # WiredTiger specific Metrics if server_status.key?('wiredTiger') wiredTiger = server_status['wiredTiger'] @@ -453,18 +454,18 @@ def server_metrics server_metrics['wiredTiger.lock.metadata_lock_acquisitions'] = lock['metadata lock acquisitions'] - # # LSM Metrics - # LSM = wiredTiger['LSM'] - # server_metrics['wiredTiger.LSM.sleep_for_LSM_merge_throttle'] = LSM['sleep for LSM merge throttle'] - # server_metrics['wiredTiger.LSM.application_work_units_currently_queued'] = LSM['application work units currently queued'] - # server_metrics['wiredTiger.LSM.rows_merged_in_an_LSM_tree'] = LSM['rows merged in an LSM tree'] - # server_metrics['wiredTiger.LSM.switch_work_units_currently_queued'] = LSM['switch work units currently queued'] - # server_metrics['wiredTiger.LSM.merge_work_units_currently_queued'] = LSM['merge work units currently queued'] - # server_metrics['wiredTiger.LSM.tree_maintenance_operations_discarded'] = LSM['tree maintenance operations discarded'] - # server_metrics['wiredTiger.LSM.sleep_for_LSM_checkpoint_throttle'] = LSM['sleep for LSM checkpoint throttle'] - # server_metrics['wiredTiger.LSM.tree_maintenance_operations_executed'] = LSM['tree maintenance operations executed'] - # server_metrics['wiredTiger.LSM.tree_maintenance_operations_scheduled'] = LSM['tree maintenance operations scheduled'] - # server_metrics['wiredTiger.LSM.tree_queue_hit_maximum'] = LSM['tree queue hit maximum'] + # LSM Metrics + LSM = wiredTiger['LSM'] + server_metrics['wiredTiger.LSM.sleep_for_LSM_merge_throttle'] = LSM['sleep for LSM merge throttle'] + server_metrics['wiredTiger.LSM.application_work_units_currently_queued'] = LSM['application work units currently queued'] + server_metrics['wiredTiger.LSM.rows_merged_in_an_LSM_tree'] = LSM['rows merged in an LSM tree'] + server_metrics['wiredTiger.LSM.switch_work_units_currently_queued'] = LSM['switch work units currently queued'] + server_metrics['wiredTiger.LSM.merge_work_units_currently_queued'] = LSM['merge work units currently queued'] + server_metrics['wiredTiger.LSM.tree_maintenance_operations_discarded'] = LSM['tree maintenance operations discarded'] + server_metrics['wiredTiger.LSM.sleep_for_LSM_checkpoint_throttle'] = LSM['sleep for LSM checkpoint throttle'] + server_metrics['wiredTiger.LSM.tree_maintenance_operations_executed'] = LSM['tree maintenance operations executed'] + server_metrics['wiredTiger.LSM.tree_maintenance_operations_scheduled'] = LSM['tree maintenance operations scheduled'] + server_metrics['wiredTiger.LSM.tree_queue_hit_maximum'] = LSM['tree queue hit maximum'] # transaction Metrics @@ -728,4 +729,3 @@ def get_mongo_client(db_name) end end end - From 18b78d72fea095ef629fb36f2197739d67bd2397 Mon Sep 17 00:00:00 2001 From: Parin Date: Wed, 14 Feb 2018 17:25:23 -0500 Subject: [PATCH 3/6] Added Change log --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f51bc70..55415df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ This CHANGELOG follows the format located [here](https://github.com/sensu-plugin ## [Unreleased] +## [2.0.2] - 2018-02-14 +### New Feature +- Adds WiredTiger Matrics (@parin921996) + ## [2.0.1] - 2017-10-19 ### Fixed - updating the read preferences for `2.2`-`2.8` pymongo clients (@urg) From bfb4605f6c5cbbc0274806917faae65301643686 Mon Sep 17 00:00:00 2001 From: Parin Date: Thu, 13 Sep 2018 14:52:51 -0400 Subject: [PATCH 4/6] Fix some test and optional arguments --- lib/sensu-plugins-mongodb/metrics.rb | 46 +- test/fixtures/status_3.2.9.json | 958 +++++++++++++----- .../lib/sensu-plugins-mongodb/metrics_spec.rb | 395 ++++++-- 3 files changed, 1045 insertions(+), 354 deletions(-) diff --git a/lib/sensu-plugins-mongodb/metrics.rb b/lib/sensu-plugins-mongodb/metrics.rb index bc277bd..ddcca71 100644 --- a/lib/sensu-plugins-mongodb/metrics.rb +++ b/lib/sensu-plugins-mongodb/metrics.rb @@ -255,13 +255,15 @@ def server_metrics server_metrics['network.numRequests'] = network['numRequests'] # OpLatencies - oplatencies = server_status['opLatencies'] - server_metrics['oplatencies.read.latency'] = oplatencies['reads']['latency'] - server_metrics['oplatencies.read.operations'] = oplatencies['reads']['ops'] - server_metrics['oplatencies.write.latency'] = oplatencies['writes']['latency'] - server_metrics['oplatencies.write.operations'] = oplatencies['writes']['ops'] - server_metrics['oplatencies.command.latency'] = oplatencies['commands']['latency'] - server_metrics['oplatencies.command.operations'] = oplatencies['commands']['ops'] + if server_status.key?('opLatencies') + oplatencies = server_status['opLatencies'] + server_metrics['oplatencies.read.latency'] = oplatencies['reads']['latency'] + server_metrics['oplatencies.read.operations'] = oplatencies['reads']['ops'] + server_metrics['oplatencies.write.latency'] = oplatencies['writes']['latency'] + server_metrics['oplatencies.write.operations'] = oplatencies['writes']['ops'] + server_metrics['oplatencies.command.latency'] = oplatencies['commands']['latency'] + server_metrics['oplatencies.command.operations'] = oplatencies['commands']['ops'] + end # Opcounters opcounters = server_status['opcounters'] @@ -438,20 +440,22 @@ def server_metrics # lock Metrics - lock = wiredTiger['lock'] - server_metrics['wiredTiger.lock.schema_lock_application_thread_wait_time_(usecs)'] = lock['schema lock application thread wait time (usecs)'] - server_metrics['wiredTiger.lock.table_lock_application_thread_time_waiting_for_the_table_lock_(usecs)'] = lock['table lock application thread time waiting for the table lock (usecs)'] - server_metrics['wiredTiger.lock.checkpoint_lock_internal_thread_wait_time_(usecs)'] = lock['checkpoint lock internal thread wait time (usecs)'] - server_metrics['wiredTiger.lock.schema_lock_acquisitions'] = lock['schema lock acquisitions'] - server_metrics['wiredTiger.lock.handle-list_lock_eviction_thread_wait_time_(usecs)'] = lock['handle-list lock eviction thread wait time (usecs)'] - server_metrics['wiredTiger.lock.checkpoint_lock_acquisitions'] = lock['checkpoint lock acquisitions'] - server_metrics['wiredTiger.lock.table_lock_internal_thread_time_waiting_for_the_table_lock_(usecs)'] = lock['table lock internal thread time waiting for the table lock (usecs)'] - server_metrics['wiredTiger.lock.checkpoint_lock_application_thread_wait_time_(usecs)'] = lock['checkpoint lock application thread wait time (usecs)'] - server_metrics['wiredTiger.lock.table_lock_acquisitions'] = lock['table lock acquisitions'] - server_metrics['wiredTiger.lock.metadata_lock_application_thread_wait_time_(usecs)'] = lock['metadata lock application thread wait time (usecs)'] - server_metrics['wiredTiger.lock.schema_lock_internal_thread_wait_time_(usecs)'] = lock['schema lock internal thread wait time (usecs)'] - server_metrics['wiredTiger.lock.metadata_lock_internal_thread_wait_time_(usecs)'] = lock['metadata lock internal thread wait time (usecs)'] - server_metrics['wiredTiger.lock.metadata_lock_acquisitions'] = lock['metadata lock acquisitions'] + if server_status.key?('lock') + lock = wiredTiger['lock'] + server_metrics['wiredTiger.lock.schema_lock_application_thread_wait_time_(usecs)'] = lock['schema lock application thread wait time (usecs)'] + server_metrics['wiredTiger.lock.table_lock_application_thread_time_waiting_for_the_table_lock_(usecs)'] = lock['table lock application thread time waiting for the table lock (usecs)'] + server_metrics['wiredTiger.lock.checkpoint_lock_internal_thread_wait_time_(usecs)'] = lock['checkpoint lock internal thread wait time (usecs)'] + server_metrics['wiredTiger.lock.schema_lock_acquisitions'] = lock['schema lock acquisitions'] + server_metrics['wiredTiger.lock.handle-list_lock_eviction_thread_wait_time_(usecs)'] = lock['handle-list lock eviction thread wait time (usecs)'] + server_metrics['wiredTiger.lock.checkpoint_lock_acquisitions'] = lock['checkpoint lock acquisitions'] + server_metrics['wiredTiger.lock.table_lock_internal_thread_time_waiting_for_the_table_lock_(usecs)'] = lock['table lock internal thread time waiting for the table lock (usecs)'] + server_metrics['wiredTiger.lock.checkpoint_lock_application_thread_wait_time_(usecs)'] = lock['checkpoint lock application thread wait time (usecs)'] + server_metrics['wiredTiger.lock.table_lock_acquisitions'] = lock['table lock acquisitions'] + server_metrics['wiredTiger.lock.metadata_lock_application_thread_wait_time_(usecs)'] = lock['metadata lock application thread wait time (usecs)'] + server_metrics['wiredTiger.lock.schema_lock_internal_thread_wait_time_(usecs)'] = lock['schema lock internal thread wait time (usecs)'] + server_metrics['wiredTiger.lock.metadata_lock_internal_thread_wait_time_(usecs)'] = lock['metadata lock internal thread wait time (usecs)'] + server_metrics['wiredTiger.lock.metadata_lock_acquisitions'] = lock['metadata lock acquisitions'] + end # LSM Metrics diff --git a/test/fixtures/status_3.2.9.json b/test/fixtures/status_3.2.9.json index 78a4262..d6cc9c8 100644 --- a/test/fixtures/status_3.2.9.json +++ b/test/fixtures/status_3.2.9.json @@ -1,17 +1,13 @@ { - "host": "f1dbca7d352e", + "host": "716e282c90c1", "advisoryHostFQDNs": [], "version": "3.2.9", "process": "mongod", - "pid": { - "floatApprox": 1 - }, - "uptime": 4262, - "uptimeMillis": { - "floatApprox": 4261830 - }, - "uptimeEstimate": 4229, - "localTime": "2016-09-22T12:16:14.342Z", + "pid": 37, + "uptime": 1112.0, + "uptimeMillis": 1112003, + "uptimeEstimate": 985.0, + "localTime": "2018-09-13 18:27:12 UTC", "asserts": { "regular": 0, "warning": 0, @@ -20,28 +16,24 @@ "rollovers": 0 }, "connections": { - "current": 1, - "available": 52427, - "totalCreated": { - "floatApprox": 76 - } + "current": 2, + "available": 838858, + "totalCreated": 30 }, "extra_info": { "note": "fields vary by platform", - "heap_usage_bytes": 60214264, - "page_faults": 256 + "heap_usage_bytes": 60182392, + "page_faults": 0 }, "globalLock": { - "totalTime": { - "floatApprox": 4261830000 - }, + "totalTime": 1112002000, "currentQueue": { "total": 0, "readers": 0, "writers": 0 }, "activeClients": { - "total": 8, + "total": 9, "readers": 0, "writers": 0 } @@ -49,52 +41,33 @@ "locks": { "Global": { "acquireCount": { - "r": { - "floatApprox": 2290 - }, - "w": { - "floatApprox": 2 - }, - "W": { - "floatApprox": 4 - } + "r": 653, + "w": 3, + "W": 4 } }, "Database": { "acquireCount": { - "r": { - "floatApprox": 1142 - }, - "W": { - "floatApprox": 2 - } + "r": 313, + "R": 10, + "W": 3 } }, "Collection": { "acquireCount": { - "r": { - "floatApprox": 1142 - } + "r": 304 } }, "Metadata": { "acquireCount": { - "w": { - "floatApprox": 1 - } + "w": 1 } } }, "network": { - "bytesIn": { - "floatApprox": 4567 - }, - "bytesOut": { - "floatApprox": 489982 - }, - "numRequests": { - "floatApprox": 77 - } + "bytesIn": 7932, + "bytesOut": 182742, + "numRequests": 66 }, "opcounters": { "insert": 0, @@ -102,7 +75,7 @@ "update": 0, "delete": 0, "getmore": 0, - "command": 78 + "command": 67 }, "opcountersRepl": { "insert": 0, @@ -119,22 +92,20 @@ }, "tcmalloc": { "generic": { - "current_allocated_bytes": 60215800, - "heap_size": 64512000 + "current_allocated_bytes": 60183928, + "heap_size": 64520192 }, "tcmalloc": { - "pageheap_free_bytes": 1630208, + "pageheap_free_bytes": 2621440, "pageheap_unmapped_bytes": 0, - "max_total_thread_cache_bytes": { - "floatApprox": 1073741824 - }, - "current_total_thread_cache_bytes": 2009392, - "total_free_bytes": 2665992, - "central_cache_free_bytes": 656600, + "max_total_thread_cache_bytes": 1073741824, + "current_total_thread_cache_bytes": 1122224, + "total_free_bytes": 1714824, + "central_cache_free_bytes": 592600, "transfer_cache_free_bytes": 0, - "thread_cache_free_bytes": 2009392, + "thread_cache_free_bytes": 1122224, "aggressive_memory_decommit": 0, - "formattedString": "------------------------------------------------\nMALLOC: 60215800 ( 57.4 MiB) Bytes in use by application\nMALLOC: + 1630208 ( 1.6 MiB) Bytes in page heap freelist\nMALLOC: + 656600 ( 0.6 MiB) Bytes in central cache freelist\nMALLOC: + 0 ( 0.0 MiB) Bytes in transfer cache freelist\nMALLOC: + 2009392 ( 1.9 MiB) Bytes in thread cache freelists\nMALLOC: + 1208480 ( 1.2 MiB) Bytes in malloc metadata\nMALLOC: ------------\nMALLOC: = 65720480 ( 62.7 MiB) Actual memory used (physical + swap)\nMALLOC: + 0 ( 0.0 MiB) Bytes released to OS (aka unmapped)\nMALLOC: ------------\nMALLOC: = 65720480 ( 62.7 MiB) Virtual address space used\nMALLOC:\nMALLOC: 330 Spans in use\nMALLOC: 12 Thread heaps in use\nMALLOC: 8192 Tcmalloc page size\n------------------------------------------------\nCall ReleaseFreeMemory() to release freelist memory to the OS (via madvise()).\nBytes released to the OS take up virtual address space but no physical memory.\n" + "formattedString": "------------------------------------------------\nMALLOC: 60183928 ( 57.4 MiB) Bytes in use by application\nMALLOC: + 2621440 ( 2.5 MiB) Bytes in page heap freelist\nMALLOC: + 592600 ( 0.6 MiB) Bytes in central cache freelist\nMALLOC: + 0 ( 0.0 MiB) Bytes in transfer cache freelist\nMALLOC: + 1122224 ( 1.1 MiB) Bytes in thread cache freelists\nMALLOC: + 1208480 ( 1.2 MiB) Bytes in malloc metadata\nMALLOC: ------------\nMALLOC: = 65728672 ( 62.7 MiB) Actual memory used (physical + swap)\nMALLOC: + 0 ( 0.0 MiB) Bytes released to OS (aka unmapped)\nMALLOC: ------------\nMALLOC: = 65728672 ( 62.7 MiB) Virtual address space used\nMALLOC:\nMALLOC: 320 Spans in use\nMALLOC: 13 Thread heaps in use\nMALLOC: 8192 Tcmalloc page size\n------------------------------------------------\nCall ReleaseFreeMemory() to release freelist memory to the OS (via madvise()).\nBytes released to the OS take up virtual address space but no physical memory.\n" } }, "wiredTiger": { @@ -167,18 +138,18 @@ "total update calls": 0 }, "block-manager": { - "blocks pre-loaded": 0, - "blocks read": 1, - "blocks written": 19, - "bytes read": 4096, - "bytes written": 86016, + "blocks pre-loaded": 5, + "blocks read": 16, + "blocks written": 24, + "bytes read": 69632, + "bytes written": 110592, "mapped blocks read": 0, "mapped bytes read": 0 }, "cache": { - "bytes currently in the cache": 15825, - "bytes read into cache": 0, - "bytes written from cache": 12762, + "bytes currently in the cache": 44843, + "bytes read into cache": 7541, + "bytes written from cache": 19144, "checkpoint blocked page eviction": 0, "eviction calls to get a page": 0, "eviction calls to get a page found queue empty": 0, @@ -206,7 +177,7 @@ "leaf pages split during eviction": 0, "lookaside table insert calls": 0, "lookaside table remove calls": 0, - "maximum bytes configured": 8589934592, + "maximum bytes configured": 1073741824.0, "maximum page size at eviction": 0, "modified pages evicted": 0, "modified pages evicted by application threads": 0, @@ -218,95 +189,95 @@ "pages evicted by application threads": 0, "pages queued for eviction": 0, "pages queued for urgent eviction": 0, - "pages read into cache": 0, + "pages read into cache": 10, "pages read into cache requiring lookaside entries": 0, - "pages requested from the cache": 545, + "pages requested from the cache": 244, "pages seen by eviction walk": 0, "pages selected for eviction unable to be evicted": 0, "pages walked for eviction": 0, "pages written from cache": 12, "pages written requiring in-memory restoration": 0, "percentage overhead": 8, - "tracked bytes belonging to internal pages in the cache": 1390, - "tracked bytes belonging to leaf pages in the cache": 14435, + "tracked bytes belonging to internal pages in the cache": 13631, + "tracked bytes belonging to leaf pages in the cache": 31212, "tracked bytes belonging to overflow pages in the cache": 0, "tracked dirty bytes in the cache": 0, "tracked dirty pages in the cache": 0, "unmodified pages evicted": 0 }, "connection": { - "auto adjusting condition resets": 8, - "auto adjusting condition wait calls": 12822, + "auto adjusting condition resets": 9, + "auto adjusting condition wait calls": 3372, "files currently open": 9, - "memory allocations": 66582, - "memory frees": 65965, - "memory re-allocations": 17263, - "pthread mutex condition wait calls": 55977, - "pthread mutex shared lock read-lock calls": 9777, - "pthread mutex shared lock write-lock calls": 4962, - "total fsync I/Os": 673, - "total read I/Os": 86, - "total write I/Os": 42 + "memory allocations": 19700, + "memory frees": 19113, + "memory re-allocations": 4577, + "pthread mutex condition wait calls": 14531, + "pthread mutex shared lock read-lock calls": 2574, + "pthread mutex shared lock write-lock calls": 1296, + "total fsync I/Os": 190, + "total read I/Os": 876, + "total write I/Os": 38 }, "cursor": { - "cursor create calls": 31, - "cursor insert calls": 25, - "cursor next calls": 13, + "cursor create calls": 29, + "cursor insert calls": 12, + "cursor next calls": 28, "cursor prev calls": 3, - "cursor remove calls": 0, - "cursor reset calls": 523, + "cursor remove calls": 1, + "cursor reset calls": 220, "cursor restarted searches": 0, - "cursor search calls": 501, + "cursor search calls": 209, "cursor search near calls": 1, "cursor update calls": 0, "truncate calls": 0 }, "data-handle": { - "connection data handles currently active": 10, + "connection data handles currently active": 6, "connection sweep candidate became referenced": 0, "connection sweep dhandles closed": 0, - "connection sweep dhandles removed from hash list": 276, - "connection sweep time-of-death sets": 276, - "connection sweeps": 426, + "connection sweep dhandles removed from hash list": 72, + "connection sweep time-of-death sets": 72, + "connection sweeps": 111, "session dhandles swept": 0, - "session sweep attempts": 88 + "session sweep attempts": 33 }, "log": { "busy returns attempting to switch slots": 0, - "consolidated slot closures": 11, + "consolidated slot closures": 7, "consolidated slot join races": 0, - "consolidated slot join transitions": 11, - "consolidated slot joins": 25, + "consolidated slot join transitions": 7, + "consolidated slot joins": 11, "consolidated slot unbuffered writes": 0, - "log bytes of payload data": 7383, - "log bytes written": 9728, + "log bytes of payload data": 3497, + "log bytes written": 4736, "log files manually zero-filled": 0, - "log flush operations": 42581, - "log force write operations": 46928, - "log force write operations skipped": 46925, - "log records compressed": 8, - "log records not compressed": 7, - "log records too small to compress": 10, - "log release advances write LSN": 8, - "log scan operations": 0, - "log scan records requiring two reads": 0, - "log server thread advances write LSN": 3, - "log server thread write LSN walk skipped": 5238, - "log sync operations": 11, - "log sync time duration (usecs)": 38842, + "log flush operations": 11023, + "log force write operations": 12168, + "log force write operations skipped": 12166, + "log records compressed": 4, + "log records not compressed": 1, + "log records too small to compress": 6, + "log release advances write LSN": 5, + "log scan operations": 3, + "log scan records requiring two reads": 4, + "log server thread advances write LSN": 2, + "log server thread write LSN walk skipped": 2078, + "log sync operations": 7, + "log sync time duration (usecs)": 14238, "log sync_dir operations": 1, - "log sync_dir time duration (usecs)": 5102, - "log write operations": 25, - "logging bytes consolidated": 9344, + "log sync_dir time duration (usecs)": 16, + "log write operations": 11, + "logging bytes consolidated": 4352, "maximum log file size": 104857600, "number of pre-allocated log files to create": 2, "pre-allocated log files not ready and missed": 1, "pre-allocated log files prepared": 2, "pre-allocated log files used": 0, - "records processed by log scan": 0, - "total in-memory size of compressed records": 9993, + "records processed by log scan": 10, + "total in-memory size of compressed records": 4749, "total log buffer size": 33554432, - "total size of compressed records": 5745, + "total size of compressed records": 3183, "written slots coalesced": 0, "yields waiting for previous log file close": 0 }, @@ -337,25 +308,25 @@ "transaction": { "number of named snapshots created": 0, "number of named snapshots dropped": 0, - "transaction begins": 75, + "transaction begins": 41, "transaction checkpoint currently running": 0, - "transaction checkpoint generation": 71, - "transaction checkpoint max time (msecs)": 32, - "transaction checkpoint min time (msecs)": 0, - "transaction checkpoint most recent time (msecs)": 0, - "transaction checkpoint total time (msecs)": 54, - "transaction checkpoints": 71, + "transaction checkpoint generation": 19, + "transaction checkpoint max time (msecs)": 8, + "transaction checkpoint min time (msecs)": 6, + "transaction checkpoint most recent time (msecs)": 6, + "transaction checkpoint total time (msecs)": 28, + "transaction checkpoints": 19, "transaction failures due to cache overflow": 0, - "transaction fsync calls for checkpoint after allocating the transaction ID": 71, - "transaction fsync calls for checkpoint before allocating the transaction ID": 71, - "transaction fsync duration for checkpoint after allocating the transaction ID (usecs)": 29730, - "transaction fsync duration for checkpoint before allocating the transaction ID (usecs)": 217635, + "transaction fsync calls for checkpoint after allocating the transaction ID": 19, + "transaction fsync calls for checkpoint before allocating the transaction ID": 19, + "transaction fsync duration for checkpoint after allocating the transaction ID (usecs)": 21003, + "transaction fsync duration for checkpoint before allocating the transaction ID (usecs)": 64772, "transaction range of IDs currently pinned": 0, "transaction range of IDs currently pinned by a checkpoint": 0, "transaction range of IDs currently pinned by named snapshots": 0, "transaction sync calls": 0, - "transactions committed": 3, - "transactions rolled back": 72 + "transactions committed": 4, + "transactions rolled back": 37 }, "concurrentTransactions": { "write": { @@ -373,104 +344,639 @@ "writeBacksQueued": false, "mem": { "bits": 64, - "resident": 49, - "virtual": 245, + "resident": 50, + "virtual": 244, "supported": true, "mapped": 0, "mappedWithJournal": 0 }, "metrics": { "commands": { + "": 0, + "_getUserCacheGeneration": { + "failed": 0, + "total": 0 + }, + "_isSelf": { + "failed": 0, + "total": 0 + }, + "_mergeAuthzCollections": { + "failed": 0, + "total": 0 + }, + "_migrateClone": { + "failed": 0, + "total": 0 + }, + "_recvChunkAbort": { + "failed": 0, + "total": 0 + }, + "_recvChunkCommit": { + "failed": 0, + "total": 0 + }, + "_recvChunkStart": { + "failed": 0, + "total": 0 + }, + "_recvChunkStatus": { + "failed": 0, + "total": 0 + }, + "_transferMods": { + "failed": 0, + "total": 0 + }, + "aggregate": { + "failed": 0, + "total": 0 + }, + "appendOplogNote": { + "failed": 0, + "total": 0 + }, + "applyOps": { + "failed": 0, + "total": 0 + }, + "authSchemaUpgrade": { + "failed": 0, + "total": 0 + }, + "authenticate": { + "failed": 0, + "total": 0 + }, + "availableQueryOptions": { + "failed": 0, + "total": 0 + }, + "buildInfo": { + "failed": 0, + "total": 0 + }, + "checkShardingIndex": { + "failed": 0, + "total": 0 + }, + "cleanupOrphaned": { + "failed": 0, + "total": 0 + }, + "clone": { + "failed": 0, + "total": 0 + }, + "cloneCollection": { + "failed": 0, + "total": 0 + }, + "cloneCollectionAsCapped": { + "failed": 0, + "total": 0 + }, + "collMod": { + "failed": 0, + "total": 0 + }, + "collStats": { + "failed": 0, + "total": 0 + }, + "compact": { + "failed": 0, + "total": 0 + }, + "connPoolStats": { + "failed": 0, + "total": 0 + }, + "connPoolSync": { + "failed": 0, + "total": 0 + }, + "connectionStatus": { + "failed": 0, + "total": 0 + }, + "convertToCapped": { + "failed": 0, + "total": 0 + }, + "copydb": { + "failed": 0, + "total": 0 + }, + "copydbgetnonce": { + "failed": 0, + "total": 0 + }, + "copydbsaslstart": { + "failed": 0, + "total": 0 + }, + "count": { + "failed": 0, + "total": 0 + }, + "create": { + "failed": 0, + "total": 0 + }, + "createIndexes": { + "failed": 0, + "total": 0 + }, + "createRole": { + "failed": 0, + "total": 0 + }, + "createUser": { + "failed": 0, + "total": 0 + }, + "currentOp": { + "failed": 0, + "total": 0 + }, + "currentOpCtx": { + "failed": 0, + "total": 0 + }, + "dataSize": { + "failed": 0, + "total": 0 + }, + "dbHash": { + "failed": 0, + "total": 0 + }, + "dbStats": { + "failed": 0, + "total": 9 + }, + "delete": { + "failed": 0, + "total": 0 + }, + "diagLogging": { + "failed": 0, + "total": 0 + }, + "distinct": { + "failed": 0, + "total": 0 + }, + "driverOIDTest": { + "failed": 0, + "total": 0 + }, + "drop": { + "failed": 0, + "total": 0 + }, + "dropAllRolesFromDatabase": { + "failed": 0, + "total": 0 + }, + "dropAllUsersFromDatabase": { + "failed": 0, + "total": 0 + }, + "dropDatabase": { + "failed": 0, + "total": 0 + }, + "dropIndexes": { + "failed": 0, + "total": 0 + }, + "dropRole": { + "failed": 0, + "total": 0 + }, + "dropUser": { + "failed": 0, + "total": 0 + }, + "eval": { + "failed": 0, + "total": 0 + }, + "explain": { + "failed": 0, + "total": 0 + }, + "features": { + "failed": 0, + "total": 0 + }, + "filemd5": { + "failed": 0, + "total": 0 + }, + "find": { + "failed": 0, + "total": 0 + }, + "findAndModify": { + "failed": 0, + "total": 0 + }, + "forceerror": { + "failed": 0, + "total": 0 + }, + "fsync": { + "failed": 0, + "total": 0 + }, + "fsyncUnlock": { + "failed": 0, + "total": 0 + }, + "geoNear": { + "failed": 0, + "total": 0 + }, + "geoSearch": { + "failed": 0, + "total": 0 + }, + "getCmdLineOpts": { + "failed": 0, + "total": 0 + }, + "getLastError": { + "failed": 0, + "total": 0 + }, + "getLog": { + "failed": 0, + "total": 0 + }, + "getMore": { + "failed": 0, + "total": 0 + }, + "getParameter": { + "failed": 0, + "total": 0 + }, + "getPrevError": { + "failed": 0, + "total": 0 + }, + "getShardMap": { + "failed": 0, + "total": 0 + }, + "getShardVersion": { + "failed": 0, + "total": 0 + }, + "getnonce": { + "failed": 0, + "total": 0 + }, + "grantPrivilegesToRole": { + "failed": 0, + "total": 0 + }, + "grantRolesToRole": { + "failed": 0, + "total": 0 + }, + "grantRolesToUser": { + "failed": 0, + "total": 0 + }, + "group": { + "failed": 0, + "total": 0 + }, + "handshake": { + "failed": 0, + "total": 0 + }, + "hostInfo": { + "failed": 0, + "total": 0 + }, + "insert": { + "failed": 0, + "total": 0 + }, + "invalidateUserCache": { + "failed": 0, + "total": 0 + }, "isMaster": { - "failed": { - "floatApprox": 0 - }, - "total": { - "floatApprox": 51 + "failed": 0, + "total": 30 + }, + "killCursors": { + "failed": 0, + "total": 0 + }, + "killOp": { + "failed": 0, + "total": 0 + }, + "listCollections": { + "failed": 0, + "total": 0 + }, + "listCommands": { + "failed": 0, + "total": 0 + }, + "listDatabases": { + "failed": 0, + "total": 9 + }, + "listIndexes": { + "failed": 0, + "total": 0 + }, + "logRotate": { + "failed": 0, + "total": 0 + }, + "logout": { + "failed": 0, + "total": 0 + }, + "mapReduce": { + "failed": 0, + "total": 0 + }, + "mapreduce": { + "shardedfinish": { + "failed": 0, + "total": 0 } }, + "mergeChunks": { + "failed": 0, + "total": 0 + }, + "moveChunk": { + "failed": 0, + "total": 0 + }, + "parallelCollectionScan": { + "failed": 0, + "total": 0 + }, + "ping": { + "failed": 0, + "total": 0 + }, + "planCacheClear": { + "failed": 0, + "total": 0 + }, + "planCacheClearFilters": { + "failed": 0, + "total": 0 + }, + "planCacheListFilters": { + "failed": 0, + "total": 0 + }, + "planCacheListPlans": { + "failed": 0, + "total": 0 + }, + "planCacheListQueryShapes": { + "failed": 0, + "total": 0 + }, + "planCacheSetFilter": { + "failed": 0, + "total": 0 + }, + "profile": { + "failed": 0, + "total": 0 + }, + "reIndex": { + "failed": 0, + "total": 0 + }, + "renameCollection": { + "failed": 0, + "total": 0 + }, + "repairCursor": { + "failed": 0, + "total": 0 + }, + "repairDatabase": { + "failed": 0, + "total": 0 + }, + "replSetDeclareElectionWinner": { + "failed": 0, + "total": 0 + }, + "replSetElect": { + "failed": 0, + "total": 0 + }, + "replSetFreeze": { + "failed": 0, + "total": 0 + }, + "replSetFresh": { + "failed": 0, + "total": 0 + }, + "replSetGetConfig": { + "failed": 0, + "total": 0 + }, + "replSetGetRBID": { + "failed": 0, + "total": 0 + }, + "replSetGetStatus": { + "failed": 9, + "total": 9 + }, + "replSetHeartbeat": { + "failed": 0, + "total": 0 + }, + "replSetInitiate": { + "failed": 0, + "total": 0 + }, + "replSetMaintenance": { + "failed": 0, + "total": 0 + }, + "replSetReconfig": { + "failed": 0, + "total": 0 + }, + "replSetRequestVotes": { + "failed": 0, + "total": 0 + }, + "replSetStepDown": { + "failed": 0, + "total": 0 + }, + "replSetSyncFrom": { + "failed": 0, + "total": 0 + }, + "replSetUpdatePosition": { + "failed": 0, + "total": 0 + }, + "resetError": { + "failed": 0, + "total": 0 + }, + "resync": { + "failed": 0, + "total": 0 + }, + "revokePrivilegesFromRole": { + "failed": 0, + "total": 0 + }, + "revokeRolesFromRole": { + "failed": 0, + "total": 0 + }, + "revokeRolesFromUser": { + "failed": 0, + "total": 0 + }, + "rolesInfo": { + "failed": 0, + "total": 0 + }, + "saslContinue": { + "failed": 0, + "total": 0 + }, + "saslStart": { + "failed": 0, + "total": 0 + }, "serverStatus": { - "failed": { - "floatApprox": 0 - }, - "total": { - "floatApprox": 26 - } + "failed": 0, + "total": 10 + }, + "setParameter": { + "failed": 0, + "total": 0 + }, + "setShardVersion": { + "failed": 0, + "total": 0 + }, + "shardConnPoolStats": { + "failed": 0, + "total": 0 + }, + "shardingState": { + "failed": 0, + "total": 0 + }, + "shutdown": { + "failed": 0, + "total": 0 + }, + "splitChunk": { + "failed": 0, + "total": 0 + }, + "splitVector": { + "failed": 0, + "total": 0 + }, + "top": { + "failed": 0, + "total": 0 + }, + "touch": { + "failed": 0, + "total": 0 + }, + "unsetSharding": { + "failed": 0, + "total": 0 + }, + "update": { + "failed": 0, + "total": 0 + }, + "updateRole": { + "failed": 0, + "total": 0 + }, + "updateUser": { + "failed": 0, + "total": 0 + }, + "usersInfo": { + "failed": 0, + "total": 0 + }, + "validate": { + "failed": 0, + "total": 0 }, "whatsmyuri": { - "failed": { - "floatApprox": 0 - }, - "total": { - "floatApprox": 1 - } + "failed": 0, + "total": 0 + }, + "writebacklisten": { + "failed": 0, + "total": 0 } }, "cursor": { - "timedOut": { - "floatApprox": 0 - }, + "timedOut": 0, "open": { - "noTimeout": { - "floatApprox": 0 - }, - "pinned": { - "floatApprox": 0 - }, - "total": { - "floatApprox": 0 - } + "noTimeout": 0, + "pinned": 0, + "total": 0 } }, "document": { - "deleted": { - "floatApprox": 0 - }, - "inserted": { - "floatApprox": 0 - }, - "returned": { - "floatApprox": 0 - }, - "updated": { - "floatApprox": 0 - } + "deleted": 0, + "inserted": 0, + "returned": 0, + "updated": 0 }, "getLastError": { "wtime": { "num": 0, "totalMillis": 0 }, - "wtimeouts": { - "floatApprox": 0 - } + "wtimeouts": 0 }, "operation": { - "fastmod": { - "floatApprox": 0 - }, - "idhack": { - "floatApprox": 0 - }, - "scanAndOrder": { - "floatApprox": 0 - }, - "writeConflicts": { - "floatApprox": 0 - } + "fastmod": 0, + "idhack": 0, + "scanAndOrder": 0, + "writeConflicts": 0 }, "queryExecutor": { - "scanned": { - "floatApprox": 0 - }, - "scannedObjects": { - "floatApprox": 0 - } + "scanned": 0, + "scannedObjects": 0 }, "record": { - "moves": { - "floatApprox": 0 - } + "moves": 0 }, "repl": { "executor": { @@ -504,33 +1010,21 @@ "num": 0, "totalMillis": 0 }, - "ops": { - "floatApprox": 0 - } + "ops": 0 }, "buffer": { - "count": { - "floatApprox": 0 - }, + "count": 0, "maxSizeBytes": 268435456, - "sizeBytes": { - "floatApprox": 0 - } + "sizeBytes": 0 }, "network": { - "bytes": { - "floatApprox": 0 - }, + "bytes": 0, "getmores": { "num": 0, "totalMillis": 0 }, - "ops": { - "floatApprox": 0 - }, - "readersCreated": { - "floatApprox": 0 - } + "ops": 0, + "readersCreated": 0 }, "preload": { "docs": { @@ -546,26 +1040,16 @@ "storage": { "freelist": { "search": { - "bucketExhausted": { - "floatApprox": 0 - }, - "requests": { - "floatApprox": 0 - }, - "scanned": { - "floatApprox": 0 - } + "bucketExhausted": 0, + "requests": 0, + "scanned": 0 } } }, "ttl": { - "deletedDocuments": { - "floatApprox": 0 - }, - "passes": { - "floatApprox": 71 - } + "deletedDocuments": 0, + "passes": 18 } }, - "ok": 1 -} + "ok": 1.0 +} \ No newline at end of file diff --git a/test/lib/sensu-plugins-mongodb/metrics_spec.rb b/test/lib/sensu-plugins-mongodb/metrics_spec.rb index 3a3723b..e98a312 100644 --- a/test/lib/sensu-plugins-mongodb/metrics_spec.rb +++ b/test/lib/sensu-plugins-mongodb/metrics_spec.rb @@ -66,6 +66,7 @@ metrics.connect_mongo_db('admin') result = metrics.server_metrics expect(result).to eq( + { 'asserts.errors' => 0, 'asserts.regular' => 0, 'asserts.rollovers' => 0, @@ -85,12 +86,12 @@ 'databaseSizes.admin.collections' => 4, 'databaseSizes.admin.objects' => 11, 'databaseSizes.admin.avgObjSize' => 106.18181818181819, - 'databaseSizes.admin.dataSize' => 1168.0, - 'databaseSizes.admin.storageSize' => 286_72.0, + 'databaseSizes.admin.dataSize' => 1168, + 'databaseSizes.admin.storageSize' => 286_72, 'databaseSizes.admin.numExtents' => 4, 'databaseSizes.admin.indexes' => 3, - 'databaseSizes.admin.indexSize' => 245_28.0, - 'databaseSizes.admin.fileSize' => 671_088_64.0, + 'databaseSizes.admin.indexSize' => 245_280, + 'databaseSizes.admin.fileSize' => 671_088_64, 'databaseSizes.admin.nsSizeMB' => 16, 'indexes.accesses' => 2, 'indexes.hits' => 2, @@ -114,7 +115,7 @@ 'lock.queue_total' => 0, 'lock.queue_writers' => 0, 'lock.totalTime' => 4_127_130_000, - 'mem.heap_usage_bytes' => 62_525_976, + 'mem.heap_usage_bytes' => 62_525_976.0, 'mem.mapped' => 80, 'mem.mappedWithJournal' => 160, 'mem.pageFaults' => 236, @@ -169,7 +170,7 @@ 'opcountersRepl.insert' => 0, 'opcountersRepl.query' => 0, 'opcountersRepl.update' => 0 - ) + }) end end @@ -207,96 +208,298 @@ metrics.connect_mongo_db('admin') result = metrics.server_metrics expect(result).to eq( - 'asserts.errors' => 0, - 'asserts.regular' => 0, - 'asserts.rollovers' => 0, - 'asserts.user' => 0, - 'asserts.warnings' => 0, - 'connections.available' => 52_427, - 'connections.current' => 1, - 'connections.totalCreated' => 76, - 'cursors.open.noTimeout' => 0, - 'cursors.open.pinned' => 0, - 'cursors.open.total' => 0, - 'cursors.timedOut' => 0, - 'databaseSizes.admin.collections' => 4, - 'databaseSizes.admin.objects' => 11, - 'databaseSizes.admin.avgObjSize' => 106.18181818181819, - 'databaseSizes.admin.dataSize' => 1168.0, - 'databaseSizes.admin.storageSize' => 286_72.0, - 'databaseSizes.admin.numExtents' => 4, - 'databaseSizes.admin.indexes' => 3, - 'databaseSizes.admin.indexSize' => 245_28.0, - 'databaseSizes.admin.fileSize' => 671_088_64.0, - 'databaseSizes.admin.nsSizeMB' => 16, - 'lock.clients_readers' => 0, - 'lock.clients_total' => 8, - 'lock.clients_writers' => 0, - 'lock.queue_readers' => 0, - 'lock.queue_total' => 0, - 'lock.queue_writers' => 0, - 'lock.totalTime' => 4_261_830_000, - 'locks.Collection.acquireCount_r' => 1_142, - 'locks.Database.acquireCount_W' => 1_142, - 'locks.Database.acquireCount_r' => 1_142, - 'locks.Global.acquireCount_W' => 2_290, - 'locks.Global.acquireCount_r' => 2_290, - 'locks.Global.acquireCount_w' => 2_290, - 'mem.heap_usage_bytes' => 60_214_264, - 'mem.mapped' => 0, - 'mem.mappedWithJournal' => 0, - 'mem.pageFaults' => 256, - 'mem.residentMb' => 49, - 'mem.virtualMb' => 245, - 'metrics.document.deleted' => 0, - 'metrics.document.inserted' => 0, - 'metrics.document.returned' => 0, - 'metrics.document.updated' => 0, - 'metrics.getLastError.wtime_num' => 0, - 'metrics.getLastError.wtime_totalMillis' => 0, - 'metrics.getLastError.wtimeouts' => 0, - 'metrics.operation.fastmod' => 0, - 'metrics.operation.idhack' => 0, - 'metrics.operation.scanAndOrder' => 0, - 'metrics.queryExecutor.scanned' => 0, - 'metrics.queryExecutor.scannedObjects' => 0, - 'metrics.record.moves' => 0, - 'metrics.repl.apply.batches_num' => 0, - 'metrics.repl.apply.batches_totalMillis' => 0, - 'metrics.repl.apply.ops' => 0, - 'metrics.repl.buffer.count' => 0, - 'metrics.repl.buffer.maxSizeBytes' => 268_435_456, - 'metrics.repl.buffer.sizeBytes' => 0, - 'metrics.repl.network.bytes' => 0, - 'metrics.repl.network.getmores_num' => 0, - 'metrics.repl.network.getmores_totalMillis' => 0, - 'metrics.repl.network.ops' => 0, - 'metrics.repl.network.readersCreated' => 0, - 'metrics.repl.preload.docs_num' => 0, - 'metrics.repl.preload.docs_totalMillis' => 0, - 'metrics.repl.preload.indexes_num' => 0, - 'metrics.repl.preload.indexes_totalMillis' => 0, - 'metrics.replicaset.state' => 1, - 'metrics.storage.freelist.search_bucketExhauseted' => 0, - 'metrics.storage.freelist.search_requests' => 0, - 'metrics.storage.freelist.search_scanned' => 0, - 'metrics.ttl.deletedDocuments' => 0, - 'metrics.ttl.passes' => 71, - 'network.bytesIn' => 4_567, - 'network.bytesOut' => 489_982, - 'network.numRequests' => 77, - 'opcounters.command' => 78, - 'opcounters.delete' => 0, - 'opcounters.getmore' => 0, - 'opcounters.insert' => 0, - 'opcounters.query' => 1, - 'opcounters.update' => 0, - 'opcountersRepl.command' => 0, - 'opcountersRepl.delete' => 0, - 'opcountersRepl.getmore' => 0, - 'opcountersRepl.insert' => 0, - 'opcountersRepl.query' => 0, - 'opcountersRepl.update' => 0 + { + "asserts.warnings" => 0, + "asserts.errors" => 0, + "asserts.regular" => 0, + "asserts.user" => 0, + "asserts.rollovers" => 0, + "connections.current" => 2, + "connections.available" => 838858, + "connections.totalCreated" => 30, + "cursors.timedOut" => 0, + "cursors.open.noTimeout" => 0, + "cursors.open.pinned" => 0, + "cursors.open.total" => 0, + + "databaseSizes.admin.avgObjSize" => 106.18181818181819, + "databaseSizes.admin.collections" => 4, + "databaseSizes.admin.dataSize" => 1168, + "databaseSizes.admin.fileSize" => 67108864, + "databaseSizes.admin.indexSize" => 245_280, + "databaseSizes.admin.indexes" => 3, + "databaseSizes.admin.nsSizeMB" => 16, + "databaseSizes.admin.numExtents" => 4, + "databaseSizes.admin.objects" => 11, + "databaseSizes.admin.storageSize" => 28672, + + "mem.pageFaults"=>0, + "mem.heap_size_bytes"=>64520192, + "lock.totalTime"=>1112002000, + "lock.queue_total"=>0, + "lock.queue_readers"=>0, + "lock.queue_writers"=>0, + "lock.clients_total"=>9, + "lock.clients_readers"=>0, + "lock.clients_writers"=>0, + "locks.Collection.acquireCount_r"=>304, + "locks.Global.acquireCount_r"=>653, + "locks.Global.acquireCount_w"=>653, + "locks.Global.acquireCount_W"=>653, + "locks.Database.acquireCount_r"=>313, + "locks.Database.acquireCount_R"=>313, + "locks.Database.acquireCount_W"=>313, + "network.bytesIn"=>7932, + "network.bytesOut"=>182742, + "network.numRequests"=>66, + "opcounters.insert"=>0, + "opcounters.query"=>1, + "opcounters.update"=>0, + "opcounters.delete"=>0, + "opcounters.getmore"=>0, + "opcounters.command"=>67, + "opcountersRepl.insert"=>0, + "opcountersRepl.query"=>0, + "opcountersRepl.update"=>0, + "opcountersRepl.delete"=>0, + "opcountersRepl.getmore"=>0, + "opcountersRepl.command"=>0, + "mem.residentMb"=>50, + "mem.virtualMb"=>244, + "mem.mapped"=>0, + "mem.mappedWithJournal"=>0, + "mem.current_allocated_bytes"=>60183928, + "wiredTiger.data_handle.session_dhandles_swept"=>0, + "wiredTiger.data_handle.connection_sweeps"=>111, + "wiredTiger.data_handle.connection_sweep_dhandles_removed_from_hash_list"=>72, + "wiredTiger.data_handle.connection_data_handles_currently_active"=>6, + "wiredTiger.data_handle.connection_sweep_dhandles_closed"=>0, + "wiredTiger.data_handle.session_sweep_attempts"=>33, + "wiredTiger.data_handle.connection_sweep_candidate_became_referenced"=>0, + "wiredTiger.data_handle.connection_sweep_time-of-death_sets"=>72, + "wiredTiger.reconciliation.fast-path_pages_deleted"=>0, + "wiredTiger.reconciliation.split_objects_currently_awaiting_free"=>0, + "wiredTiger.reconciliation.split_bytes_currently_awaiting_free"=>0, + "wiredTiger.reconciliation.pages_deleted"=>0, + "wiredTiger.reconciliation.page_reconciliation_calls_for_eviction"=>0, + "wiredTiger.reconciliation.page_reconciliation_calls"=>12, + "wiredTiger.cache.unmodified_pages_evicted"=>0, + "wiredTiger.cache.eviction_server_evicting_pages"=>0, + "wiredTiger.cache.tracked_dirty_pages_in_the_cache"=>0, + "wiredTiger.cache.eviction_calls_to_get_a_page_found_queue_empty_after_locking"=>0, + "wiredTiger.cache.internal_pages_split_during_eviction"=>0, + "wiredTiger.cache.page_split_during_eviction_deepened_the_tree"=>0, + "wiredTiger.cache.leaf_pages_split_during_eviction"=>0, + "wiredTiger.cache.pages_walked_for_eviction"=>0, + "wiredTiger.cache.percentage_overhead"=>8, + "wiredTiger.cache.pages_evicted_by_application_threads"=>0, + "wiredTiger.cache.tracked_dirty_bytes_in_the_cache"=>0, + "wiredTiger.cache.maximum_page_size_at_eviction"=>0, + "wiredTiger.cache.failed_eviction_of_pages_that_exceeded_the_in-memory_maximum"=>0, + + "wiredTiger.cache.pages_evicted_because_they_exceeded_the_in-memory_maximum"=>0, + "wiredTiger.cache.tracked_bytes_belonging_to_leaf_pages_in_the_cache"=>31212, + "wiredTiger.cache.eviction_server_candidate_queue_empty_when_topping_up"=>0, + "wiredTiger.cache.bytes_written_from_cache"=>19144, + + "wiredTiger.cache.eviction_server_slept,_because_we_did_not_make_progress_with_eviction"=>0, + "wiredTiger.cache.pages_queued_for_urgent_eviction"=>0, + "wiredTiger.cache.eviction_currently_operating_in_aggressive_mode"=>0, + "wiredTiger.cache.tracked_bytes_belonging_to_internal_pages_in_the_cache"=>13631, + "wiredTiger.cache.bytes_currently_in_the_cache"=>44843, + "wiredTiger.cache.pages_selected_for_eviction_unable_to_be_evicted"=>0, + "wiredTiger.cache.hazard_pointer_maximum_array_length"=>0, + "wiredTiger.cache.lookaside_table_remove_calls"=>0, + "wiredTiger.cache.in-memory_page_passed_criteria_to_be_split"=>0, + "wiredTiger.cache.checkpoint_blocked_page_eviction"=>0, + "wiredTiger.cache.eviction_calls_to_get_a_page_found_queue_empty"=>0, + "wiredTiger.cache.pages_written_from_cache"=>12, + "wiredTiger.cache.eviction_calls_to_get_a_page"=>0, + "wiredTiger.cache.modified_pages_evicted_by_application_threads"=>0, + "wiredTiger.cache.pages_seen_by_eviction_walk"=>0, + "wiredTiger.cache.eviction_worker_thread_evicting_pages"=>0, + "wiredTiger.cache.bytes_read_into_cache"=>7541, + "wiredTiger.cache.page_written_requiring_lookaside_records"=>0, + "wiredTiger.cache.hazard_pointer_blocked_page_eviction"=>0, + "wiredTiger.cache.lookaside_table_insert_calls"=>0, + "wiredTiger.cache.pages_read_into_cache"=>10, + "wiredTiger.cache.pages_written_requiring_in-memory_restoration"=>0, + "wiredTiger.cache.pages_evicted_because_they_had_chains_of_deleted_items"=>0, + "wiredTiger.cache.files_with_new_eviction_walks_started"=>0, + "wiredTiger.cache.pages_queued_for_eviction"=>0, + "wiredTiger.cache.pages_requested_from_the_cache"=>244, + "wiredTiger.cache.pages_read_into_cache_requiring_lookaside_entries"=>0, + "wiredTiger.cache.eviction_server_candidate_queue_not_empty_when_topping_up"=>0, + "wiredTiger.cache.files_with_active_eviction_walks"=>0, + "wiredTiger.cache.hazard_pointer_check_entries_walked"=>0, + "wiredTiger.cache.in-memory_page_splits"=>0, + "wiredTiger.cache.internal_pages_evicted"=>0, + + "wiredTiger.cache.maximum_bytes_configured"=>1073741824.0, + "wiredTiger.cache.pages_currently_held_in_the_cache"=>11, + "wiredTiger.cache.modified_pages_evicted"=>0, + "wiredTiger.cache.eviction_server_unable_to_reach_eviction_goal"=>0, + "wiredTiger.cache.hazard_pointer_check_calls"=>0, + "wiredTiger.log.log_sync_dir_operations"=>1, + "wiredTiger.log.log_sync_dir_time_duration_(usecs)"=>16, + "wiredTiger.log.log_write_operations"=>11, + "wiredTiger.log.log_server_thread_advances_write_LSN"=>2, + "wiredTiger.log.consolidated_slot_join_races"=>0, + "wiredTiger.log.maximum_log_file_size"=>104857600, + "wiredTiger.log.records_processed_by_log_scan"=>10, + "wiredTiger.log.total_log_buffer_size"=>33554432, + "wiredTiger.log.log_records_too_small_to_compress"=>6, + "wiredTiger.log.log_force_write_operations_skipped"=>12166, + "wiredTiger.log.log_scan_operations"=>3, + "wiredTiger.log.pre-allocated_log_files_used"=>0, + "wiredTiger.log.pre-allocated_log_files_not_ready_and_missed"=>1, + "wiredTiger.log.total_size_of_compressed_records"=>3183, + "wiredTiger.log.pre-allocated_log_files_prepared"=>2, + "wiredTiger.log.log_sync_time_duration_(usecs)"=>14238, + "wiredTiger.log.total_in-memory_size_of_compressed_records"=>4749, + "wiredTiger.log.yields_waiting_for_previous_log_file_close"=>0, + "wiredTiger.log.log_records_not_compressed"=>1, + "wiredTiger.log.log_force_write_operations"=>12168, + "wiredTiger.log.consolidated_slot_unbuffered_writes"=>0, + "wiredTiger.log.written_slots_coalesced"=>0, + "wiredTiger.log.log_records_compressed"=>4, + "wiredTiger.log.number_of_pre-allocated_log_files_to_create"=>2, + "wiredTiger.log.log_bytes_written"=>4736, + "wiredTiger.log.busy_returns_attempting_to_switch_slots"=>0, + "wiredTiger.log.consolidated_slot_joins"=>11, + "wiredTiger.log.log_files_manually_zero-filled"=>0, + "wiredTiger.log.log_bytes_of_payload_data"=>3497, + "wiredTiger.log.log_flush_operations"=>11023, + "wiredTiger.log.log_sync_operations"=>7, + "wiredTiger.log.log_scan_records_requiring_two_reads"=>4, + "wiredTiger.log.logging_bytes_consolidated"=>4352, + "wiredTiger.log.log_server_thread_write_LSN_walk_skipped"=>2078, + "wiredTiger.log.consolidated_slot_join_transitions"=>7, + "wiredTiger.log.log_release_advances_write_LSN"=>5, + "wiredTiger.log.consolidated_slot_closures"=>7, + "wiredTiger.LSM.sleep_for_LSM_merge_throttle"=>0, + "wiredTiger.LSM.application_work_units_currently_queued"=>0, + "wiredTiger.LSM.rows_merged_in_an_LSM_tree"=>0, + "wiredTiger.LSM.switch_work_units_currently_queued"=>0, + "wiredTiger.LSM.merge_work_units_currently_queued"=>0, + "wiredTiger.LSM.tree_maintenance_operations_discarded"=>0, + "wiredTiger.LSM.sleep_for_LSM_checkpoint_throttle"=>0, + "wiredTiger.LSM.tree_maintenance_operations_executed"=>0, + "wiredTiger.LSM.tree_maintenance_operations_scheduled"=>0, + "wiredTiger.LSM.tree_queue_hit_maximum"=>0, + "wiredTiger.transaction.number_of_named_snapshots_dropped"=>0, + "wiredTiger.transaction.transaction_checkpoint_currently_running"=>0, + "wiredTiger.transaction.transaction_begins"=>41, + "wiredTiger.transaction.transaction_fsync_calls_for_checkpoint_after_allocating_the_transaction_ID"=>19, + "wiredTiger.transaction.transactions_committed"=>4, + "wiredTiger.transaction.transaction_checkpoint_most_recent_time_(msecs)"=>6, + "wiredTiger.transaction.transaction_checkpoints"=>19, + "wiredTiger.transaction.transaction_range_of_IDs_currently_pinned_by_a_checkpoint"=>0, + "wiredTiger.transaction.transaction_sync_calls"=>0, + "wiredTiger.transaction.transaction_fsync_duration_for_checkpoint_after_allocating_the_transaction_ID_(usecs)"=>21003, + "wiredTiger.transaction.transaction_checkpoint_max_time_(msecs)"=>8, + "wiredTiger.transaction.number_of_named_snapshots_created"=>0, + "wiredTiger.transaction.transaction_checkpoint_min_time_(msecs)"=>6, + "wiredTiger.transaction.transaction_checkpoint_total_time_(msecs)"=>28, + "wiredTiger.transaction.transaction_checkpoint_generation"=>19, + "wiredTiger.transaction.transaction_failures_due_to_cache_overflow"=>0, + "wiredTiger.transaction.transaction_range_of_IDs_currently_pinned_by_named_snapshots"=>0, + "wiredTiger.transaction.transactions_rolled_back"=>37, + "wiredTiger.transaction.transaction_range_of_IDs_currently_pinned"=>0, + "wiredTiger.cursor.cursor_restarted_searches"=>0, + "wiredTiger.cursor.cursor_prev_calls"=>3, + "wiredTiger.cursor.cursor_insert_calls"=>12, + "wiredTiger.cursor.cursor_reset_calls"=>220, + "wiredTiger.cursor.cursor_update_calls"=>0, + "wiredTiger.cursor.cursor_search_near_calls"=>1, + "wiredTiger.cursor.cursor_search_calls"=>209, + "wiredTiger.cursor.cursor_next_calls"=>28, + "wiredTiger.cursor.cursor_create_calls"=>29, + "wiredTiger.cursor.truncate_calls"=>0, + "wiredTiger.cursor.cursor_remove_calls"=>1, + "wiredTiger.connection.total_read_I/Os"=>876, + "wiredTiger.connection.memory_re-allocations"=>4577, + "wiredTiger.connection.pthread_mutex_shared_lock_write-lock_calls"=>1296, + "wiredTiger.connection.auto_adjusting_condition_resets"=>9, + "wiredTiger.connection.pthread_mutex_condition_wait_calls"=>14531, + "wiredTiger.connection.memory_frees"=>19113, + "wiredTiger.connection.pthread_mutex_shared_lock_read-lock_calls"=>2574, + "wiredTiger.connection.total_fsync_I/Os"=>190, + "wiredTiger.connection.files_currently_open"=>9, + "wiredTiger.connection.memory_allocations"=>19700, + "wiredTiger.connection.auto_adjusting_condition_wait_calls"=>3372, + "wiredTiger.connection.total_write_I/Os"=>38, + "wiredTiger.session.open_cursor_count"=>20, + "wiredTiger.session.open_session_count"=>16, + "wiredTiger.block_manager.bytes_read"=>69632, + "wiredTiger.block_manager.blocks_read"=>16, + "wiredTiger.block_manager.blocks_pre-loaded"=>5, + "wiredTiger.block_manager.bytes_written"=>110592, + "wiredTiger.block_manager.mapped_bytes_read"=>0, + "wiredTiger.block_manager.blocks_written"=>24, + "wiredTiger.block_manager.mapped_blocks_read"=>0, + "wiredTiger.thread_yield.page_acquire_busy_blocked"=>0, + "wiredTiger.thread_yield.page_acquire_read_blocked"=>0, + "wiredTiger.thread_yield.page_acquire_locked_blocked"=>0, + "wiredTiger.thread_yield.page_acquire_eviction_blocked"=>0, + "wiredTiger.thread_yield.page_acquire_time_sleeping_(usecs)"=>0, + "wiredTiger.async.total_insert_calls"=>0, + "wiredTiger.async.total_remove_calls"=>0, + "wiredTiger.async.number_of_operation_slots_viewed_for_allocation"=>0, + "wiredTiger.async.total_allocations"=>0, + "wiredTiger.async.current_work_queue_length"=>0, + "wiredTiger.async.number_of_flush_calls"=>0, + "wiredTiger.async.maximum_work_queue_length"=>0, + "wiredTiger.async.total_compact_calls"=>0, + "wiredTiger.async.total_update_calls"=>0, + "wiredTiger.async.number_of_allocation_state_races"=>0, + "wiredTiger.async.number_of_times_operation_allocation_failed"=>0, + "wiredTiger.async.number_of_times_worker_found_no_work"=>0, + "wiredTiger.async.total_search_calls"=>0, + "wiredTiger.concurrentTransactions.write.out"=>0, + "wiredTiger.concurrentTransactions.write.available"=>128, + "wiredTiger.concurrentTransactions.write.totalTickets"=>128, + "wiredTiger.concurrentTransactions.read.out"=>0, + "wiredTiger.concurrentTransactions.read.available"=>128, + "wiredTiger.concurrentTransactions.read.totalTickets"=>128, + "wiredTiger.thread_state.active_filesystem_write_calls"=>0, + "wiredTiger.thread_state.active_filesystem_read_calls"=>0, + "wiredTiger.thread_state.active_filesystem_fsync_calls"=>0, + "metrics.document.deleted"=>0, + "metrics.document.inserted"=>0, + "metrics.document.returned"=>0, + "metrics.document.updated"=>0, + "metrics.getLastError.wtime_num"=>0, + "metrics.getLastError.wtime_totalMillis"=>0, + "metrics.getLastError.wtimeouts"=>0, + "metrics.operation.fastmod"=>0, + "metrics.operation.idhack"=>0, + "metrics.operation.scanAndOrder"=>0, + "metrics.queryExecutor.scanned"=>0, + "metrics.queryExecutor.scannedObjects"=>0, + "metrics.record.moves"=>0, + "metrics.repl.apply.batches_num"=>0, + "metrics.repl.apply.batches_totalMillis"=>0, + "metrics.repl.apply.ops"=>0, + "metrics.repl.buffer.count"=>0, + "metrics.repl.buffer.maxSizeBytes"=>268435456, + "metrics.repl.buffer.sizeBytes"=>0, + "metrics.repl.network.bytes"=>0, + "metrics.repl.network.getmores_num"=>0, + "metrics.repl.network.getmores_totalMillis"=>0, + "metrics.repl.network.ops"=>0, + "metrics.repl.network.readersCreated"=>0, + "metrics.repl.preload.docs_num"=>0, + "metrics.repl.preload.docs_totalMillis"=>0, + "metrics.repl.preload.indexes_num"=>0, + "metrics.repl.preload.indexes_totalMillis"=>0, + 'metrics.replicaset.state' => 1, + "metrics.storage.freelist.search_bucketExhauseted"=>0, + "metrics.storage.freelist.search_requests"=>0, + "metrics.storage.freelist.search_scanned"=>0, + "metrics.ttl.deletedDocuments"=>0, + "metrics.ttl.passes"=>18 + } ) end end From 32f2e48782bb2f16683b7ebc0bdf35101466e74f Mon Sep 17 00:00:00 2001 From: Parin Date: Thu, 20 Sep 2018 00:52:00 -0400 Subject: [PATCH 5/6] fix tests and refactored wiretiger metrics. --- lib/sensu-plugins-mongodb/metrics.rb | 368 +---------- .../lib/sensu-plugins-mongodb/metrics_spec.rb | 588 +++++++++--------- 2 files changed, 323 insertions(+), 633 deletions(-) diff --git a/lib/sensu-plugins-mongodb/metrics.rb b/lib/sensu-plugins-mongodb/metrics.rb index ddcca71..6493cb7 100644 --- a/lib/sensu-plugins-mongodb/metrics.rb +++ b/lib/sensu-plugins-mongodb/metrics.rb @@ -102,6 +102,26 @@ def replicaset_status end end + def wiretiger_metrics(wiredtiger, server_metrics) + # wiredtiger = server_status['wiredTiger'] + # data_handle Metrics + wiredtiger.each do |key1, value1| + next unless value1.is_a? Hash + wiredtiger[key1].each do |key2, value2| + if value2.is_a? Hash + wiredtiger[key1][key2].each do |key3, value3| + server_metrics['wiredTiger.' + key1.gsub(/(,|\s|-|\()+/, '_').tr(')', '') + '.' + + key2.gsub(/(,|\s|-|\()+/, '_').tr(')', '') + '.' + key3.gsub(/(,|\s|-|\()+/, '_').tr(')', '')] = value3 + end + else + server_metrics['wiredTiger.' + key1.gsub(/(,|\s|-|\()+/, '_').tr(')', '') + + '.' + key2.gsub(/(,|\s|-|\()+/, '_').tr(')', '')] = value2 + end + end + end + server_metrics + end + # Fetches metrics for the server we are connected to. # # @return [Mash] the metrics for the server. @@ -216,7 +236,6 @@ def server_metrics if Gem::Version.new(mongo_version) < Gem::Version.new('3.0.0') index_counters = server_status['indexCounters'] index_counters = server_status['indexCounters']['btree'] unless server_status['indexCounters']['btree'].nil? - server_metrics['indexes.missRatio'] = sprintf('%.5f', index_counters['missRatio']).to_s server_metrics['indexes.hits'] = index_counters['hits'] server_metrics['indexes.misses'] = index_counters['misses'] @@ -267,21 +286,15 @@ def server_metrics # Opcounters opcounters = server_status['opcounters'] - server_metrics['opcounters.insert'] = opcounters['insert'] - server_metrics['opcounters.query'] = opcounters['query'] - server_metrics['opcounters.update'] = opcounters['update'] - server_metrics['opcounters.delete'] = opcounters['delete'] - server_metrics['opcounters.getmore'] = opcounters['getmore'] - server_metrics['opcounters.command'] = opcounters['command'] + opcounters.each do |key, value| + server_metrics['opcounters.' + key] = value + end # Opcounters Replication opcounters_repl = server_status['opcountersRepl'] - server_metrics['opcountersRepl.insert'] = opcounters_repl['insert'] - server_metrics['opcountersRepl.query'] = opcounters_repl['query'] - server_metrics['opcountersRepl.update'] = opcounters_repl['update'] - server_metrics['opcountersRepl.delete'] = opcounters_repl['delete'] - server_metrics['opcountersRepl.getmore'] = opcounters_repl['getmore'] - server_metrics['opcountersRepl.command'] = opcounters_repl['command'] + opcounters_repl.each do |key, value| + server_metrics['opcountersRepl.' + key] = value + end # Memory mem = server_status['mem'] @@ -296,330 +309,11 @@ def server_metrics server_metrics['mem.heap_size_bytes'] = malloc['generic']['heap_size'] server_metrics['mem.current_allocated_bytes'] = malloc['generic']['current_allocated_bytes'] end - # WiredTiger specific Metrics - if server_status.key?('wiredTiger') - wiredTiger = server_status['wiredTiger'] - # data_handle Metrics - data_handle = wiredTiger['data-handle'] - server_metrics['wiredTiger.data_handle.session_dhandles_swept'] = data_handle['session dhandles swept'] - server_metrics['wiredTiger.data_handle.connection_sweeps'] = data_handle['connection sweeps'] - server_metrics['wiredTiger.data_handle.connection_sweep_dhandles_removed_from_hash_list'] = data_handle['connection sweep dhandles removed from hash list'] - server_metrics['wiredTiger.data_handle.connection_data_handles_currently_active'] = data_handle['connection data handles currently active'] - server_metrics['wiredTiger.data_handle.connection_sweep_dhandles_closed'] = data_handle['connection sweep dhandles closed'] - server_metrics['wiredTiger.data_handle.session_sweep_attempts'] = data_handle['session sweep attempts'] - server_metrics['wiredTiger.data_handle.connection_sweep_candidate_became_referenced'] = data_handle['connection sweep candidate became referenced'] - server_metrics['wiredTiger.data_handle.connection_sweep_time-of-death_sets'] = data_handle['connection sweep time-of-death sets'] - - - # reconciliation Metrics - reconciliation = wiredTiger['reconciliation'] - server_metrics['wiredTiger.reconciliation.fast-path_pages_deleted'] = reconciliation['fast-path pages deleted'] - server_metrics['wiredTiger.reconciliation.split_objects_currently_awaiting_free'] = reconciliation['split objects currently awaiting free'] - server_metrics['wiredTiger.reconciliation.split_bytes_currently_awaiting_free'] = reconciliation['split bytes currently awaiting free'] - server_metrics['wiredTiger.reconciliation.pages_deleted'] = reconciliation['pages deleted'] - server_metrics['wiredTiger.reconciliation.page_reconciliation_calls_for_eviction'] = reconciliation['page reconciliation calls for eviction'] - server_metrics['wiredTiger.reconciliation.page_reconciliation_calls'] = reconciliation['page reconciliation calls'] - - - # cache Metrics - cache = wiredTiger['cache'] - server_metrics['wiredTiger.cache.unmodified_pages_evicted'] = cache['unmodified pages evicted'] - server_metrics['wiredTiger.cache.eviction_server_evicting_pages'] = cache['eviction server evicting pages'] - server_metrics['wiredTiger.cache.tracked_dirty_pages_in_the_cache'] = cache['tracked dirty pages in the cache'] - server_metrics['wiredTiger.cache.overflow_values_cached_in_memory'] = cache['overflow values cached in memory'] - server_metrics['wiredTiger.cache.eviction_calls_to_get_a_page_found_queue_empty_after_locking'] = cache['eviction calls to get a page found queue empty after locking'] - server_metrics['wiredTiger.cache.internal_pages_split_during_eviction'] = cache['internal pages split during eviction'] - server_metrics['wiredTiger.cache.application_threads_page_write_from_cache_to_disk_time_(usecs)'] = cache['application threads page write from cache to disk time (usecs)'] - server_metrics['wiredTiger.cache.page_split_during_eviction_deepened_the_tree'] = cache['page split during eviction deepened the tree'] - server_metrics['wiredTiger.cache.leaf_pages_split_during_eviction'] = cache['leaf pages split during eviction'] - server_metrics['wiredTiger.cache.pages_walked_for_eviction'] = cache['pages walked for eviction'] - server_metrics['wiredTiger.cache.percentage_overhead'] = cache['percentage overhead'] - server_metrics['wiredTiger.cache.pages_evicted_by_application_threads'] = cache['pages evicted by application threads'] - server_metrics['wiredTiger.cache.tracked_dirty_bytes_in_the_cache'] = cache['tracked dirty bytes in the cache'] - server_metrics['wiredTiger.cache.maximum_page_size_at_eviction'] = cache['maximum page size at eviction'] - server_metrics['wiredTiger.cache.failed_eviction_of_pages_that_exceeded_the_in-memory_maximum'] = cache['failed eviction of pages that exceeded the in-memory maximum'] - server_metrics['wiredTiger.cache.application_threads_page_write_from_cache_to_disk_count'] = cache['application threads page write from cache to disk count'] - server_metrics['wiredTiger.cache.eviction_worker_thread_stable_number'] = cache['eviction worker thread stable number'] - server_metrics['wiredTiger.cache.pages_evicted_because_they_exceeded_the_in-memory_maximum'] = cache['pages evicted because they exceeded the in-memory maximum'] - server_metrics['wiredTiger.cache.tracked_bytes_belonging_to_leaf_pages_in_the_cache'] = cache['tracked bytes belonging to leaf pages in the cache'] - server_metrics['wiredTiger.cache.eviction_server_candidate_queue_empty_when_topping_up'] = cache['eviction server candidate queue empty when topping up'] - server_metrics['wiredTiger.cache.bytes_written_from_cache'] = cache['bytes written from cache'] - server_metrics['wiredTiger.cache.force_re-tuning_of_eviction_workers_once_in_a_while'] = cache['force re-tuning of eviction workers once in a while'] - server_metrics['wiredTiger.cache.eviction_empty_score'] = cache['eviction empty score'] - server_metrics['wiredTiger.cache.eviction_server_slept,_because_we_did_not_make_progress_with_eviction'] = cache['eviction server slept, because we did not make progress with eviction'] - server_metrics['wiredTiger.cache.pages_queued_for_urgent_eviction'] = cache['pages queued for urgent eviction'] - server_metrics['wiredTiger.cache.eviction_walks_abandoned'] = cache['eviction walks abandoned'] - server_metrics['wiredTiger.cache.eviction_currently_operating_in_aggressive_mode'] = cache['eviction currently operating in aggressive mode'] - server_metrics['wiredTiger.cache.application_threads_page_read_from_disk_to_cache_count'] = cache['application threads page read from disk to cache count'] - server_metrics['wiredTiger.cache.tracked_bytes_belonging_to_internal_pages_in_the_cache'] = cache['tracked bytes belonging to internal pages in the cache'] - server_metrics['wiredTiger.cache.bytes_currently_in_the_cache'] = cache['bytes currently in the cache'] - server_metrics['wiredTiger.cache.pages_selected_for_eviction_unable_to_be_evicted'] = cache['pages selected for eviction unable to be evicted'] - server_metrics['wiredTiger.cache.hazard_pointer_maximum_array_length'] = cache['hazard pointer maximum array length'] - server_metrics['wiredTiger.cache.lookaside_table_remove_calls'] = cache['lookaside table remove calls'] - server_metrics['wiredTiger.cache.in-memory_page_passed_criteria_to_be_split'] = cache['in-memory page passed criteria to be split'] - server_metrics['wiredTiger.cache.eviction_state'] = cache['eviction state'] - server_metrics['wiredTiger.cache.checkpoint_blocked_page_eviction'] = cache['checkpoint blocked page eviction'] - server_metrics['wiredTiger.cache.pages_queued_for_urgent_eviction_during_walk'] = cache['pages queued for urgent eviction during walk'] - server_metrics['wiredTiger.cache.eviction_calls_to_get_a_page_found_queue_empty'] = cache['eviction calls to get a page found queue empty'] - server_metrics['wiredTiger.cache.application_threads_page_read_from_disk_to_cache_time_(usecs)'] = cache['application threads page read from disk to cache time (usecs)'] - server_metrics['wiredTiger.cache.pages_written_from_cache'] = cache['pages written from cache'] - server_metrics['wiredTiger.cache.eviction_calls_to_get_a_page'] = cache['eviction calls to get a page'] - server_metrics['wiredTiger.cache.modified_pages_evicted_by_application_threads'] = cache['modified pages evicted by application threads'] - server_metrics['wiredTiger.cache.pages_seen_by_eviction_walk'] = cache['pages seen by eviction walk'] - server_metrics['wiredTiger.cache.eviction_worker_thread_evicting_pages'] = cache['eviction worker thread evicting pages'] - server_metrics['wiredTiger.cache.bytes_read_into_cache'] = cache['bytes read into cache'] - server_metrics['wiredTiger.cache.page_written_requiring_lookaside_records'] = cache['page written requiring lookaside records'] - server_metrics['wiredTiger.cache.hazard_pointer_blocked_page_eviction'] = cache['hazard pointer blocked page eviction'] - server_metrics['wiredTiger.cache.lookaside_table_insert_calls'] = cache['lookaside table insert calls'] - server_metrics['wiredTiger.cache.bytes_not_belonging_to_page_images_in_the_cache'] = cache['bytes not belonging to page images in the cache'] - server_metrics['wiredTiger.cache.pages_read_into_cache'] = cache['pages read into cache'] - server_metrics['wiredTiger.cache.pages_written_requiring_in-memory_restoration'] = cache['pages written requiring in-memory restoration'] - server_metrics['wiredTiger.cache.pages_evicted_because_they_had_chains_of_deleted_items'] = cache['pages evicted because they had chains of deleted items'] - server_metrics['wiredTiger.cache.files_with_new_eviction_walks_started'] = cache['files with new eviction walks started'] - server_metrics['wiredTiger.cache.pages_queued_for_eviction'] = cache['pages queued for eviction'] - server_metrics['wiredTiger.cache.eviction_worker_thread_removed'] = cache['eviction worker thread removed'] - server_metrics['wiredTiger.cache.eviction_worker_thread_active'] = cache['eviction worker thread active'] - server_metrics['wiredTiger.cache.pages_requested_from_the_cache'] = cache['pages requested from the cache'] - server_metrics['wiredTiger.cache.pages_read_into_cache_requiring_lookaside_entries'] = cache['pages read into cache requiring lookaside entries'] - server_metrics['wiredTiger.cache.eviction_server_candidate_queue_not_empty_when_topping_up'] = cache['eviction server candidate queue not empty when topping up'] - server_metrics['wiredTiger.cache.files_with_active_eviction_walks'] = cache['files with active eviction walks'] - server_metrics['wiredTiger.cache.hazard_pointer_check_entries_walked'] = cache['hazard pointer check entries walked'] - server_metrics['wiredTiger.cache.in-memory_page_splits'] = cache['in-memory page splits'] - server_metrics['wiredTiger.cache.internal_pages_evicted'] = cache['internal pages evicted'] - server_metrics['wiredTiger.cache.eviction_worker_thread_created'] = cache['eviction worker thread created'] - server_metrics['wiredTiger.cache.overflow_pages_read_into_cache'] = cache['overflow pages read into cache'] - server_metrics['wiredTiger.cache.maximum_bytes_configured'] = cache['maximum bytes configured'] - server_metrics['wiredTiger.cache.pages_currently_held_in_the_cache'] = cache['pages currently held in the cache'] - server_metrics['wiredTiger.cache.modified_pages_evicted'] = cache['modified pages evicted'] - server_metrics['wiredTiger.cache.eviction_server_unable_to_reach_eviction_goal'] = cache['eviction server unable to reach eviction goal'] - server_metrics['wiredTiger.cache.bytes_belonging_to_page_images_in_the_cache'] = cache['bytes belonging to page images in the cache'] - server_metrics['wiredTiger.cache.hazard_pointer_check_calls'] = cache['hazard pointer check calls'] - - - # log Metrics - log = wiredTiger['log'] - server_metrics['wiredTiger.log.log_sync_dir_operations'] = log['log sync_dir operations'] - server_metrics['wiredTiger.log.log_sync_dir_time_duration_(usecs)'] = log['log sync_dir time duration (usecs)'] - server_metrics['wiredTiger.log.log_write_operations'] = log['log write operations'] - server_metrics['wiredTiger.log.log_server_thread_advances_write_LSN'] = log['log server thread advances write LSN'] - server_metrics['wiredTiger.log.consolidated_slot_join_races'] = log['consolidated slot join races'] - server_metrics['wiredTiger.log.maximum_log_file_size'] = log['maximum log file size'] - server_metrics['wiredTiger.log.records_processed_by_log_scan'] = log['records processed by log scan'] - server_metrics['wiredTiger.log.total_log_buffer_size'] = log['total log buffer size'] - server_metrics['wiredTiger.log.log_records_too_small_to_compress'] = log['log records too small to compress'] - server_metrics['wiredTiger.log.log_force_write_operations_skipped'] = log['log force write operations skipped'] - server_metrics['wiredTiger.log.log_scan_operations'] = log['log scan operations'] - server_metrics['wiredTiger.log.pre-allocated_log_files_used'] = log['pre-allocated log files used'] - server_metrics['wiredTiger.log.pre-allocated_log_files_not_ready_and_missed'] = log['pre-allocated log files not ready and missed'] - server_metrics['wiredTiger.log.total_size_of_compressed_records'] = log['total size of compressed records'] - server_metrics['wiredTiger.log.pre-allocated_log_files_prepared'] = log['pre-allocated log files prepared'] - server_metrics['wiredTiger.log.log_sync_time_duration_(usecs)'] = log['log sync time duration (usecs)'] - server_metrics['wiredTiger.log.total_in-memory_size_of_compressed_records'] = log['total in-memory size of compressed records'] - server_metrics['wiredTiger.log.yields_waiting_for_previous_log_file_close'] = log['yields waiting for previous log file close'] - server_metrics['wiredTiger.log.log_records_not_compressed'] = log['log records not compressed'] - server_metrics['wiredTiger.log.log_force_write_operations'] = log['log force write operations'] - server_metrics['wiredTiger.log.consolidated_slot_unbuffered_writes'] = log['consolidated slot unbuffered writes'] - server_metrics['wiredTiger.log.written_slots_coalesced'] = log['written slots coalesced'] - server_metrics['wiredTiger.log.consolidated_slot_join_active_slot_closed'] = log['consolidated slot join active slot closed'] - server_metrics['wiredTiger.log.log_records_compressed'] = log['log records compressed'] - server_metrics['wiredTiger.log.number_of_pre-allocated_log_files_to_create'] = log['number of pre-allocated log files to create'] - server_metrics['wiredTiger.log.log_bytes_written'] = log['log bytes written'] - server_metrics['wiredTiger.log.busy_returns_attempting_to_switch_slots'] = log['busy returns attempting to switch slots'] - server_metrics['wiredTiger.log.consolidated_slot_transitions_unable_to_find_free_slot'] = log['consolidated slot transitions unable to find free slot'] - server_metrics['wiredTiger.log.consolidated_slot_joins'] = log['consolidated slot joins'] - server_metrics['wiredTiger.log.log_files_manually_zero-filled'] = log['log files manually zero-filled'] - server_metrics['wiredTiger.log.log_bytes_of_payload_data'] = log['log bytes of payload data'] - server_metrics['wiredTiger.log.log_flush_operations'] = log['log flush operations'] - server_metrics['wiredTiger.log.log_sync_operations'] = log['log sync operations'] - server_metrics['wiredTiger.log.log_scan_records_requiring_two_reads'] = log['log scan records requiring two reads'] - server_metrics['wiredTiger.log.logging_bytes_consolidated'] = log['logging bytes consolidated'] - server_metrics['wiredTiger.log.log_server_thread_write_LSN_walk_skipped'] = log['log server thread write LSN walk skipped'] - server_metrics['wiredTiger.log.consolidated_slot_join_transitions'] = log['consolidated slot join transitions'] - server_metrics['wiredTiger.log.log_release_advances_write_LSN'] = log['log release advances write LSN'] - server_metrics['wiredTiger.log.consolidated_slot_closures'] = log['consolidated slot closures'] - - - # lock Metrics - if server_status.key?('lock') - lock = wiredTiger['lock'] - server_metrics['wiredTiger.lock.schema_lock_application_thread_wait_time_(usecs)'] = lock['schema lock application thread wait time (usecs)'] - server_metrics['wiredTiger.lock.table_lock_application_thread_time_waiting_for_the_table_lock_(usecs)'] = lock['table lock application thread time waiting for the table lock (usecs)'] - server_metrics['wiredTiger.lock.checkpoint_lock_internal_thread_wait_time_(usecs)'] = lock['checkpoint lock internal thread wait time (usecs)'] - server_metrics['wiredTiger.lock.schema_lock_acquisitions'] = lock['schema lock acquisitions'] - server_metrics['wiredTiger.lock.handle-list_lock_eviction_thread_wait_time_(usecs)'] = lock['handle-list lock eviction thread wait time (usecs)'] - server_metrics['wiredTiger.lock.checkpoint_lock_acquisitions'] = lock['checkpoint lock acquisitions'] - server_metrics['wiredTiger.lock.table_lock_internal_thread_time_waiting_for_the_table_lock_(usecs)'] = lock['table lock internal thread time waiting for the table lock (usecs)'] - server_metrics['wiredTiger.lock.checkpoint_lock_application_thread_wait_time_(usecs)'] = lock['checkpoint lock application thread wait time (usecs)'] - server_metrics['wiredTiger.lock.table_lock_acquisitions'] = lock['table lock acquisitions'] - server_metrics['wiredTiger.lock.metadata_lock_application_thread_wait_time_(usecs)'] = lock['metadata lock application thread wait time (usecs)'] - server_metrics['wiredTiger.lock.schema_lock_internal_thread_wait_time_(usecs)'] = lock['schema lock internal thread wait time (usecs)'] - server_metrics['wiredTiger.lock.metadata_lock_internal_thread_wait_time_(usecs)'] = lock['metadata lock internal thread wait time (usecs)'] - server_metrics['wiredTiger.lock.metadata_lock_acquisitions'] = lock['metadata lock acquisitions'] - end - - - # LSM Metrics - log_structured_merge = wiredTiger['LSM'] - server_metrics['wiredTiger.LSM.sleep_for_LSM_merge_throttle'] = log_structured_merge['sleep for LSM merge throttle'] - server_metrics['wiredTiger.LSM.application_work_units_currently_queued'] = log_structured_merge['application work units currently queued'] - server_metrics['wiredTiger.LSM.rows_merged_in_an_LSM_tree'] = log_structured_merge['rows merged in an LSM tree'] - server_metrics['wiredTiger.LSM.switch_work_units_currently_queued'] = log_structured_merge['switch work units currently queued'] - server_metrics['wiredTiger.LSM.merge_work_units_currently_queued'] = log_structured_merge['merge work units currently queued'] - server_metrics['wiredTiger.LSM.tree_maintenance_operations_discarded'] = log_structured_merge['tree maintenance operations discarded'] - server_metrics['wiredTiger.LSM.sleep_for_LSM_checkpoint_throttle'] = log_structured_merge['sleep for LSM checkpoint throttle'] - server_metrics['wiredTiger.LSM.tree_maintenance_operations_executed'] = log_structured_merge['tree maintenance operations executed'] - server_metrics['wiredTiger.LSM.tree_maintenance_operations_scheduled'] = log_structured_merge['tree maintenance operations scheduled'] - server_metrics['wiredTiger.LSM.tree_queue_hit_maximum'] = log_structured_merge['tree queue hit maximum'] - - - # transaction Metrics - transaction = wiredTiger['transaction'] - server_metrics['wiredTiger.transaction.number_of_named_snapshots_dropped'] = transaction['number of named snapshots dropped'] - server_metrics['wiredTiger.transaction.transaction_checkpoint_currently_running'] = transaction['transaction checkpoint currently running'] - server_metrics['wiredTiger.transaction.transaction_begins'] = transaction['transaction begins'] - server_metrics['wiredTiger.transaction.transaction_fsync_calls_for_checkpoint_after_allocating_the_transaction_ID'] = transaction['transaction fsync calls for checkpoint after allocating the transaction ID'] - server_metrics['wiredTiger.transaction.transactions_committed'] = transaction['transactions committed'] - server_metrics['wiredTiger.transaction.transaction_checkpoint_most_recent_time_(msecs)'] = transaction['transaction checkpoint most recent time (msecs)'] - server_metrics['wiredTiger.transaction.transaction_checkpoints'] = transaction['transaction checkpoints'] - server_metrics['wiredTiger.transaction.transaction_range_of_IDs_currently_pinned_by_a_checkpoint'] = transaction['transaction range of IDs currently pinned by a checkpoint'] - server_metrics['wiredTiger.transaction.transaction_sync_calls'] = transaction['transaction sync calls'] - server_metrics['wiredTiger.transaction.transaction_checkpoint_scrub_dirty_target'] = transaction['transaction checkpoint scrub dirty target'] - server_metrics['wiredTiger.transaction.transaction_fsync_duration_for_checkpoint_after_allocating_the_transaction_ID_(usecs)'] = transaction['transaction fsync duration for checkpoint after allocating the transaction ID (usecs)'] - server_metrics['wiredTiger.transaction.transaction_checkpoints_skipped_because_database_was_clean'] = transaction['transaction checkpoints skipped because database was clean'] - server_metrics['wiredTiger.transaction.transaction_checkpoint_scrub_time_(msecs)'] = transaction['transaction checkpoint scrub time (msecs)'] - server_metrics['wiredTiger.transaction.transaction_checkpoint_max_time_(msecs)'] = transaction['transaction checkpoint max time (msecs)'] - server_metrics['wiredTiger.transaction.number_of_named_snapshots_created'] = transaction['number of named snapshots created'] - server_metrics['wiredTiger.transaction.transaction_checkpoint_min_time_(msecs)'] = transaction['transaction checkpoint min time (msecs)'] - server_metrics['wiredTiger.transaction.transaction_checkpoint_total_time_(msecs)'] = transaction['transaction checkpoint total time (msecs)'] - server_metrics['wiredTiger.transaction.transaction_checkpoint_generation'] = transaction['transaction checkpoint generation'] - server_metrics['wiredTiger.transaction.transaction_failures_due_to_cache_overflow'] = transaction['transaction failures due to cache overflow'] - server_metrics['wiredTiger.transaction.transaction_range_of_IDs_currently_pinned_by_named_snapshots'] = transaction['transaction range of IDs currently pinned by named snapshots'] - server_metrics['wiredTiger.transaction.transactions_rolled_back'] = transaction['transactions rolled back'] - server_metrics['wiredTiger.transaction.transaction_range_of_IDs_currently_pinned'] = transaction['transaction range of IDs currently pinned'] - - - # cursor Metrics - cursor = wiredTiger['cursor'] - server_metrics['wiredTiger.cursor.cursor_restarted_searches'] = cursor['cursor restarted searches'] - server_metrics['wiredTiger.cursor.cursor_prev_calls'] = cursor['cursor prev calls'] - server_metrics['wiredTiger.cursor.cursor_insert_calls'] = cursor['cursor insert calls'] - server_metrics['wiredTiger.cursor.cursor_reset_calls'] = cursor['cursor reset calls'] - server_metrics['wiredTiger.cursor.cursor_update_calls'] = cursor['cursor update calls'] - server_metrics['wiredTiger.cursor.cursor_search_near_calls'] = cursor['cursor search near calls'] - server_metrics['wiredTiger.cursor.cursor_search_calls'] = cursor['cursor search calls'] - server_metrics['wiredTiger.cursor.cursor_next_calls'] = cursor['cursor next calls'] - server_metrics['wiredTiger.cursor.cursor_create_calls'] = cursor['cursor create calls'] - server_metrics['wiredTiger.cursor.truncate_calls'] = cursor['truncate calls'] - server_metrics['wiredTiger.cursor.cursor_remove_calls'] = cursor['cursor remove calls'] - - - # connection Metrics - connection = wiredTiger['connection'] - server_metrics['wiredTiger.connection.total_read_I/Os'] = connection['total read I/Os'] - server_metrics['wiredTiger.connection.memory_re-allocations'] = connection['memory re-allocations'] - server_metrics['wiredTiger.connection.pthread_mutex_shared_lock_write-lock_calls'] = connection['pthread mutex shared lock write-lock calls'] - server_metrics['wiredTiger.connection.auto_adjusting_condition_resets'] = connection['auto adjusting condition resets'] - server_metrics['wiredTiger.connection.detected_system_time_went_backwards'] = connection['detected system time went backwards'] - server_metrics['wiredTiger.connection.pthread_mutex_condition_wait_calls'] = connection['pthread mutex condition wait calls'] - server_metrics['wiredTiger.connection.memory_frees'] = connection['memory frees'] - server_metrics['wiredTiger.connection.pthread_mutex_shared_lock_read-lock_calls'] = connection['pthread mutex shared lock read-lock calls'] - server_metrics['wiredTiger.connection.total_fsync_I/Os'] = connection['total fsync I/Os'] - server_metrics['wiredTiger.connection.files_currently_open'] = connection['files currently open'] - server_metrics['wiredTiger.connection.memory_allocations'] = connection['memory allocations'] - server_metrics['wiredTiger.connection.auto_adjusting_condition_wait_calls'] = connection['auto adjusting condition wait calls'] - server_metrics['wiredTiger.connection.total_write_I/Os'] = connection['total write I/Os'] - - - # session Metrics - session = wiredTiger['session'] - server_metrics['wiredTiger.session.table_drop_successful_calls'] = session['table drop successful calls'] - server_metrics['wiredTiger.session.table_alter_unchanged_and_skipped'] = session['table alter unchanged and skipped'] - server_metrics['wiredTiger.session.table_truncate_failed_calls'] = session['table truncate failed calls'] - server_metrics['wiredTiger.session.table_compact_failed_calls'] = session['table compact failed calls'] - server_metrics['wiredTiger.session.table_salvage_successful_calls'] = session['table salvage successful calls'] - server_metrics['wiredTiger.session.open_cursor_count'] = session['open cursor count'] - server_metrics['wiredTiger.session.table_create_failed_calls'] = session['table create failed calls'] - server_metrics['wiredTiger.session.table_create_successful_calls'] = session['table create successful calls'] - server_metrics['wiredTiger.session.table_verify_successful_calls'] = session['table verify successful calls'] - server_metrics['wiredTiger.session.table_drop_failed_calls'] = session['table drop failed calls'] - server_metrics['wiredTiger.session.open_session_count'] = session['open session count'] - server_metrics['wiredTiger.session.table_verify_failed_calls'] = session['table verify failed calls'] - server_metrics['wiredTiger.session.table_rename_successful_calls'] = session['table rename successful calls'] - server_metrics['wiredTiger.session.table_rebalance_failed_calls'] = session['table rebalance failed calls'] - server_metrics['wiredTiger.session.table_alter_failed_calls'] = session['table alter failed calls'] - server_metrics['wiredTiger.session.table_rebalance_successful_calls'] = session['table rebalance successful calls'] - server_metrics['wiredTiger.session.table_salvage_failed_calls'] = session['table salvage failed calls'] - server_metrics['wiredTiger.session.table_truncate_successful_calls'] = session['table truncate successful calls'] - server_metrics['wiredTiger.session.table_alter_successful_calls'] = session['table alter successful calls'] - server_metrics['wiredTiger.session.table_compact_successful_calls'] = session['table compact successful calls'] - server_metrics['wiredTiger.session.table_rename_failed_calls'] = session['table rename failed calls'] - - - # block_manager Metrics - block_manager = wiredTiger['block-manager'] - server_metrics['wiredTiger.block_manager.bytes_read'] = block_manager['bytes read'] - server_metrics['wiredTiger.block_manager.blocks_read'] = block_manager['blocks read'] - server_metrics['wiredTiger.block_manager.blocks_pre-loaded'] = block_manager['blocks pre-loaded'] - server_metrics['wiredTiger.block_manager.bytes_written'] = block_manager['bytes written'] - server_metrics['wiredTiger.block_manager.mapped_bytes_read'] = block_manager['mapped bytes read'] - server_metrics['wiredTiger.block_manager.bytes_written_for_checkpoint'] = block_manager['bytes written for checkpoint'] - server_metrics['wiredTiger.block_manager.blocks_written'] = block_manager['blocks written'] - server_metrics['wiredTiger.block_manager.mapped_blocks_read'] = block_manager['mapped blocks read'] - - - # thread_yield Metrics - thread_yield = wiredTiger['thread-yield'] - server_metrics['wiredTiger.thread_yield.page_acquire_busy_blocked'] = thread_yield['page acquire busy blocked'] - server_metrics['wiredTiger.thread_yield.page_reconciliation_yielded_due_to_child_modification'] = thread_yield['page reconciliation yielded due to child modification'] - server_metrics['wiredTiger.thread_yield.data_handle_lock_yielded'] = thread_yield['data handle lock yielded'] - server_metrics['wiredTiger.thread_yield.connection_close_blocked_waiting_for_transaction_state_stabilization'] = thread_yield['connection close blocked waiting for transaction state stabilization'] - server_metrics['wiredTiger.thread_yield.connection_close_yielded_for_lsm_manager_shutdown'] = thread_yield['connection close yielded for lsm manager shutdown'] - server_metrics['wiredTiger.thread_yield.application_thread_time_evicting_(usecs)'] = thread_yield['application thread time evicting (usecs)'] - server_metrics['wiredTiger.thread_yield.reference_for_page_index_and_slot_yielded'] = thread_yield['reference for page index and slot yielded'] - server_metrics['wiredTiger.thread_yield.page_acquire_read_blocked'] = thread_yield['page acquire read blocked'] - server_metrics['wiredTiger.thread_yield.log_server_sync_yielded_for_log_write'] = thread_yield['log server sync yielded for log write'] - server_metrics['wiredTiger.thread_yield.page_acquire_locked_blocked'] = thread_yield['page acquire locked blocked'] - server_metrics['wiredTiger.thread_yield.page_delete_rollback_yielded_for_instantiation'] = thread_yield['page delete rollback yielded for instantiation'] - server_metrics['wiredTiger.thread_yield.tree_descend_one_level_yielded_for_split_page_index_update'] = thread_yield['tree descend one level yielded for split page index update'] - server_metrics['wiredTiger.thread_yield.page_acquire_eviction_blocked'] = thread_yield['page acquire eviction blocked'] - server_metrics['wiredTiger.thread_yield.application_thread_time_waiting_for_cache_(usecs)'] = thread_yield['application thread time waiting for cache (usecs)'] - server_metrics['wiredTiger.thread_yield.page_acquire_time_sleeping_(usecs)'] = thread_yield['page acquire time sleeping (usecs)'] - - - # async Metrics - async = wiredTiger['async'] - server_metrics['wiredTiger.async.total_insert_calls'] = async['total insert calls'] - server_metrics['wiredTiger.async.total_remove_calls'] = async['total remove calls'] - server_metrics['wiredTiger.async.number_of_operation_slots_viewed_for_allocation'] = async['number of operation slots viewed for allocation'] - server_metrics['wiredTiger.async.total_allocations'] = async['total allocations'] - server_metrics['wiredTiger.async.current_work_queue_length'] = async['current work queue length'] - server_metrics['wiredTiger.async.number_of_flush_calls'] = async['number of flush calls'] - server_metrics['wiredTiger.async.maximum_work_queue_length'] = async['maximum work queue length'] - server_metrics['wiredTiger.async.total_compact_calls'] = async['total compact calls'] - server_metrics['wiredTiger.async.total_update_calls'] = async['total update calls'] - server_metrics['wiredTiger.async.number_of_allocation_state_races'] = async['number of allocation state races'] - server_metrics['wiredTiger.async.number_of_times_operation_allocation_failed'] = async['number of times operation allocation failed'] - server_metrics['wiredTiger.async.number_of_times_worker_found_no_work'] = async['number of times worker found no work'] - server_metrics['wiredTiger.async.total_search_calls'] = async['total search calls'] - - - # concurrentTransactions Metrics - concurrentTransactions = wiredTiger['concurrentTransactions'] - server_metrics['wiredTiger.concurrentTransactions.write.out'] = concurrentTransactions['write']['out'] - server_metrics['wiredTiger.concurrentTransactions.write.available'] = concurrentTransactions['write']['available'] - server_metrics['wiredTiger.concurrentTransactions.write.totalTickets'] = concurrentTransactions['write']['totalTickets'] - - server_metrics['wiredTiger.concurrentTransactions.read.out'] = concurrentTransactions['read']['out'] - server_metrics['wiredTiger.concurrentTransactions.read.available'] = concurrentTransactions['read']['available'] - server_metrics['wiredTiger.concurrentTransactions.read.totalTickets'] = concurrentTransactions['read']['totalTickets'] - - # thread-state Metrics - thread_state = wiredTiger['thread-state'] - server_metrics['wiredTiger.thread_state.active_filesystem_write_calls'] = thread_state['active filesystem write calls'] - server_metrics['wiredTiger.thread_state.active_filesystem_read_calls'] = thread_state['active filesystem read calls'] - server_metrics['wiredTiger.thread_state.active_filesystem_fsync_calls'] = thread_state['active filesystem fsync calls'] - - end + # WiredTiger specific Metrics + if server_status.key?('wiredTiger') + wiredtiger = server_status['wiredTiger'] + server_metrics = wiretiger_metrics(wiredtiger, server_metrics) + end # Metrics (documents) document = server_status['metrics']['document'] diff --git a/test/lib/sensu-plugins-mongodb/metrics_spec.rb b/test/lib/sensu-plugins-mongodb/metrics_spec.rb index e98a312..e0cb1e5 100644 --- a/test/lib/sensu-plugins-mongodb/metrics_spec.rb +++ b/test/lib/sensu-plugins-mongodb/metrics_spec.rb @@ -66,7 +66,6 @@ metrics.connect_mongo_db('admin') result = metrics.server_metrics expect(result).to eq( - { 'asserts.errors' => 0, 'asserts.regular' => 0, 'asserts.rollovers' => 0, @@ -90,7 +89,7 @@ 'databaseSizes.admin.storageSize' => 286_72, 'databaseSizes.admin.numExtents' => 4, 'databaseSizes.admin.indexes' => 3, - 'databaseSizes.admin.indexSize' => 245_280, + 'databaseSizes.admin.indexSize' => 245_28, 'databaseSizes.admin.fileSize' => 671_088_64, 'databaseSizes.admin.nsSizeMB' => 16, 'indexes.accesses' => 2, @@ -115,7 +114,6 @@ 'lock.queue_total' => 0, 'lock.queue_writers' => 0, 'lock.totalTime' => 4_127_130_000, - 'mem.heap_usage_bytes' => 62_525_976.0, 'mem.mapped' => 80, 'mem.mappedWithJournal' => 160, 'mem.pageFaults' => 236, @@ -170,7 +168,7 @@ 'opcountersRepl.insert' => 0, 'opcountersRepl.query' => 0, 'opcountersRepl.update' => 0 - }) + ) end end @@ -208,298 +206,296 @@ metrics.connect_mongo_db('admin') result = metrics.server_metrics expect(result).to eq( - { - "asserts.warnings" => 0, - "asserts.errors" => 0, - "asserts.regular" => 0, - "asserts.user" => 0, - "asserts.rollovers" => 0, - "connections.current" => 2, - "connections.available" => 838858, - "connections.totalCreated" => 30, - "cursors.timedOut" => 0, - "cursors.open.noTimeout" => 0, - "cursors.open.pinned" => 0, - "cursors.open.total" => 0, - - "databaseSizes.admin.avgObjSize" => 106.18181818181819, - "databaseSizes.admin.collections" => 4, - "databaseSizes.admin.dataSize" => 1168, - "databaseSizes.admin.fileSize" => 67108864, - "databaseSizes.admin.indexSize" => 245_280, - "databaseSizes.admin.indexes" => 3, - "databaseSizes.admin.nsSizeMB" => 16, - "databaseSizes.admin.numExtents" => 4, - "databaseSizes.admin.objects" => 11, - "databaseSizes.admin.storageSize" => 28672, - - "mem.pageFaults"=>0, - "mem.heap_size_bytes"=>64520192, - "lock.totalTime"=>1112002000, - "lock.queue_total"=>0, - "lock.queue_readers"=>0, - "lock.queue_writers"=>0, - "lock.clients_total"=>9, - "lock.clients_readers"=>0, - "lock.clients_writers"=>0, - "locks.Collection.acquireCount_r"=>304, - "locks.Global.acquireCount_r"=>653, - "locks.Global.acquireCount_w"=>653, - "locks.Global.acquireCount_W"=>653, - "locks.Database.acquireCount_r"=>313, - "locks.Database.acquireCount_R"=>313, - "locks.Database.acquireCount_W"=>313, - "network.bytesIn"=>7932, - "network.bytesOut"=>182742, - "network.numRequests"=>66, - "opcounters.insert"=>0, - "opcounters.query"=>1, - "opcounters.update"=>0, - "opcounters.delete"=>0, - "opcounters.getmore"=>0, - "opcounters.command"=>67, - "opcountersRepl.insert"=>0, - "opcountersRepl.query"=>0, - "opcountersRepl.update"=>0, - "opcountersRepl.delete"=>0, - "opcountersRepl.getmore"=>0, - "opcountersRepl.command"=>0, - "mem.residentMb"=>50, - "mem.virtualMb"=>244, - "mem.mapped"=>0, - "mem.mappedWithJournal"=>0, - "mem.current_allocated_bytes"=>60183928, - "wiredTiger.data_handle.session_dhandles_swept"=>0, - "wiredTiger.data_handle.connection_sweeps"=>111, - "wiredTiger.data_handle.connection_sweep_dhandles_removed_from_hash_list"=>72, - "wiredTiger.data_handle.connection_data_handles_currently_active"=>6, - "wiredTiger.data_handle.connection_sweep_dhandles_closed"=>0, - "wiredTiger.data_handle.session_sweep_attempts"=>33, - "wiredTiger.data_handle.connection_sweep_candidate_became_referenced"=>0, - "wiredTiger.data_handle.connection_sweep_time-of-death_sets"=>72, - "wiredTiger.reconciliation.fast-path_pages_deleted"=>0, - "wiredTiger.reconciliation.split_objects_currently_awaiting_free"=>0, - "wiredTiger.reconciliation.split_bytes_currently_awaiting_free"=>0, - "wiredTiger.reconciliation.pages_deleted"=>0, - "wiredTiger.reconciliation.page_reconciliation_calls_for_eviction"=>0, - "wiredTiger.reconciliation.page_reconciliation_calls"=>12, - "wiredTiger.cache.unmodified_pages_evicted"=>0, - "wiredTiger.cache.eviction_server_evicting_pages"=>0, - "wiredTiger.cache.tracked_dirty_pages_in_the_cache"=>0, - "wiredTiger.cache.eviction_calls_to_get_a_page_found_queue_empty_after_locking"=>0, - "wiredTiger.cache.internal_pages_split_during_eviction"=>0, - "wiredTiger.cache.page_split_during_eviction_deepened_the_tree"=>0, - "wiredTiger.cache.leaf_pages_split_during_eviction"=>0, - "wiredTiger.cache.pages_walked_for_eviction"=>0, - "wiredTiger.cache.percentage_overhead"=>8, - "wiredTiger.cache.pages_evicted_by_application_threads"=>0, - "wiredTiger.cache.tracked_dirty_bytes_in_the_cache"=>0, - "wiredTiger.cache.maximum_page_size_at_eviction"=>0, - "wiredTiger.cache.failed_eviction_of_pages_that_exceeded_the_in-memory_maximum"=>0, - - "wiredTiger.cache.pages_evicted_because_they_exceeded_the_in-memory_maximum"=>0, - "wiredTiger.cache.tracked_bytes_belonging_to_leaf_pages_in_the_cache"=>31212, - "wiredTiger.cache.eviction_server_candidate_queue_empty_when_topping_up"=>0, - "wiredTiger.cache.bytes_written_from_cache"=>19144, - - "wiredTiger.cache.eviction_server_slept,_because_we_did_not_make_progress_with_eviction"=>0, - "wiredTiger.cache.pages_queued_for_urgent_eviction"=>0, - "wiredTiger.cache.eviction_currently_operating_in_aggressive_mode"=>0, - "wiredTiger.cache.tracked_bytes_belonging_to_internal_pages_in_the_cache"=>13631, - "wiredTiger.cache.bytes_currently_in_the_cache"=>44843, - "wiredTiger.cache.pages_selected_for_eviction_unable_to_be_evicted"=>0, - "wiredTiger.cache.hazard_pointer_maximum_array_length"=>0, - "wiredTiger.cache.lookaside_table_remove_calls"=>0, - "wiredTiger.cache.in-memory_page_passed_criteria_to_be_split"=>0, - "wiredTiger.cache.checkpoint_blocked_page_eviction"=>0, - "wiredTiger.cache.eviction_calls_to_get_a_page_found_queue_empty"=>0, - "wiredTiger.cache.pages_written_from_cache"=>12, - "wiredTiger.cache.eviction_calls_to_get_a_page"=>0, - "wiredTiger.cache.modified_pages_evicted_by_application_threads"=>0, - "wiredTiger.cache.pages_seen_by_eviction_walk"=>0, - "wiredTiger.cache.eviction_worker_thread_evicting_pages"=>0, - "wiredTiger.cache.bytes_read_into_cache"=>7541, - "wiredTiger.cache.page_written_requiring_lookaside_records"=>0, - "wiredTiger.cache.hazard_pointer_blocked_page_eviction"=>0, - "wiredTiger.cache.lookaside_table_insert_calls"=>0, - "wiredTiger.cache.pages_read_into_cache"=>10, - "wiredTiger.cache.pages_written_requiring_in-memory_restoration"=>0, - "wiredTiger.cache.pages_evicted_because_they_had_chains_of_deleted_items"=>0, - "wiredTiger.cache.files_with_new_eviction_walks_started"=>0, - "wiredTiger.cache.pages_queued_for_eviction"=>0, - "wiredTiger.cache.pages_requested_from_the_cache"=>244, - "wiredTiger.cache.pages_read_into_cache_requiring_lookaside_entries"=>0, - "wiredTiger.cache.eviction_server_candidate_queue_not_empty_when_topping_up"=>0, - "wiredTiger.cache.files_with_active_eviction_walks"=>0, - "wiredTiger.cache.hazard_pointer_check_entries_walked"=>0, - "wiredTiger.cache.in-memory_page_splits"=>0, - "wiredTiger.cache.internal_pages_evicted"=>0, - - "wiredTiger.cache.maximum_bytes_configured"=>1073741824.0, - "wiredTiger.cache.pages_currently_held_in_the_cache"=>11, - "wiredTiger.cache.modified_pages_evicted"=>0, - "wiredTiger.cache.eviction_server_unable_to_reach_eviction_goal"=>0, - "wiredTiger.cache.hazard_pointer_check_calls"=>0, - "wiredTiger.log.log_sync_dir_operations"=>1, - "wiredTiger.log.log_sync_dir_time_duration_(usecs)"=>16, - "wiredTiger.log.log_write_operations"=>11, - "wiredTiger.log.log_server_thread_advances_write_LSN"=>2, - "wiredTiger.log.consolidated_slot_join_races"=>0, - "wiredTiger.log.maximum_log_file_size"=>104857600, - "wiredTiger.log.records_processed_by_log_scan"=>10, - "wiredTiger.log.total_log_buffer_size"=>33554432, - "wiredTiger.log.log_records_too_small_to_compress"=>6, - "wiredTiger.log.log_force_write_operations_skipped"=>12166, - "wiredTiger.log.log_scan_operations"=>3, - "wiredTiger.log.pre-allocated_log_files_used"=>0, - "wiredTiger.log.pre-allocated_log_files_not_ready_and_missed"=>1, - "wiredTiger.log.total_size_of_compressed_records"=>3183, - "wiredTiger.log.pre-allocated_log_files_prepared"=>2, - "wiredTiger.log.log_sync_time_duration_(usecs)"=>14238, - "wiredTiger.log.total_in-memory_size_of_compressed_records"=>4749, - "wiredTiger.log.yields_waiting_for_previous_log_file_close"=>0, - "wiredTiger.log.log_records_not_compressed"=>1, - "wiredTiger.log.log_force_write_operations"=>12168, - "wiredTiger.log.consolidated_slot_unbuffered_writes"=>0, - "wiredTiger.log.written_slots_coalesced"=>0, - "wiredTiger.log.log_records_compressed"=>4, - "wiredTiger.log.number_of_pre-allocated_log_files_to_create"=>2, - "wiredTiger.log.log_bytes_written"=>4736, - "wiredTiger.log.busy_returns_attempting_to_switch_slots"=>0, - "wiredTiger.log.consolidated_slot_joins"=>11, - "wiredTiger.log.log_files_manually_zero-filled"=>0, - "wiredTiger.log.log_bytes_of_payload_data"=>3497, - "wiredTiger.log.log_flush_operations"=>11023, - "wiredTiger.log.log_sync_operations"=>7, - "wiredTiger.log.log_scan_records_requiring_two_reads"=>4, - "wiredTiger.log.logging_bytes_consolidated"=>4352, - "wiredTiger.log.log_server_thread_write_LSN_walk_skipped"=>2078, - "wiredTiger.log.consolidated_slot_join_transitions"=>7, - "wiredTiger.log.log_release_advances_write_LSN"=>5, - "wiredTiger.log.consolidated_slot_closures"=>7, - "wiredTiger.LSM.sleep_for_LSM_merge_throttle"=>0, - "wiredTiger.LSM.application_work_units_currently_queued"=>0, - "wiredTiger.LSM.rows_merged_in_an_LSM_tree"=>0, - "wiredTiger.LSM.switch_work_units_currently_queued"=>0, - "wiredTiger.LSM.merge_work_units_currently_queued"=>0, - "wiredTiger.LSM.tree_maintenance_operations_discarded"=>0, - "wiredTiger.LSM.sleep_for_LSM_checkpoint_throttle"=>0, - "wiredTiger.LSM.tree_maintenance_operations_executed"=>0, - "wiredTiger.LSM.tree_maintenance_operations_scheduled"=>0, - "wiredTiger.LSM.tree_queue_hit_maximum"=>0, - "wiredTiger.transaction.number_of_named_snapshots_dropped"=>0, - "wiredTiger.transaction.transaction_checkpoint_currently_running"=>0, - "wiredTiger.transaction.transaction_begins"=>41, - "wiredTiger.transaction.transaction_fsync_calls_for_checkpoint_after_allocating_the_transaction_ID"=>19, - "wiredTiger.transaction.transactions_committed"=>4, - "wiredTiger.transaction.transaction_checkpoint_most_recent_time_(msecs)"=>6, - "wiredTiger.transaction.transaction_checkpoints"=>19, - "wiredTiger.transaction.transaction_range_of_IDs_currently_pinned_by_a_checkpoint"=>0, - "wiredTiger.transaction.transaction_sync_calls"=>0, - "wiredTiger.transaction.transaction_fsync_duration_for_checkpoint_after_allocating_the_transaction_ID_(usecs)"=>21003, - "wiredTiger.transaction.transaction_checkpoint_max_time_(msecs)"=>8, - "wiredTiger.transaction.number_of_named_snapshots_created"=>0, - "wiredTiger.transaction.transaction_checkpoint_min_time_(msecs)"=>6, - "wiredTiger.transaction.transaction_checkpoint_total_time_(msecs)"=>28, - "wiredTiger.transaction.transaction_checkpoint_generation"=>19, - "wiredTiger.transaction.transaction_failures_due_to_cache_overflow"=>0, - "wiredTiger.transaction.transaction_range_of_IDs_currently_pinned_by_named_snapshots"=>0, - "wiredTiger.transaction.transactions_rolled_back"=>37, - "wiredTiger.transaction.transaction_range_of_IDs_currently_pinned"=>0, - "wiredTiger.cursor.cursor_restarted_searches"=>0, - "wiredTiger.cursor.cursor_prev_calls"=>3, - "wiredTiger.cursor.cursor_insert_calls"=>12, - "wiredTiger.cursor.cursor_reset_calls"=>220, - "wiredTiger.cursor.cursor_update_calls"=>0, - "wiredTiger.cursor.cursor_search_near_calls"=>1, - "wiredTiger.cursor.cursor_search_calls"=>209, - "wiredTiger.cursor.cursor_next_calls"=>28, - "wiredTiger.cursor.cursor_create_calls"=>29, - "wiredTiger.cursor.truncate_calls"=>0, - "wiredTiger.cursor.cursor_remove_calls"=>1, - "wiredTiger.connection.total_read_I/Os"=>876, - "wiredTiger.connection.memory_re-allocations"=>4577, - "wiredTiger.connection.pthread_mutex_shared_lock_write-lock_calls"=>1296, - "wiredTiger.connection.auto_adjusting_condition_resets"=>9, - "wiredTiger.connection.pthread_mutex_condition_wait_calls"=>14531, - "wiredTiger.connection.memory_frees"=>19113, - "wiredTiger.connection.pthread_mutex_shared_lock_read-lock_calls"=>2574, - "wiredTiger.connection.total_fsync_I/Os"=>190, - "wiredTiger.connection.files_currently_open"=>9, - "wiredTiger.connection.memory_allocations"=>19700, - "wiredTiger.connection.auto_adjusting_condition_wait_calls"=>3372, - "wiredTiger.connection.total_write_I/Os"=>38, - "wiredTiger.session.open_cursor_count"=>20, - "wiredTiger.session.open_session_count"=>16, - "wiredTiger.block_manager.bytes_read"=>69632, - "wiredTiger.block_manager.blocks_read"=>16, - "wiredTiger.block_manager.blocks_pre-loaded"=>5, - "wiredTiger.block_manager.bytes_written"=>110592, - "wiredTiger.block_manager.mapped_bytes_read"=>0, - "wiredTiger.block_manager.blocks_written"=>24, - "wiredTiger.block_manager.mapped_blocks_read"=>0, - "wiredTiger.thread_yield.page_acquire_busy_blocked"=>0, - "wiredTiger.thread_yield.page_acquire_read_blocked"=>0, - "wiredTiger.thread_yield.page_acquire_locked_blocked"=>0, - "wiredTiger.thread_yield.page_acquire_eviction_blocked"=>0, - "wiredTiger.thread_yield.page_acquire_time_sleeping_(usecs)"=>0, - "wiredTiger.async.total_insert_calls"=>0, - "wiredTiger.async.total_remove_calls"=>0, - "wiredTiger.async.number_of_operation_slots_viewed_for_allocation"=>0, - "wiredTiger.async.total_allocations"=>0, - "wiredTiger.async.current_work_queue_length"=>0, - "wiredTiger.async.number_of_flush_calls"=>0, - "wiredTiger.async.maximum_work_queue_length"=>0, - "wiredTiger.async.total_compact_calls"=>0, - "wiredTiger.async.total_update_calls"=>0, - "wiredTiger.async.number_of_allocation_state_races"=>0, - "wiredTiger.async.number_of_times_operation_allocation_failed"=>0, - "wiredTiger.async.number_of_times_worker_found_no_work"=>0, - "wiredTiger.async.total_search_calls"=>0, - "wiredTiger.concurrentTransactions.write.out"=>0, - "wiredTiger.concurrentTransactions.write.available"=>128, - "wiredTiger.concurrentTransactions.write.totalTickets"=>128, - "wiredTiger.concurrentTransactions.read.out"=>0, - "wiredTiger.concurrentTransactions.read.available"=>128, - "wiredTiger.concurrentTransactions.read.totalTickets"=>128, - "wiredTiger.thread_state.active_filesystem_write_calls"=>0, - "wiredTiger.thread_state.active_filesystem_read_calls"=>0, - "wiredTiger.thread_state.active_filesystem_fsync_calls"=>0, - "metrics.document.deleted"=>0, - "metrics.document.inserted"=>0, - "metrics.document.returned"=>0, - "metrics.document.updated"=>0, - "metrics.getLastError.wtime_num"=>0, - "metrics.getLastError.wtime_totalMillis"=>0, - "metrics.getLastError.wtimeouts"=>0, - "metrics.operation.fastmod"=>0, - "metrics.operation.idhack"=>0, - "metrics.operation.scanAndOrder"=>0, - "metrics.queryExecutor.scanned"=>0, - "metrics.queryExecutor.scannedObjects"=>0, - "metrics.record.moves"=>0, - "metrics.repl.apply.batches_num"=>0, - "metrics.repl.apply.batches_totalMillis"=>0, - "metrics.repl.apply.ops"=>0, - "metrics.repl.buffer.count"=>0, - "metrics.repl.buffer.maxSizeBytes"=>268435456, - "metrics.repl.buffer.sizeBytes"=>0, - "metrics.repl.network.bytes"=>0, - "metrics.repl.network.getmores_num"=>0, - "metrics.repl.network.getmores_totalMillis"=>0, - "metrics.repl.network.ops"=>0, - "metrics.repl.network.readersCreated"=>0, - "metrics.repl.preload.docs_num"=>0, - "metrics.repl.preload.docs_totalMillis"=>0, - "metrics.repl.preload.indexes_num"=>0, - "metrics.repl.preload.indexes_totalMillis"=>0, - 'metrics.replicaset.state' => 1, - "metrics.storage.freelist.search_bucketExhauseted"=>0, - "metrics.storage.freelist.search_requests"=>0, - "metrics.storage.freelist.search_scanned"=>0, - "metrics.ttl.deletedDocuments"=>0, - "metrics.ttl.passes"=>18 - } + 'asserts.warnings' => 0, + 'asserts.errors' => 0, + 'asserts.regular' => 0, + 'asserts.user' => 0, + 'asserts.rollovers' => 0, + 'connections.current' => 2, + 'connections.available' => 838_858, + 'connections.totalCreated' => 30, + 'cursors.timedOut' => 0, + 'cursors.open.noTimeout' => 0, + 'cursors.open.pinned' => 0, + 'cursors.open.total' => 0, + 'databaseSizes.admin.avgObjSize' => 106.18181818181819, + 'databaseSizes.admin.collections' => 4, + 'databaseSizes.admin.dataSize' => 116_8, + 'databaseSizes.admin.fileSize' => 671_088_64, + 'databaseSizes.admin.indexSize' => 245_28.0, + 'databaseSizes.admin.indexes' => 3, + 'databaseSizes.admin.nsSizeMB' => 16, + 'databaseSizes.admin.numExtents' => 4, + 'databaseSizes.admin.objects' => 11, + 'databaseSizes.admin.storageSize' => 286_72, + 'mem.pageFaults' => 0, + 'mem.heap_size_bytes' => 645_201_92, + 'lock.totalTime' => 111_200_200_0, + 'lock.queue_total' => 0, + 'lock.queue_readers' => 0, + 'lock.queue_writers' => 0, + 'lock.clients_total' => 9, + 'lock.clients_readers' => 0, + 'lock.clients_writers' => 0, + 'locks.Collection.acquireCount_r' => 304, + 'locks.Global.acquireCount_r' => 653, + 'locks.Global.acquireCount_w' => 653, + 'locks.Global.acquireCount_W' => 653, + 'locks.Database.acquireCount_r' => 313, + 'locks.Database.acquireCount_R' => 313, + 'locks.Database.acquireCount_W' => 313, + 'network.bytesIn' => 793_2, + 'network.bytesOut' => 182_742, + 'network.numRequests' => 66, + 'opcounters.insert' => 0, + 'opcounters.query' => 1, + 'opcounters.update' => 0, + 'opcounters.delete' => 0, + 'opcounters.getmore' => 0, + 'opcounters.command' => 67, + 'opcountersRepl.insert' => 0, + 'opcountersRepl.query' => 0, + 'opcountersRepl.update' => 0, + 'opcountersRepl.delete' => 0, + 'opcountersRepl.getmore' => 0, + 'opcountersRepl.command' => 0, + 'mem.residentMb' => 50, + 'mem.virtualMb' => 244, + 'mem.mapped' => 0, + 'mem.mappedWithJournal' => 0, + 'mem.current_allocated_bytes' => 601_839_28, + 'wiredTiger.data_handle.session_dhandles_swept' => 0, + 'wiredTiger.data_handle.connection_sweeps' => 111, + 'wiredTiger.data_handle.connection_sweep_dhandles_removed_from_hash_list' => 72, + 'wiredTiger.data_handle.connection_data_handles_currently_active' => 6, + 'wiredTiger.data_handle.connection_sweep_dhandles_closed' => 0, + 'wiredTiger.data_handle.session_sweep_attempts' => 33, + 'wiredTiger.data_handle.connection_sweep_candidate_became_referenced' => 0, + 'wiredTiger.data_handle.connection_sweep_time_of_death_sets' => 72, + 'wiredTiger.reconciliation.fast_path_pages_deleted' => 0, + 'wiredTiger.reconciliation.split_objects_currently_awaiting_free' => 0, + 'wiredTiger.reconciliation.split_bytes_currently_awaiting_free' => 0, + 'wiredTiger.reconciliation.pages_deleted' => 0, + 'wiredTiger.reconciliation.page_reconciliation_calls_for_eviction' => 0, + 'wiredTiger.reconciliation.page_reconciliation_calls' => 12, + 'wiredTiger.cache.unmodified_pages_evicted' => 0, + 'wiredTiger.cache.eviction_server_evicting_pages' => 0, + 'wiredTiger.cache.eviction_server_populating_queue_but_not_evicting_pages' => 0, + 'wiredTiger.cache.eviction_server_skipped_very_large_page' => 0, + 'wiredTiger.cache.tracked_dirty_pages_in_the_cache' => 0, + 'wiredTiger.cache.eviction_calls_to_get_a_page_found_queue_empty_after_locking' => 0, + 'wiredTiger.cache.internal_pages_split_during_eviction' => 0, + 'wiredTiger.cache.page_split_during_eviction_deepened_the_tree' => 0, + 'wiredTiger.cache.leaf_pages_split_during_eviction' => 0, + 'wiredTiger.cache.pages_walked_for_eviction' => 0, + 'wiredTiger.cache.percentage_overhead' => 8, + 'wiredTiger.cache.pages_evicted_by_application_threads' => 0, + 'wiredTiger.cache.tracked_dirty_bytes_in_the_cache' => 0, + 'wiredTiger.cache.maximum_page_size_at_eviction' => 0, + 'wiredTiger.cache.failed_eviction_of_pages_that_exceeded_the_in_memory_maximum' => 0, + 'wiredTiger.cache.pages_evicted_because_they_exceeded_the_in_memory_maximum' => 0, + 'wiredTiger.cache.tracked_bytes_belonging_to_leaf_pages_in_the_cache' => 312_12, + 'wiredTiger.cache.tracked_bytes_belonging_to_overflow_pages_in_the_cache' => 0, + 'wiredTiger.cache.eviction_server_candidate_queue_empty_when_topping_up' => 0, + 'wiredTiger.cache.bytes_written_from_cache' => 191_44, + 'wiredTiger.cache.eviction_server_slept_because_we_did_not_make_progress_with_eviction' => 0, + 'wiredTiger.cache.pages_queued_for_urgent_eviction' => 0, + 'wiredTiger.cache.eviction_currently_operating_in_aggressive_mode' => 0, + 'wiredTiger.cache.tracked_bytes_belonging_to_internal_pages_in_the_cache' => 136_31, + 'wiredTiger.cache.bytes_currently_in_the_cache' => 448_43, + 'wiredTiger.cache.pages_selected_for_eviction_unable_to_be_evicted' => 0, + 'wiredTiger.cache.hazard_pointer_maximum_array_length' => 0, + 'wiredTiger.cache.lookaside_table_remove_calls' => 0, + 'wiredTiger.cache.in_memory_page_passed_criteria_to_be_split' => 0, + 'wiredTiger.cache.checkpoint_blocked_page_eviction' => 0, + 'wiredTiger.cache.eviction_calls_to_get_a_page_found_queue_empty' => 0, + 'wiredTiger.cache.pages_written_from_cache' => 12, + 'wiredTiger.cache.eviction_calls_to_get_a_page' => 0, + 'wiredTiger.cache.modified_pages_evicted_by_application_threads' => 0, + 'wiredTiger.cache.pages_seen_by_eviction_walk' => 0, + 'wiredTiger.cache.eviction_worker_thread_evicting_pages' => 0, + 'wiredTiger.cache.bytes_read_into_cache' => 754_1, + 'wiredTiger.cache.page_written_requiring_lookaside_records' => 0, + 'wiredTiger.cache.hazard_pointer_blocked_page_eviction' => 0, + 'wiredTiger.cache.lookaside_table_insert_calls' => 0, + 'wiredTiger.cache.pages_read_into_cache' => 10, + 'wiredTiger.cache.pages_written_requiring_in_memory_restoration' => 0, + 'wiredTiger.cache.pages_evicted_because_they_had_chains_of_deleted_items' => 0, + 'wiredTiger.cache.files_with_new_eviction_walks_started' => 0, + 'wiredTiger.cache.pages_queued_for_eviction' => 0, + 'wiredTiger.cache.pages_requested_from_the_cache' => 244, + 'wiredTiger.cache.pages_read_into_cache_requiring_lookaside_entries' => 0, + 'wiredTiger.cache.eviction_server_candidate_queue_not_empty_when_topping_up' => 0, + 'wiredTiger.cache.files_with_active_eviction_walks' => 0, + 'wiredTiger.cache.hazard_pointer_check_entries_walked' => 0, + 'wiredTiger.cache.in_memory_page_splits' => 0, + 'wiredTiger.cache.internal_pages_evicted' => 0, + 'wiredTiger.cache.maximum_bytes_configured' => 107_374_182_4.0, + 'wiredTiger.cache.pages_currently_held_in_the_cache' => 11, + 'wiredTiger.cache.modified_pages_evicted' => 0, + 'wiredTiger.cache.eviction_server_unable_to_reach_eviction_goal' => 0, + 'wiredTiger.cache.hazard_pointer_check_calls' => 0, + 'wiredTiger.log.log_sync_dir_operations' => 1, + 'wiredTiger.log.log_sync_dir_time_duration_usecs' => 16, + 'wiredTiger.log.log_write_operations' => 11, + 'wiredTiger.log.log_server_thread_advances_write_LSN' => 2, + 'wiredTiger.log.consolidated_slot_join_races' => 0, + 'wiredTiger.log.maximum_log_file_size' => 104_857_600, + 'wiredTiger.log.records_processed_by_log_scan' => 10, + 'wiredTiger.log.total_log_buffer_size' => 335_544_32, + 'wiredTiger.log.log_records_too_small_to_compress' => 6, + 'wiredTiger.log.log_force_write_operations_skipped' => 121_66, + 'wiredTiger.log.log_scan_operations' => 3, + 'wiredTiger.log.pre_allocated_log_files_used' => 0, + 'wiredTiger.log.pre_allocated_log_files_not_ready_and_missed' => 1, + 'wiredTiger.log.total_size_of_compressed_records' => 318_3, + 'wiredTiger.log.pre_allocated_log_files_prepared' => 2, + 'wiredTiger.log.log_sync_time_duration_usecs' => 142_38, + 'wiredTiger.log.total_in_memory_size_of_compressed_records' => 474_9, + 'wiredTiger.log.yields_waiting_for_previous_log_file_close' => 0, + 'wiredTiger.log.log_records_not_compressed' => 1, + 'wiredTiger.log.log_force_write_operations' => 121_68, + 'wiredTiger.log.consolidated_slot_unbuffered_writes' => 0, + 'wiredTiger.log.written_slots_coalesced' => 0, + 'wiredTiger.log.log_records_compressed' => 4, + 'wiredTiger.log.number_of_pre_allocated_log_files_to_create' => 2, + 'wiredTiger.log.log_bytes_written' => 473_6, + 'wiredTiger.log.busy_returns_attempting_to_switch_slots' => 0, + 'wiredTiger.log.consolidated_slot_joins' => 11, + 'wiredTiger.log.log_files_manually_zero_filled' => 0, + 'wiredTiger.log.log_bytes_of_payload_data' => 349_7, + 'wiredTiger.log.log_flush_operations' => 110_23, + 'wiredTiger.log.log_sync_operations' => 7, + 'wiredTiger.log.log_scan_records_requiring_two_reads' => 4, + 'wiredTiger.log.logging_bytes_consolidated' => 435_2, + 'wiredTiger.log.log_server_thread_write_LSN_walk_skipped' => 207_8, + 'wiredTiger.log.consolidated_slot_join_transitions' => 7, + 'wiredTiger.log.log_release_advances_write_LSN' => 5, + 'wiredTiger.log.consolidated_slot_closures' => 7, + 'wiredTiger.LSM.sleep_for_LSM_merge_throttle' => 0, + 'wiredTiger.LSM.application_work_units_currently_queued' => 0, + 'wiredTiger.LSM.rows_merged_in_an_LSM_tree' => 0, + 'wiredTiger.LSM.switch_work_units_currently_queued' => 0, + 'wiredTiger.LSM.merge_work_units_currently_queued' => 0, + 'wiredTiger.LSM.tree_maintenance_operations_discarded' => 0, + 'wiredTiger.LSM.sleep_for_LSM_checkpoint_throttle' => 0, + 'wiredTiger.LSM.tree_maintenance_operations_executed' => 0, + 'wiredTiger.LSM.tree_maintenance_operations_scheduled' => 0, + 'wiredTiger.LSM.tree_queue_hit_maximum' => 0, + 'wiredTiger.transaction.number_of_named_snapshots_dropped' => 0, + 'wiredTiger.transaction.transaction_checkpoint_currently_running' => 0, + 'wiredTiger.transaction.transaction_begins' => 41, + 'wiredTiger.transaction.transaction_fsync_calls_for_checkpoint_after_allocating_the_transaction_ID' => 19, + 'wiredTiger.transaction.transaction_fsync_calls_for_checkpoint_before_allocating_the_transaction_ID' => 19, + 'wiredTiger.transaction.transaction_fsync_duration_for_checkpoint_after_allocating_the_transaction_ID_usecs' => 210_03, + 'wiredTiger.transaction.transaction_fsync_duration_for_checkpoint_before_allocating_the_transaction_ID_usecs' => 647_72, + 'wiredTiger.transaction.transaction_checkpoint_most_recent_time_msecs' => 6, + 'wiredTiger.transaction.transaction_checkpoints' => 19, + 'wiredTiger.transaction.transaction_range_of_IDs_currently_pinned_by_a_checkpoint' => 0, + 'wiredTiger.transaction.transaction_sync_calls' => 0, + 'wiredTiger.transaction.transactions_committed' => 4, + 'wiredTiger.transaction.transaction_checkpoint_max_time_msecs' => 8, + 'wiredTiger.transaction.number_of_named_snapshots_created' => 0, + 'wiredTiger.transaction.transaction_checkpoint_min_time_msecs' => 6, + 'wiredTiger.transaction.transaction_checkpoint_total_time_msecs' => 28, + 'wiredTiger.transaction.transaction_checkpoint_generation' => 19, + 'wiredTiger.transaction.transaction_failures_due_to_cache_overflow' => 0, + 'wiredTiger.transaction.transaction_range_of_IDs_currently_pinned_by_named_snapshots' => 0, + 'wiredTiger.transaction.transactions_rolled_back' => 37, + 'wiredTiger.transaction.transaction_range_of_IDs_currently_pinned' => 0, + 'wiredTiger.cursor.cursor_restarted_searches' => 0, + 'wiredTiger.cursor.cursor_prev_calls' => 3, + 'wiredTiger.cursor.cursor_insert_calls' => 12, + 'wiredTiger.cursor.cursor_reset_calls' => 220, + 'wiredTiger.cursor.cursor_update_calls' => 0, + 'wiredTiger.cursor.cursor_search_near_calls' => 1, + 'wiredTiger.cursor.cursor_search_calls' => 209, + 'wiredTiger.cursor.cursor_next_calls' => 28, + 'wiredTiger.cursor.cursor_create_calls' => 29, + 'wiredTiger.cursor.truncate_calls' => 0, + 'wiredTiger.cursor.cursor_remove_calls' => 1, + 'wiredTiger.connection.total_read_I/Os' => 876, + 'wiredTiger.connection.memory_re_allocations' => 457_7, + 'wiredTiger.connection.pthread_mutex_shared_lock_write_lock_calls' => 129_6, + 'wiredTiger.connection.auto_adjusting_condition_resets' => 9, + 'wiredTiger.connection.pthread_mutex_condition_wait_calls' => 145_31, + 'wiredTiger.connection.memory_frees' => 191_13, + 'wiredTiger.connection.pthread_mutex_shared_lock_read_lock_calls' => 257_4, + 'wiredTiger.connection.total_fsync_I/Os' => 190, + 'wiredTiger.connection.files_currently_open' => 9, + 'wiredTiger.connection.memory_allocations' => 197_00, + 'wiredTiger.connection.auto_adjusting_condition_wait_calls' => 337_2, + 'wiredTiger.connection.total_write_I/Os' => 38, + 'wiredTiger.session.open_cursor_count' => 20, + 'wiredTiger.session.open_session_count' => 16, + 'wiredTiger.block_manager.bytes_read' => 696_32, + 'wiredTiger.block_manager.blocks_read' => 16, + 'wiredTiger.block_manager.blocks_pre_loaded' => 5, + 'wiredTiger.block_manager.bytes_written' => 110_592, + 'wiredTiger.block_manager.mapped_bytes_read' => 0, + 'wiredTiger.block_manager.blocks_written' => 24, + 'wiredTiger.block_manager.mapped_blocks_read' => 0, + 'wiredTiger.thread_yield.page_acquire_busy_blocked' => 0, + 'wiredTiger.thread_yield.page_acquire_read_blocked' => 0, + 'wiredTiger.thread_yield.page_acquire_locked_blocked' => 0, + 'wiredTiger.thread_yield.page_acquire_eviction_blocked' => 0, + 'wiredTiger.thread_yield.page_acquire_time_sleeping_usecs' => 0, + 'wiredTiger.async.total_insert_calls' => 0, + 'wiredTiger.async.total_remove_calls' => 0, + 'wiredTiger.async.number_of_operation_slots_viewed_for_allocation' => 0, + 'wiredTiger.async.total_allocations' => 0, + 'wiredTiger.async.current_work_queue_length' => 0, + 'wiredTiger.async.number_of_flush_calls' => 0, + 'wiredTiger.async.maximum_work_queue_length' => 0, + 'wiredTiger.async.total_compact_calls' => 0, + 'wiredTiger.async.total_update_calls' => 0, + 'wiredTiger.async.number_of_allocation_state_races' => 0, + 'wiredTiger.async.number_of_times_operation_allocation_failed' => 0, + 'wiredTiger.async.number_of_times_worker_found_no_work' => 0, + 'wiredTiger.async.total_search_calls' => 0, + 'wiredTiger.concurrentTransactions.write.out' => 0, + 'wiredTiger.concurrentTransactions.write.available' => 128, + 'wiredTiger.concurrentTransactions.write.totalTickets' => 128, + 'wiredTiger.concurrentTransactions.read.out' => 0, + 'wiredTiger.concurrentTransactions.read.available' => 128, + 'wiredTiger.concurrentTransactions.read.totalTickets' => 128, + 'wiredTiger.thread_state.active_filesystem_write_calls' => 0, + 'wiredTiger.thread_state.active_filesystem_read_calls' => 0, + 'wiredTiger.thread_state.active_filesystem_fsync_calls' => 0, + 'metrics.document.deleted' => 0, + 'metrics.document.inserted' => 0, + 'metrics.document.returned' => 0, + 'metrics.document.updated' => 0, + 'metrics.getLastError.wtime_num' => 0, + 'metrics.getLastError.wtime_totalMillis' => 0, + 'metrics.getLastError.wtimeouts' => 0, + 'metrics.operation.fastmod' => 0, + 'metrics.operation.idhack' => 0, + 'metrics.operation.scanAndOrder' => 0, + 'metrics.queryExecutor.scanned' => 0, + 'metrics.queryExecutor.scannedObjects' => 0, + 'metrics.record.moves' => 0, + 'metrics.repl.apply.batches_num' => 0, + 'metrics.repl.apply.batches_totalMillis' => 0, + 'metrics.repl.apply.ops' => 0, + 'metrics.repl.buffer.count' => 0, + 'metrics.repl.buffer.maxSizeBytes' => 268_435_456, + 'metrics.repl.buffer.sizeBytes' => 0, + 'metrics.repl.network.bytes' => 0, + 'metrics.repl.network.getmores_num' => 0, + 'metrics.repl.network.getmores_totalMillis' => 0, + 'metrics.repl.network.ops' => 0, + 'metrics.repl.network.readersCreated' => 0, + 'metrics.repl.preload.docs_num' => 0, + 'metrics.repl.preload.docs_totalMillis' => 0, + 'metrics.repl.preload.indexes_num' => 0, + 'metrics.repl.preload.indexes_totalMillis' => 0, + 'metrics.replicaset.state' => 1, + 'metrics.storage.freelist.search_bucketExhauseted' => 0, + 'metrics.storage.freelist.search_requests' => 0, + 'metrics.storage.freelist.search_scanned' => 0, + 'metrics.ttl.deletedDocuments' => 0, + 'metrics.ttl.passes' => 18 ) end end From 9884b145e1896ca340be7c6128cfae7885db3e41 Mon Sep 17 00:00:00 2001 From: Parin Date: Mon, 25 Mar 2019 13:41:37 -0400 Subject: [PATCH 6/6] temp --- lib/sensu-plugins-mongodb/metrics.rb | 45 ++++++++++++++++++---------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/lib/sensu-plugins-mongodb/metrics.rb b/lib/sensu-plugins-mongodb/metrics.rb index 6493cb7..743e312 100644 --- a/lib/sensu-plugins-mongodb/metrics.rb +++ b/lib/sensu-plugins-mongodb/metrics.rb @@ -102,23 +102,36 @@ def replicaset_status end end - def wiretiger_metrics(wiredtiger, server_metrics) - # wiredtiger = server_status['wiredTiger'] - # data_handle Metrics - wiredtiger.each do |key1, value1| - next unless value1.is_a? Hash - wiredtiger[key1].each do |key2, value2| - if value2.is_a? Hash - wiredtiger[key1][key2].each do |key3, value3| - server_metrics['wiredTiger.' + key1.gsub(/(,|\s|-|\()+/, '_').tr(')', '') + '.' + - key2.gsub(/(,|\s|-|\()+/, '_').tr(')', '') + '.' + key3.gsub(/(,|\s|-|\()+/, '_').tr(')', '')] = value3 - end - else - server_metrics['wiredTiger.' + key1.gsub(/(,|\s|-|\()+/, '_').tr(')', '') + - '.' + key2.gsub(/(,|\s|-|\()+/, '_').tr(')', '')] = value2 - end + def foo(key,json) + json.each do |key1, value1| + if value1.is_a? Hash + Temp_hash = {} + Temp_hash = foo(key1,value1) + return_json.merge(Temp_hash) + else + return key.gsub(/(,|\s|-|\()+/, '_').tr(')', '') + key1.gsub(/(,|\s|-|\()+/, '_').tr(')', '') => value1 end - end + end + + + def wiretiger_metrics(wiredtiger, server_metrics) + TEMP_VALUE = foo('wiretiger',wiredtiger) + puts TEMP_VALUE + server_metrics.merge() + # wiredtiger.each do |key1, value1| + # next unless value1.is_a? Hash + # wiredtiger[key1].each do |key2, value2| + # if value2.is_a? Hash + # wiredtiger[key1][key2].each do |key3, value3| + # server_metrics['wiredTiger.' + key1.gsub(/(,|\s|-|\()+/, '_').tr(')', '') + '.' + + # key2.gsub(/(,|\s|-|\()+/, '_').tr(')', '') + '.' + key3.gsub(/(,|\s|-|\()+/, '_').tr(')', '')] = value3 + # end + # else + # server_metrics['wiredTiger.' + key1.gsub(/(,|\s|-|\()+/, '_').tr(')', '') + + # '.' + key2.gsub(/(,|\s|-|\()+/, '_').tr(')', '')] = value2 + # end + # end + # end server_metrics end