prometheus-community / postgres_exporter

A PostgreSQL metric exporter for Prometheus
Apache License 2.0
2.79k stars 737 forks source link

Build-in Metrics #341

Open langemar opened 4 years ago

langemar commented 4 years ago

What are the default metrics that should be exported when running the exporter?

Running the exporter using the docker image (wrouesnel/postgres_exporter:latest) with the environment:

I get the following pg related (go, promhttp, HELP and TYPE stripped) metrics: - pg_exporter_last_scrape_duration_seconds - pg_exporter_last_scrape_error - pg_exporter_scrapes_total - pg_settings_allow_system_table_mods - pg_settings_archive_timeout_seconds - pg_settings_array_nulls - pg_settings_authentication_timeout_seconds - pg_settings_autovacuum - pg_settings_autovacuum_analyze_scale_factor - pg_settings_autovacuum_analyze_threshold - pg_settings_autovacuum_freeze_max_age - pg_settings_autovacuum_max_workers - pg_settings_autovacuum_multixact_freeze_max_age - pg_settings_autovacuum_naptime_seconds - pg_settings_autovacuum_vacuum_cost_delay_seconds - pg_settings_autovacuum_vacuum_cost_limit - pg_settings_autovacuum_vacuum_scale_factor - pg_settings_autovacuum_vacuum_threshold - pg_settings_autovacuum_work_mem_bytes - pg_settings_backend_flush_after_bytes - pg_settings_bgwriter_delay_seconds - pg_settings_bgwriter_flush_after_bytes - pg_settings_bgwriter_lru_maxpages - pg_settings_bgwriter_lru_multiplier - pg_settings_block_size - pg_settings_bonjour - pg_settings_check_function_bodies - pg_settings_checkpoint_completion_target - pg_settings_checkpoint_flush_after_bytes - pg_settings_checkpoint_timeout_seconds - pg_settings_checkpoint_warning_seconds - pg_settings_commit_delay - pg_settings_commit_siblings - pg_settings_cpu_index_tuple_cost - pg_settings_cpu_operator_cost - pg_settings_cpu_tuple_cost - pg_settings_cursor_tuple_fraction - pg_settings_data_checksums - pg_settings_db_user_namespace - pg_settings_deadlock_timeout_seconds - pg_settings_debug_assertions - pg_settings_debug_pretty_print - pg_settings_debug_print_parse - pg_settings_debug_print_plan - pg_settings_debug_print_rewritten - pg_settings_default_statistics_target - pg_settings_default_transaction_deferrable - pg_settings_default_transaction_read_only - pg_settings_default_with_oids - pg_settings_effective_cache_size_bytes - pg_settings_effective_io_concurrency - pg_settings_enable_bitmapscan - pg_settings_enable_gathermerge - pg_settings_enable_hashagg - pg_settings_enable_hashjoin - pg_settings_enable_indexonlyscan - pg_settings_enable_indexscan - pg_settings_enable_material - pg_settings_enable_mergejoin - pg_settings_enable_nestloop - pg_settings_enable_seqscan - pg_settings_enable_sort - pg_settings_enable_tidscan - pg_settings_escape_string_warning - pg_settings_exit_on_error - pg_settings_extra_float_digits - pg_settings_from_collapse_limit - pg_settings_fsync - pg_settings_full_page_writes - pg_settings_geqo - pg_settings_geqo_effort - pg_settings_geqo_generations - pg_settings_geqo_pool_size - pg_settings_geqo_seed - pg_settings_geqo_selection_bias - pg_settings_geqo_threshold - pg_settings_gin_fuzzy_search_limit - pg_settings_gin_pending_list_limit_bytes - pg_settings_hot_standby - pg_settings_hot_standby_feedback - pg_settings_idle_in_transaction_session_timeout_seconds - pg_settings_ignore_checksum_failure - pg_settings_ignore_system_indexes - pg_settings_integer_datetimes - pg_settings_join_collapse_limit - pg_settings_krb_caseins_users - pg_settings_lock_timeout_seconds - pg_settings_lo_compat_privileges - pg_settings_log_autovacuum_min_duration_seconds - pg_settings_log_checkpoints - pg_settings_log_connections - pg_settings_log_disconnections - pg_settings_log_duration - pg_settings_log_executor_stats - pg_settings_log_file_mode - pg_settings_logging_collector - pg_settings_log_hostname - pg_settings_log_lock_waits - pg_settings_log_min_duration_statement_seconds - pg_settings_log_parser_stats - pg_settings_log_planner_stats - pg_settings_log_replication_commands - pg_settings_log_rotation_age_seconds - pg_settings_log_rotation_size_bytes - pg_settings_log_statement_stats - pg_settings_log_temp_files_bytes - pg_settings_log_truncate_on_rotation - pg_settings_maintenance_work_mem_bytes - pg_settings_max_connections - pg_settings_max_files_per_process - pg_settings_max_function_args - pg_settings_max_identifier_length - pg_settings_max_index_keys - pg_settings_max_locks_per_transaction - pg_settings_max_logical_replication_workers - pg_settings_max_parallel_workers - pg_settings_max_parallel_workers_per_gather - pg_settings_max_pred_locks_per_page - pg_settings_max_pred_locks_per_relation - pg_settings_max_pred_locks_per_transaction - pg_settings_max_prepared_transactions - pg_settings_max_replication_slots - pg_settings_max_stack_depth_bytes - pg_settings_max_standby_archive_delay_seconds - pg_settings_max_standby_streaming_delay_seconds - pg_settings_max_sync_workers_per_subscription - pg_settings_max_wal_senders - pg_settings_max_wal_size_bytes - pg_settings_max_worker_processes - pg_settings_min_parallel_index_scan_size_bytes - pg_settings_min_parallel_table_scan_size_bytes - pg_settings_min_wal_size_bytes - pg_settings_old_snapshot_threshold_seconds - pg_settings_operator_precedence_warning - pg_settings_parallel_setup_cost - pg_settings_parallel_tuple_cost - pg_settings_port - pg_settings_post_auth_delay_seconds - pg_settings_pre_auth_delay_seconds - pg_settings_quote_all_identifiers - pg_settings_random_page_cost - pg_settings_replacement_sort_tuples - pg_settings_restart_after_crash - pg_settings_row_security - pg_settings_segment_size_bytes - pg_settings_seq_page_cost - pg_settings_server_version_num - pg_settings_shared_buffers_bytes - pg_settings_ssl - pg_settings_ssl_prefer_server_ciphers - pg_settings_standard_conforming_strings - pg_settings_statement_timeout_seconds - pg_settings_superuser_reserved_connections - pg_settings_synchronize_seqscans - pg_settings_syslog_sequence_numbers - pg_settings_syslog_split_messages - pg_settings_tcp_keepalives_count - pg_settings_tcp_keepalives_idle_seconds - pg_settings_tcp_keepalives_interval_seconds - pg_settings_temp_buffers_bytes - pg_settings_temp_file_limit_bytes - pg_settings_trace_notify - pg_settings_trace_sort - pg_settings_track_activities - pg_settings_track_activity_query_size - pg_settings_track_commit_timestamp - pg_settings_track_counts - pg_settings_track_io_timing - pg_settings_transaction_deferrable - pg_settings_transaction_read_only - pg_settings_transform_null_equals - pg_settings_unix_socket_permissions - pg_settings_update_process_title - pg_settings_vacuum_cost_delay_seconds - pg_settings_vacuum_cost_limit - pg_settings_vacuum_cost_page_dirty - pg_settings_vacuum_cost_page_hit - pg_settings_vacuum_cost_page_miss - pg_settings_vacuum_defer_cleanup_age - pg_settings_vacuum_freeze_min_age - pg_settings_vacuum_freeze_table_age - pg_settings_vacuum_multixact_freeze_min_age - pg_settings_vacuum_multixact_freeze_table_age - pg_settings_wal_block_size - pg_settings_wal_buffers_bytes - pg_settings_wal_compression - pg_settings_wal_keep_segments - pg_settings_wal_log_hints - pg_settings_wal_receiver_status_interval_seconds - pg_settings_wal_receiver_timeout_seconds - pg_settings_wal_retrieve_retry_interval_seconds - pg_settings_wal_segment_size_bytes - pg_settings_wal_sender_timeout_seconds - pg_settings_wal_writer_delay_seconds - pg_settings_wal_writer_flush_after_bytes - pg_settings_work_mem_bytes - pg_settings_zero_damaged_pages - pg_static - pg_up - postgres_exporter_build_info

Are there more that should be exported?

My Question arise because I grepped some dashboards from grafana.com that are mentioned to work with this exporter. But all of them rely on metrics not exported by the exporter by default (at least in my setup). As far as I saw (didn't read all ~200 HELP messages) the exported metrics only cover quite static configuration's. Due to the use of "PG_EXPORTER_AUTO_DISCOVER_DATABASES=true" this might be related to #293 .

However it would be nice to have a documented list of default metrics that should be exported, and if conditionally exported what are the conditions.

X4mp commented 3 months ago

I'd assume the list of exported metrics you are looking for is documented in the assets branch here. https://github.com/prometheus-community/postgres_exporter/blob/assets/metriclists/.metrics.single.11.prom.unique At least I found this while looking for the same.

AFAICT you miss process_cpu_seconds_total, which I do also miss. I am also using PG_EXPORTER_AUTO_DISCOVER_DATABASES=true. So this might be good to know if this is related. This metric should normally be exposed by default.