用于 Azure Monitor 中 Prometheus 指标的最小引入配置文件

默认情况下,Azure Monitor 指标加载项会收集 Prometheus 指标的数量。 Minimal ingestion profile 是一种有助于减少指标引入量的设置,因为只有默认仪表板使用的指标,才会收集默认记录规则和默认警报。 本文介绍如何配置此设置。 本文还列出了启用 minimal ingestion profile 时默认收集的指标。 可以修改集合以启用收集更多指标,如下所示。

注意

对于基于加载项的集合,Minimal ingestion profile 设置默认处于启用状态。

以下目标默认处于“已启用/开启”状态,这意味着你不必提供任何抓取作业配置来抓取这些目标,因为指标加载项默认会自动抓取这些目标

  • cadvisorjob=cadvisor
  • nodeexporterjob=node
  • kubeletjob=kubelet
  • kube-state-metricsjob=kube-state-metrics
  • controlplane-apiserverjob=controlplane-apiserver
  • controlplane-etcdjob=controlplane-etcd

以下目标可进行抓取,但默认情况下抓取未启用(已禁用/关闭),这意味着你不必提供任何抓取作业配置来抓取这些目标,但它们默认处于禁用/关闭状态,你需要使用 default-scrape-settings-enabled 部分下的 ama-metrics-settings-configmap 为这些目标开启/启用抓取

  • core-dnsjob=kube-dns
  • kube-proxyjob=kube-proxy
  • api-serverjob=kube-apiserver
  • controlplane-cluster-autoscalerjob=controlplane-cluster-autoscaler
  • controlplane-kube-schedulerjob=controlplane-kube-scheduler
  • controlplane-kube-controller-managerjob=controlplane-kube-controller-manager

注意

所有默认目标和抓取的默认抓取频率为 30 seconds。 可以使用 default-targets-scrape-interval-settings 部分下的 ama-metrics-settings-configmap 替代每个目标。 控制平面目标具有固定的抓取间隔 30 seconds,且无法覆盖。 可在此处详细了解指标加载项使用的四种不同 configmap

配置设置

默认情况下,该设置 default-targets-metrics-keep-list.minimalIngestionProfile="true" 在指标加载项上处于启用状态。 可以在 default-targets-metrics-keep-list 部分下的 ama-metrics-settings-configmap 中指定此设置。

方案

在以下四种情况下,你可能希望自定义此行为:

每个默认目标仅引入最少指标。
这是设置 default-targets-metrics-keep-list.minimalIngestionProfile="true" 的默认行为。 对于每个默认目标,只引入下面列出的指标。

除了最少指标外,还为一个或多个默认目标引入一些其他指标。
保留 minimalIngestionProfile="true" 并指定特定于目标的相应 keeplistRegexes.* 对象,例如 keeplistRegexes.coreDns="X``Y"。 X,Y 与目标的默认指标列表合并,然后被引入。 ``

仅为目标引入一组特定的指标,而不引入其他指标。
设置 minimalIngestionProfile="false",并指定特定于 ama-metrics-settings-configmap 中的目标的相应 default-targets-metrics-keep-list.="X``Y"

引入为默认目标抓取的所有指标。
设置 minimalIngestionProfile="false" 并且不为该目标指定任何 default-targets-metrics-keep-list.<targetname>。 更改为 false 可能会使每个目标的指标引入量增加一个系数。

注意

up 指标不是允许/保留列表的一部分,不管指定的 keepLists 是什么,都会按每个抓取、每个目标引入指标。 此指标实际上不是抓取的,而是由指标加载项的抓取操作而生成的。 对于直方图和摘要,每个序列必须显式包含在列表中(*bucket*sum*count 序列)。

默认 ON 目标的最少引入

默认 ON 目标允许使用 minimalingestionprofile=true 列出以下指标。 默认情况下会收集以下指标,因为这些目标默认已抓取。

kubelet

  • kubelet_volume_stats_used_bytes
  • kubelet_node_name
  • kubelet_running_pods
  • kubelet_running_pod_count
  • kubelet_running_containers
  • kubelet_running_container_count
  • volume_manager_total_volumes
  • kubelet_node_config_error
  • kubelet_runtime_operations_total
  • kubelet_runtime_operations_errors_total
  • kubelet_runtime_operations_duration_seconds kubelet_runtime_operations_duration_seconds_bucket kubelet_runtime_operations_duration_seconds_sum kubelet_runtime_operations_duration_seconds_count
  • kubelet_pod_start_duration_seconds kubelet_pod_start_duration_seconds_bucket kubelet_pod_start_duration_seconds_sum kubelet_pod_start_duration_seconds_count
  • kubelet_pod_worker_duration_seconds kubelet_pod_worker_duration_seconds_bucket kubelet_pod_worker_duration_seconds_sum kubelet_pod_worker_duration_seconds_count
  • storage_operation_duration_seconds storage_operation_duration_seconds_bucket storage_operation_duration_seconds_sum storage_operation_duration_seconds_count
  • storage_operation_errors_total
  • kubelet_cgroup_manager_duration_seconds kubelet_cgroup_manager_duration_seconds_bucket kubelet_cgroup_manager_duration_seconds_sum kubelet_cgroup_manager_duration_seconds_count
  • kubelet_pleg_relist_duration_seconds kubelet_pleg_relist_duration_seconds_bucket kubelet_pleg_relist_duration_sum kubelet_pleg_relist_duration_seconds_count
  • kubelet_pleg_relist_interval_seconds kubelet_pleg_relist_interval_seconds_bucket kubelet_pleg_relist_interval_seconds_sum kubelet_pleg_relist_interval_seconds_count
  • rest_client_requests_total
  • rest_client_request_duration_seconds rest_client_request_duration_seconds_bucket rest_client_request_duration_seconds_sum rest_client_request_duration_seconds_count
  • process_resident_memory_bytes
  • process_cpu_seconds_total
  • go_goroutines
  • kubelet_volume_stats_capacity_bytes
  • kubelet_volume_stats_available_bytes
  • kubelet_volume_stats_inodes_used
  • kubelet_volume_stats_inodes
  • kubernetes_build_info"

cadvisor

  • container_spec_cpu_period
  • container_spec_cpu_quota
  • container_cpu_usage_seconds_total
  • container_memory_rss
  • container_network_receive_bytes_total
  • container_network_transmit_bytes_total
  • container_network_receive_packets_total
  • container_network_transmit_packets_total
  • container_network_receive_packets_dropped_total
  • container_network_transmit_packets_dropped_total
  • container_fs_reads_total
  • container_fs_writes_total
  • container_fs_reads_bytes_total
  • container_fs_writes_bytes_total
  • container_memory_working_set_bytes
  • container_memory_cache
  • container_memory_swap
  • container_cpu_cfs_throttled_periods_total
  • container_cpu_cfs_periods_total
  • container_memory_usage_bytes
  • kubernetes_build_info"

kube-state-metrics

  • kube_node_status_capacity
  • kube_job_status_succeeded
  • kube_job_spec_completions
  • kube_daemonset_status_desired_number_scheduled
  • kube_daemonset_status_number_ready
  • kube_deployment_spec_replicas
  • kube_deployment_status_replicas_ready
  • kube_pod_container_status_last_terminated_reason
  • kube_node_status_condition
  • kube_pod_container_status_restarts_total
  • kube_pod_container_resource_requests
  • kube_pod_status_phase
  • kube_pod_container_resource_limits
  • kube_node_status_allocatable
  • kube_pod_info
  • kube_pod_owner
  • kube_resourcequota
  • kube_statefulset_replicas
  • kube_statefulset_status_replicas
  • kube_statefulset_status_replicas_ready
  • kube_statefulset_status_replicas_current
  • kube_statefulset_status_replicas_updated
  • kube_namespace_status_phase
  • kube_node_info
  • kube_statefulset_metadata_generation
  • kube_pod_labels
  • kube_pod_annotations
  • kube_horizontalpodautoscaler_status_current_replicas
  • kube_horizontalpodautoscaler_status_desired_replicas
  • kube_horizontalpodautoscaler_spec_min_replicas
  • kube_horizontalpodautoscaler_spec_max_replicas
  • kube_node_status_condition
  • kube_node_spec_taint
  • kube_pod_container_status_waiting_reason
  • kube_job_failed
  • kube_job_status_start_time
  • kube_deployment_spec_replicas
  • kube_deployment_status_replicas_available
  • kube_deployment_status_replicas_updated
  • kube_job_status_active
  • kubernetes_build_info
  • kube_pod_container_info
  • kube_replicaset_owner
  • kube_resource_labels (ex - kube_pod_labels, kube_deployment_labels)
  • kube_resource_annotations (ex - kube_pod_annotations, kube_deployment_annotations)

node-exporter (linux)

  • node_cpu_seconds_total
  • node_memory_MemAvailable_bytes
  • node_memory_Buffers_bytes
  • node_memory_Cached_bytes
  • node_memory_MemFree_bytes
  • node_memory_Slab_bytes
  • node_memory_MemTotal_bytes
  • node_netstat_Tcp_RetransSegs
  • node_netstat_Tcp_OutSegs
  • node_netstat_TcpExt_TCPSynRetrans
  • node_load1``node_load5
  • node_load15
  • node_disk_read_bytes_total
  • node_disk_written_bytes_total
  • node_disk_io_time_seconds_total
  • node_filesystem_size_bytes
  • node_filesystem_avail_bytes
  • node_filesystem_readonly
  • node_network_receive_bytes_total
  • node_network_transmit_bytes_total
  • node_vmstat_pgmajfault
  • node_network_receive_drop_total
  • node_network_transmit_drop_total
  • node_disk_io_time_weighted_seconds_total
  • node_exporter_build_info
  • node_time_seconds
  • node_uname_info"

controlplane-apiserver

  • apiserver_request_total
  • apiserver_cache_list_fetched_objects_total
  • apiserver_cache_list_returned_objects_total
  • apiserver_flowcontrol_demand_seats_average
  • apiserver_flowcontrol_current_limit_seats
  • apiserver_request_sli_duration_seconds_bucket
  • apiserver_request_sli_duration_seconds_count
  • apiserver_request_sli_duration_seconds_sum
  • process_start_time_seconds
  • apiserver_request_duration_seconds_bucket
  • apiserver_request_duration_seconds_count
  • apiserver_request_duration_seconds_sum
  • apiserver_storage_list_fetched_objects_total
  • apiserver_storage_list_returned_objects_total
  • apiserver_current_inflight_requests

controlplane-etcd

  • etcd_server_has_leader
  • rest_client_requests_total
  • etcd_mvcc_db_total_size_in_bytes
  • etcd_mvcc_db_total_size_in_use_in_bytes
  • etcd_server_slow_read_indexes_total
  • etcd_server_slow_apply_total
  • etcd_network_client_grpc_sent_bytes_total
  • etcd_server_heartbeat_send_failures_total

默认 OFF 目标的最少引入

默认 OFF 目标允许使用 minimalingestionprofile=true 列出以下指标。 默认情况下不会收集这些指标,因为这些目标默认不会抓取(默认为 OFF)。 可以使用 default-scrape-settings-enabled 部分下的 ama-metrics-settings-configmap 使用 default-scrape-settings-enabled.<target-name>=true 开启这些目标的抓取。

core-dns

  • coredns_build_info
  • coredns_panics_total
  • coredns_dns_responses_total
  • coredns_forward_responses_total
  • coredns_dns_request_duration_seconds coredns_dns_request_duration_seconds_bucket coredns_dns_request_duration_seconds_sum coredns_dns_request_duration_seconds_count
  • coredns_forward_request_duration_seconds coredns_forward_request_duration_seconds_bucket coredns_forward_request_duration_seconds_sum coredns_forward_request_duration_seconds_count
  • coredns_dns_requests_total
  • coredns_forward_requests_total
  • coredns_cache_hits_total
  • coredns_cache_misses_total
  • coredns_cache_entries
  • coredns_plugin_enabled
  • coredns_dns_request_size_bytes coredns_dns_request_size_bytes_bucket coredns_dns_request_size_bytes_sum coredns_dns_request_size_bytes_count
  • coredns_dns_response_size_bytes coredns_dns_response_size_bytes_bucket coredns_dns_response_size_bytes_sum coredns_dns_response_size_bytes_count
  • coredns_dns_response_size_bytes coredns_dns_response_size_bytes_bucket coredns_dns_response_size_bytes_sum coredns_dns_response_size_bytes_count
  • process_resident_memory_bytes
  • process_cpu_seconds_total
  • go_goroutines
  • kubernetes_build_info"

kube-proxy

  • kubeproxy_sync_proxy_rules_duration_seconds kubeproxy_sync_proxy_rules_duration_seconds_bucket kubeproxy_sync_proxy_rules_duration_seconds_sum kubeproxy_sync_proxy_rules_duration_seconds_count kubeproxy_network_programming_duration_seconds
  • kubeproxy_network_programming_duration_seconds kubeproxy_network_programming_duration_seconds_bucket kubeproxy_network_programming_duration_seconds_sum kubeproxy_network_programming_duration_seconds_count rest_client_requests_total
  • rest_client_request_duration_seconds rest_client_request_duration_seconds_bucket rest_client_request_duration_seconds_sum rest_client_request_duration_seconds_count
  • process_resident_memory_bytes
  • process_cpu_seconds_total
  • go_goroutines
  • kubernetes_build_info"

api-server

  • apiserver_request_duration_seconds apiserver_request_duration_seconds_bucket apiserver_request_duration_seconds_sum apiserver_request_duration_seconds_count
  • apiserver_request_total
  • workqueue_adds_total``workqueue_depth
  • workqueue_queue_duration_seconds workqueue_queue_duration_seconds_bucket workqueue_queue_duration_seconds_sum workqueue_queue_duration_seconds_count
  • process_resident_memory_bytes
  • process_cpu_seconds_total
  • go_goroutines
  • kubernetes_build_info"

windows-exporter (job=windows-exporter)

  • windows_system_system_up_time
  • windows_cpu_time_total
  • windows_memory_available_bytes
  • windows_os_visible_memory_bytes
  • windows_memory_cache_bytes
  • windows_memory_modified_page_list_bytes
  • windows_memory_standby_cache_core_bytes
  • windows_memory_standby_cache_normal_priority_bytes
  • windows_memory_standby_cache_reserve_bytes
  • windows_memory_swap_page_operations_total
  • windows_logical_disk_read_seconds_total
  • windows_logical_disk_write_seconds_total
  • windows_logical_disk_size_bytes
  • windows_logical_disk_free_bytes
  • windows_net_bytes_total
  • windows_net_packets_received_discarded_total
  • windows_net_packets_outbound_discarded_total
  • windows_container_available
  • windows_container_cpu_usage_seconds_total
  • windows_container_memory_usage_commit_bytes
  • windows_container_memory_usage_private_working_set_bytes
  • windows_container_network_receive_bytes_total
  • windows_container_network_transmit_bytes_total

kube-proxy-windows (job=kube-proxy-windows)

  • kubeproxy_sync_proxy_rules_duration_seconds
  • kubeproxy_sync_proxy_rules_duration_seconds_bucket
  • kubeproxy_sync_proxy_rules_duration_seconds_sum
  • kubeproxy_sync_proxy_rules_duration_seconds_count
  • rest_client_requests_total
  • rest_client_request_duration_seconds
  • rest_client_request_duration_seconds_bucket
  • rest_client_request_duration_seconds_sum
  • rest_client_request_duration_seconds_count
  • process_resident_memory_bytes
  • process_cpu_seconds_total
  • go_goroutines

controlplane-cluster-autoscaler

  • rest_client_requests_total
  • cluster_autoscaler_last_activity
  • cluster_autoscaler_cluster_safe_to_autoscale
  • cluster_autoscaler_scale_down_in_cooldown
  • cluster_autoscaler_scaled_up_nodes_total
  • cluster_autoscaler_unneeded_nodes_count
  • cluster_autoscaler_unschedulable_pods_count
  • cluster_autoscaler_nodes_count
  • cloudprovider_azure_api_request_errors
  • cloudprovider_azure_api_request_duration_seconds_bucket
  • cloudprovider_azure_api_request_duration_seconds_count

controlplane-kube-scheduler

  • scheduler_pending_pods
  • scheduler_unschedulable_pods
  • scheduler_pod_scheduling_attempts
  • scheduler_queue_incoming_pods_total
  • scheduler_preemption_attempts_total
  • scheduler_preemption_victims
  • scheduler_scheduling_attempt_duration_seconds
  • scheduler_schedule_attempts_total
  • scheduler_pod_scheduling_duration_seconds

controlplane-kube-controller-manager

  • rest_client_request_duration_seconds
  • rest_client_requests_total
  • workqueue_depth

后续步骤