知乎專欄 | 多維度架構 | 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者” |
配置 docker /etc/docker/daemon.json
指定metrics採集連接埠, Prometheus會定時從該連接埠拉取數據
{ "metrics-addr" : "127.0.0.1:9323", "experimental" : true }
查看 Docker 狀態信息
iMac:prometheus neo$ curl http://localhost:9323/metrics # HELP builder_builds_failed_total Number of failed image builds # TYPE builder_builds_failed_total counter builder_builds_failed_total{reason="build_canceled"} 0 builder_builds_failed_total{reason="build_target_not_reachable_error"} 0 builder_builds_failed_total{reason="command_not_supported_error"} 0 builder_builds_failed_total{reason="dockerfile_empty_error"} 0 builder_builds_failed_total{reason="dockerfile_syntax_error"} 0 builder_builds_failed_total{reason="error_processing_commands_error"} 0 builder_builds_failed_total{reason="missing_onbuild_arguments_error"} 0 builder_builds_failed_total{reason="unknown_instruction_error"} 0 # HELP builder_builds_triggered_total Number of triggered image builds # TYPE builder_builds_triggered_total counter builder_builds_triggered_total 0 # HELP engine_daemon_container_actions_seconds The number of seconds it takes to process each container action # TYPE engine_daemon_container_actions_seconds histogram engine_daemon_container_actions_seconds_bucket{action="changes",le="0.005"} 1 engine_daemon_container_actions_seconds_bucket{action="changes",le="0.01"} 1 engine_daemon_container_actions_seconds_bucket{action="changes",le="0.025"} 1 engine_daemon_container_actions_seconds_bucket{action="changes",le="0.05"} 1 engine_daemon_container_actions_seconds_bucket{action="changes",le="0.1"} 1 engine_daemon_container_actions_seconds_bucket{action="changes",le="0.25"} 1 engine_daemon_container_actions_seconds_bucket{action="changes",le="0.5"} 1 engine_daemon_container_actions_seconds_bucket{action="changes",le="1"} 1 engine_daemon_container_actions_seconds_bucket{action="changes",le="2.5"} 1 engine_daemon_container_actions_seconds_bucket{action="changes",le="5"} 1 engine_daemon_container_actions_seconds_bucket{action="changes",le="10"} 1 engine_daemon_container_actions_seconds_bucket{action="changes",le="+Inf"} 1 engine_daemon_container_actions_seconds_sum{action="changes"} 0 engine_daemon_container_actions_seconds_count{action="changes"} 1 engine_daemon_container_actions_seconds_bucket{action="commit",le="0.005"} 1 engine_daemon_container_actions_seconds_bucket{action="commit",le="0.01"} 1 engine_daemon_container_actions_seconds_bucket{action="commit",le="0.025"} 1 engine_daemon_container_actions_seconds_bucket{action="commit",le="0.05"} 1 engine_daemon_container_actions_seconds_bucket{action="commit",le="0.1"} 1 engine_daemon_container_actions_seconds_bucket{action="commit",le="0.25"} 1 engine_daemon_container_actions_seconds_bucket{action="commit",le="0.5"} 1 engine_daemon_container_actions_seconds_bucket{action="commit",le="1"} 1 engine_daemon_container_actions_seconds_bucket{action="commit",le="2.5"} 1 engine_daemon_container_actions_seconds_bucket{action="commit",le="5"} 1 engine_daemon_container_actions_seconds_bucket{action="commit",le="10"} 1 engine_daemon_container_actions_seconds_bucket{action="commit",le="+Inf"} 1 engine_daemon_container_actions_seconds_sum{action="commit"} 0 engine_daemon_container_actions_seconds_count{action="commit"} 1 engine_daemon_container_actions_seconds_bucket{action="create",le="0.005"} 1 engine_daemon_container_actions_seconds_bucket{action="create",le="0.01"} 1 engine_daemon_container_actions_seconds_bucket{action="create",le="0.025"} 1 engine_daemon_container_actions_seconds_bucket{action="create",le="0.05"} 1 engine_daemon_container_actions_seconds_bucket{action="create",le="0.1"} 1 engine_daemon_container_actions_seconds_bucket{action="create",le="0.25"} 1 engine_daemon_container_actions_seconds_bucket{action="create",le="0.5"} 1 engine_daemon_container_actions_seconds_bucket{action="create",le="1"} 2 engine_daemon_container_actions_seconds_bucket{action="create",le="2.5"} 2 engine_daemon_container_actions_seconds_bucket{action="create",le="5"} 2 engine_daemon_container_actions_seconds_bucket{action="create",le="10"} 2 engine_daemon_container_actions_seconds_bucket{action="create",le="+Inf"} 2 engine_daemon_container_actions_seconds_sum{action="create"} 0.552623576 engine_daemon_container_actions_seconds_count{action="create"} 2 engine_daemon_container_actions_seconds_bucket{action="delete",le="0.005"} 1 engine_daemon_container_actions_seconds_bucket{action="delete",le="0.01"} 1 engine_daemon_container_actions_seconds_bucket{action="delete",le="0.025"} 1 engine_daemon_container_actions_seconds_bucket{action="delete",le="0.05"} 1 engine_daemon_container_actions_seconds_bucket{action="delete",le="0.1"} 2 engine_daemon_container_actions_seconds_bucket{action="delete",le="0.25"} 2 engine_daemon_container_actions_seconds_bucket{action="delete",le="0.5"} 2 engine_daemon_container_actions_seconds_bucket{action="delete",le="1"} 2 engine_daemon_container_actions_seconds_bucket{action="delete",le="2.5"} 2 engine_daemon_container_actions_seconds_bucket{action="delete",le="5"} 2 engine_daemon_container_actions_seconds_bucket{action="delete",le="10"} 2 engine_daemon_container_actions_seconds_bucket{action="delete",le="+Inf"} 2 engine_daemon_container_actions_seconds_sum{action="delete"} 0.097789156 engine_daemon_container_actions_seconds_count{action="delete"} 2 engine_daemon_container_actions_seconds_bucket{action="start",le="0.005"} 1 engine_daemon_container_actions_seconds_bucket{action="start",le="0.01"} 1 engine_daemon_container_actions_seconds_bucket{action="start",le="0.025"} 1 engine_daemon_container_actions_seconds_bucket{action="start",le="0.05"} 1 engine_daemon_container_actions_seconds_bucket{action="start",le="0.1"} 1 engine_daemon_container_actions_seconds_bucket{action="start",le="0.25"} 1 engine_daemon_container_actions_seconds_bucket{action="start",le="0.5"} 1 engine_daemon_container_actions_seconds_bucket{action="start",le="1"} 1 engine_daemon_container_actions_seconds_bucket{action="start",le="2.5"} 3 engine_daemon_container_actions_seconds_bucket{action="start",le="5"} 3 engine_daemon_container_actions_seconds_bucket{action="start",le="10"} 3 engine_daemon_container_actions_seconds_bucket{action="start",le="+Inf"} 3 engine_daemon_container_actions_seconds_sum{action="start"} 2.804409176 engine_daemon_container_actions_seconds_count{action="start"} 3 # HELP engine_daemon_container_states_containers The count of containers in various states # TYPE engine_daemon_container_states_containers gauge engine_daemon_container_states_containers{state="paused"} 0 engine_daemon_container_states_containers{state="running"} 2 engine_daemon_container_states_containers{state="stopped"} 2 # HELP engine_daemon_engine_cpus_cpus The number of cpus that the host system of the engine has # TYPE engine_daemon_engine_cpus_cpus gauge engine_daemon_engine_cpus_cpus 2 # HELP engine_daemon_engine_info The information related to the engine and the OS it is running on # TYPE engine_daemon_engine_info gauge engine_daemon_engine_info{architecture="x86_64",commit="ff3fbc9d55",daemon_id="JXJ2:2434:PD5N:4UXM:POXB:ANLF:HHOE:G25W:Y3AG:UFUO:CBZP:H7K4",graphdriver="overlay2",kernel="4.19.76-linuxkit",os="Docker Desktop",os_type="linux",version="19.03.13-beta2"} 1 # HELP engine_daemon_engine_memory_bytes The number of bytes of memory that the host system of the engine has # TYPE engine_daemon_engine_memory_bytes gauge engine_daemon_engine_memory_bytes 2.088206336e+09 # HELP engine_daemon_events_subscribers_total The number of current subscribers to events # TYPE engine_daemon_events_subscribers_total gauge engine_daemon_events_subscribers_total 7 # HELP engine_daemon_events_total The number of events logged # TYPE engine_daemon_events_total counter engine_daemon_events_total 11 # HELP engine_daemon_health_checks_failed_total The total number of failed health checks # TYPE engine_daemon_health_checks_failed_total counter engine_daemon_health_checks_failed_total 0 # HELP engine_daemon_health_checks_total The total number of health checks # TYPE engine_daemon_health_checks_total counter engine_daemon_health_checks_total 0 # HELP engine_daemon_network_actions_seconds The number of seconds it takes to process each network action # TYPE engine_daemon_network_actions_seconds histogram engine_daemon_network_actions_seconds_bucket{action="allocate",le="0.005"} 0 engine_daemon_network_actions_seconds_bucket{action="allocate",le="0.01"} 0 engine_daemon_network_actions_seconds_bucket{action="allocate",le="0.025"} 0 engine_daemon_network_actions_seconds_bucket{action="allocate",le="0.05"} 0 engine_daemon_network_actions_seconds_bucket{action="allocate",le="0.1"} 0 engine_daemon_network_actions_seconds_bucket{action="allocate",le="0.25"} 1 engine_daemon_network_actions_seconds_bucket{action="allocate",le="0.5"} 1 engine_daemon_network_actions_seconds_bucket{action="allocate",le="1"} 2 engine_daemon_network_actions_seconds_bucket{action="allocate",le="2.5"} 2 engine_daemon_network_actions_seconds_bucket{action="allocate",le="5"} 2 engine_daemon_network_actions_seconds_bucket{action="allocate",le="10"} 2 engine_daemon_network_actions_seconds_bucket{action="allocate",le="+Inf"} 2 engine_daemon_network_actions_seconds_sum{action="allocate"} 0.721134186 engine_daemon_network_actions_seconds_count{action="allocate"} 2 engine_daemon_network_actions_seconds_bucket{action="connect",le="0.005"} 0 engine_daemon_network_actions_seconds_bucket{action="connect",le="0.01"} 0 engine_daemon_network_actions_seconds_bucket{action="connect",le="0.025"} 0 engine_daemon_network_actions_seconds_bucket{action="connect",le="0.05"} 0 engine_daemon_network_actions_seconds_bucket{action="connect",le="0.1"} 0 engine_daemon_network_actions_seconds_bucket{action="connect",le="0.25"} 1 engine_daemon_network_actions_seconds_bucket{action="connect",le="0.5"} 1 engine_daemon_network_actions_seconds_bucket{action="connect",le="1"} 2 engine_daemon_network_actions_seconds_bucket{action="connect",le="2.5"} 2 engine_daemon_network_actions_seconds_bucket{action="connect",le="5"} 2 engine_daemon_network_actions_seconds_bucket{action="connect",le="10"} 2 engine_daemon_network_actions_seconds_bucket{action="connect",le="+Inf"} 2 engine_daemon_network_actions_seconds_sum{action="connect"} 0.70473929 engine_daemon_network_actions_seconds_count{action="connect"} 2 # HELP etcd_debugging_snap_save_marshalling_duration_seconds The marshalling cost distributions of save called by snapshot. # TYPE etcd_debugging_snap_save_marshalling_duration_seconds histogram etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="0.001"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="0.002"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="0.004"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="0.008"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="0.016"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="0.032"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="0.064"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="0.128"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="0.256"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="0.512"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="1.024"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="2.048"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="4.096"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="8.192"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_bucket{le="+Inf"} 0 etcd_debugging_snap_save_marshalling_duration_seconds_sum 0 etcd_debugging_snap_save_marshalling_duration_seconds_count 0 # HELP etcd_debugging_snap_save_total_duration_seconds The total latency distributions of save called by snapshot. # TYPE etcd_debugging_snap_save_total_duration_seconds histogram etcd_debugging_snap_save_total_duration_seconds_bucket{le="0.001"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="0.002"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="0.004"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="0.008"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="0.016"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="0.032"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="0.064"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="0.128"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="0.256"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="0.512"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="1.024"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="2.048"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="4.096"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="8.192"} 0 etcd_debugging_snap_save_total_duration_seconds_bucket{le="+Inf"} 0 etcd_debugging_snap_save_total_duration_seconds_sum 0 etcd_debugging_snap_save_total_duration_seconds_count 0 # HELP etcd_disk_wal_fsync_duration_seconds The latency distributions of fsync called by wal. # TYPE etcd_disk_wal_fsync_duration_seconds histogram etcd_disk_wal_fsync_duration_seconds_bucket{le="0.001"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="0.002"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="0.004"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="0.008"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="0.016"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="0.032"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="0.064"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="0.128"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="0.256"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="0.512"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="1.024"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="2.048"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="4.096"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="8.192"} 0 etcd_disk_wal_fsync_duration_seconds_bucket{le="+Inf"} 0 etcd_disk_wal_fsync_duration_seconds_sum 0 etcd_disk_wal_fsync_duration_seconds_count 0 # HELP etcd_snap_db_fsync_duration_seconds The latency distributions of fsyncing .snap.db file # TYPE etcd_snap_db_fsync_duration_seconds histogram etcd_snap_db_fsync_duration_seconds_bucket{le="0.001"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="0.002"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="0.004"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="0.008"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="0.016"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="0.032"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="0.064"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="0.128"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="0.256"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="0.512"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="1.024"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="2.048"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="4.096"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="8.192"} 0 etcd_snap_db_fsync_duration_seconds_bucket{le="+Inf"} 0 etcd_snap_db_fsync_duration_seconds_sum 0 etcd_snap_db_fsync_duration_seconds_count 0 # HELP etcd_snap_db_save_total_duration_seconds The total latency distributions of v3 snapshot save # TYPE etcd_snap_db_save_total_duration_seconds histogram etcd_snap_db_save_total_duration_seconds_bucket{le="0.1"} 0 etcd_snap_db_save_total_duration_seconds_bucket{le="0.2"} 0 etcd_snap_db_save_total_duration_seconds_bucket{le="0.4"} 0 etcd_snap_db_save_total_duration_seconds_bucket{le="0.8"} 0 etcd_snap_db_save_total_duration_seconds_bucket{le="1.6"} 0 etcd_snap_db_save_total_duration_seconds_bucket{le="3.2"} 0 etcd_snap_db_save_total_duration_seconds_bucket{le="6.4"} 0 etcd_snap_db_save_total_duration_seconds_bucket{le="12.8"} 0 etcd_snap_db_save_total_duration_seconds_bucket{le="25.6"} 0 etcd_snap_db_save_total_duration_seconds_bucket{le="51.2"} 0 etcd_snap_db_save_total_duration_seconds_bucket{le="+Inf"} 0 etcd_snap_db_save_total_duration_seconds_sum 0 etcd_snap_db_save_total_duration_seconds_count 0 # HELP go_gc_duration_seconds A summary of the GC invocation durations. # TYPE go_gc_duration_seconds summary go_gc_duration_seconds{quantile="0"} 1.1441e-05 go_gc_duration_seconds{quantile="0.25"} 1.7381e-05 go_gc_duration_seconds{quantile="0.5"} 4.7132e-05 go_gc_duration_seconds{quantile="0.75"} 8.847e-05 go_gc_duration_seconds{quantile="1"} 0.000336452 go_gc_duration_seconds_sum 0.000573966 go_gc_duration_seconds_count 7 # HELP go_goroutines Number of goroutines that currently exist. # TYPE go_goroutines gauge go_goroutines 124 # HELP go_memstats_alloc_bytes Number of bytes allocated and still in use. # TYPE go_memstats_alloc_bytes gauge go_memstats_alloc_bytes 1.3152408e+07 # HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed. # TYPE go_memstats_alloc_bytes_total counter go_memstats_alloc_bytes_total 3.7942088e+07 # HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table. # TYPE go_memstats_buck_hash_sys_bytes gauge go_memstats_buck_hash_sys_bytes 1.458259e+06 # HELP go_memstats_frees_total Total number of frees. # TYPE go_memstats_frees_total counter go_memstats_frees_total 239116 # HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata. # TYPE go_memstats_gc_sys_bytes gauge go_memstats_gc_sys_bytes 2.4064e+06 # HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use. # TYPE go_memstats_heap_alloc_bytes gauge go_memstats_heap_alloc_bytes 1.3152408e+07 # HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used. # TYPE go_memstats_heap_idle_bytes gauge go_memstats_heap_idle_bytes 4.8480256e+07 # HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use. # TYPE go_memstats_heap_inuse_bytes gauge go_memstats_heap_inuse_bytes 1.67936e+07 # HELP go_memstats_heap_objects Number of allocated objects. # TYPE go_memstats_heap_objects gauge go_memstats_heap_objects 134382 # HELP go_memstats_heap_released_bytes_total Total number of heap bytes released to OS. # TYPE go_memstats_heap_released_bytes_total counter go_memstats_heap_released_bytes_total 4.6186496e+07 # HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system. # TYPE go_memstats_heap_sys_bytes gauge go_memstats_heap_sys_bytes 6.5273856e+07 # HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection. # TYPE go_memstats_last_gc_time_seconds gauge go_memstats_last_gc_time_seconds 1.6024955900357985e+09 # HELP go_memstats_lookups_total Total number of pointer lookups. # TYPE go_memstats_lookups_total counter go_memstats_lookups_total 0 # HELP go_memstats_mallocs_total Total number of mallocs. # TYPE go_memstats_mallocs_total counter go_memstats_mallocs_total 373498 # HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures. # TYPE go_memstats_mcache_inuse_bytes gauge go_memstats_mcache_inuse_bytes 3472 # HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system. # TYPE go_memstats_mcache_sys_bytes gauge go_memstats_mcache_sys_bytes 16384 # HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures. # TYPE go_memstats_mspan_inuse_bytes gauge go_memstats_mspan_inuse_bytes 215424 # HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system. # TYPE go_memstats_mspan_sys_bytes gauge go_memstats_mspan_sys_bytes 229376 # HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place. # TYPE go_memstats_next_gc_bytes gauge go_memstats_next_gc_bytes 1.8665712e+07 # HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations. # TYPE go_memstats_other_sys_bytes gauge go_memstats_other_sys_bytes 542885 # HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator. # TYPE go_memstats_stack_inuse_bytes gauge go_memstats_stack_inuse_bytes 1.835008e+06 # HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator. # TYPE go_memstats_stack_sys_bytes gauge go_memstats_stack_sys_bytes 1.835008e+06 # HELP go_memstats_sys_bytes Number of bytes obtained by system. Sum of all system allocations. # TYPE go_memstats_sys_bytes gauge go_memstats_sys_bytes 7.1762168e+07 # HELP http_request_duration_microseconds The HTTP request latencies in microseconds. # TYPE http_request_duration_microseconds summary http_request_duration_microseconds{handler="prometheus",quantile="0.5"} 5785.224 http_request_duration_microseconds{handler="prometheus",quantile="0.9"} 18160.443 http_request_duration_microseconds{handler="prometheus",quantile="0.99"} 18160.443 http_request_duration_microseconds_sum{handler="prometheus"} 27367.838 http_request_duration_microseconds_count{handler="prometheus"} 3 # HELP http_request_size_bytes The HTTP request sizes in bytes. # TYPE http_request_size_bytes summary http_request_size_bytes{handler="prometheus",quantile="0.5"} 232 http_request_size_bytes{handler="prometheus",quantile="0.9"} 232 http_request_size_bytes{handler="prometheus",quantile="0.99"} 232 http_request_size_bytes_sum{handler="prometheus"} 696 http_request_size_bytes_count{handler="prometheus"} 3 # HELP http_requests_total Total number of HTTP requests made. # TYPE http_requests_total counter http_requests_total{code="200",handler="prometheus",method="get"} 3 # HELP http_response_size_bytes The HTTP response sizes in bytes. # TYPE http_response_size_bytes summary http_response_size_bytes{handler="prometheus",quantile="0.5"} 4145 http_response_size_bytes{handler="prometheus",quantile="0.9"} 4171 http_response_size_bytes{handler="prometheus",quantile="0.99"} 4171 http_response_size_bytes_sum{handler="prometheus"} 12422 http_response_size_bytes_count{handler="prometheus"} 3 # HELP logger_log_entries_size_greater_than_buffer_total Number of log entries which are larger than the log buffer # TYPE logger_log_entries_size_greater_than_buffer_total counter logger_log_entries_size_greater_than_buffer_total 0 # HELP logger_log_read_operations_failed_total Number of log reads from container stdio that failed # TYPE logger_log_read_operations_failed_total counter logger_log_read_operations_failed_total 0 # HELP logger_log_write_operations_failed_total Number of log write operations that failed # TYPE logger_log_write_operations_failed_total counter logger_log_write_operations_failed_total 0 # HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. # TYPE process_cpu_seconds_total counter process_cpu_seconds_total 1.36 # HELP process_max_fds Maximum number of open file descriptors. # TYPE process_max_fds gauge process_max_fds 1.048576e+06 # HELP process_open_fds Number of open file descriptors. # TYPE process_open_fds gauge process_open_fds 88 # HELP process_resident_memory_bytes Resident memory size in bytes. # TYPE process_resident_memory_bytes gauge process_resident_memory_bytes 6.0104704e+07 # HELP process_start_time_seconds Start time of the process since unix epoch in seconds. # TYPE process_start_time_seconds gauge process_start_time_seconds 1.6024954353e+09 # HELP process_virtual_memory_bytes Virtual memory size in bytes. # TYPE process_virtual_memory_bytes gauge process_virtual_memory_bytes 1.223262208e+09 # HELP swarm_dispatcher_scheduling_delay_seconds Scheduling delay is the time a task takes to go from NEW to RUNNING state. # TYPE swarm_dispatcher_scheduling_delay_seconds histogram swarm_dispatcher_scheduling_delay_seconds_bucket{le="0.005"} 0 swarm_dispatcher_scheduling_delay_seconds_bucket{le="0.01"} 0 swarm_dispatcher_scheduling_delay_seconds_bucket{le="0.025"} 0 swarm_dispatcher_scheduling_delay_seconds_bucket{le="0.05"} 0 swarm_dispatcher_scheduling_delay_seconds_bucket{le="0.1"} 0 swarm_dispatcher_scheduling_delay_seconds_bucket{le="0.25"} 0 swarm_dispatcher_scheduling_delay_seconds_bucket{le="0.5"} 0 swarm_dispatcher_scheduling_delay_seconds_bucket{le="1"} 0 swarm_dispatcher_scheduling_delay_seconds_bucket{le="2.5"} 0 swarm_dispatcher_scheduling_delay_seconds_bucket{le="5"} 0 swarm_dispatcher_scheduling_delay_seconds_bucket{le="10"} 0 swarm_dispatcher_scheduling_delay_seconds_bucket{le="+Inf"} 0 swarm_dispatcher_scheduling_delay_seconds_sum 0 swarm_dispatcher_scheduling_delay_seconds_count 0 # HELP swarm_manager_configs_total The number of configs in the cluster object store # TYPE swarm_manager_configs_total gauge swarm_manager_configs_total 0 # HELP swarm_manager_leader Indicates if this manager node is a leader # TYPE swarm_manager_leader gauge swarm_manager_leader 0 # HELP swarm_manager_networks_total The number of networks in the cluster object store # TYPE swarm_manager_networks_total gauge swarm_manager_networks_total 0 # HELP swarm_manager_nodes The number of nodes # TYPE swarm_manager_nodes gauge swarm_manager_nodes{state="disconnected"} 0 swarm_manager_nodes{state="down"} 0 swarm_manager_nodes{state="ready"} 0 swarm_manager_nodes{state="unknown"} 0 # HELP swarm_manager_secrets_total The number of secrets in the cluster object store # TYPE swarm_manager_secrets_total gauge swarm_manager_secrets_total 0 # HELP swarm_manager_services_total The number of services in the cluster object store # TYPE swarm_manager_services_total gauge swarm_manager_services_total 0 # HELP swarm_manager_tasks_total The number of tasks in the cluster object store # TYPE swarm_manager_tasks_total gauge swarm_manager_tasks_total{state="accepted"} 0 swarm_manager_tasks_total{state="assigned"} 0 swarm_manager_tasks_total{state="complete"} 0 swarm_manager_tasks_total{state="failed"} 0 swarm_manager_tasks_total{state="new"} 0 swarm_manager_tasks_total{state="orphaned"} 0 swarm_manager_tasks_total{state="pending"} 0 swarm_manager_tasks_total{state="preparing"} 0 swarm_manager_tasks_total{state="ready"} 0 swarm_manager_tasks_total{state="rejected"} 0 swarm_manager_tasks_total{state="remove"} 0 swarm_manager_tasks_total{state="running"} 0 swarm_manager_tasks_total{state="shutdown"} 0 swarm_manager_tasks_total{state="starting"} 0 # HELP swarm_node_manager Whether this node is a manager or not # TYPE swarm_node_manager gauge swarm_node_manager 0 # HELP swarm_raft_snapshot_latency_seconds Raft snapshot create latency. # TYPE swarm_raft_snapshot_latency_seconds histogram swarm_raft_snapshot_latency_seconds_bucket{le="0.005"} 0 swarm_raft_snapshot_latency_seconds_bucket{le="0.01"} 0 swarm_raft_snapshot_latency_seconds_bucket{le="0.025"} 0 swarm_raft_snapshot_latency_seconds_bucket{le="0.05"} 0 swarm_raft_snapshot_latency_seconds_bucket{le="0.1"} 0 swarm_raft_snapshot_latency_seconds_bucket{le="0.25"} 0 swarm_raft_snapshot_latency_seconds_bucket{le="0.5"} 0 swarm_raft_snapshot_latency_seconds_bucket{le="1"} 0 swarm_raft_snapshot_latency_seconds_bucket{le="2.5"} 0 swarm_raft_snapshot_latency_seconds_bucket{le="5"} 0 swarm_raft_snapshot_latency_seconds_bucket{le="10"} 0 swarm_raft_snapshot_latency_seconds_bucket{le="+Inf"} 0 swarm_raft_snapshot_latency_seconds_sum 0 swarm_raft_snapshot_latency_seconds_count 0 # HELP swarm_raft_transaction_latency_seconds Raft transaction latency. # TYPE swarm_raft_transaction_latency_seconds histogram swarm_raft_transaction_latency_seconds_bucket{le="0.005"} 0 swarm_raft_transaction_latency_seconds_bucket{le="0.01"} 0 swarm_raft_transaction_latency_seconds_bucket{le="0.025"} 0 swarm_raft_transaction_latency_seconds_bucket{le="0.05"} 0 swarm_raft_transaction_latency_seconds_bucket{le="0.1"} 0 swarm_raft_transaction_latency_seconds_bucket{le="0.25"} 0 swarm_raft_transaction_latency_seconds_bucket{le="0.5"} 0 swarm_raft_transaction_latency_seconds_bucket{le="1"} 0 swarm_raft_transaction_latency_seconds_bucket{le="2.5"} 0 swarm_raft_transaction_latency_seconds_bucket{le="5"} 0 swarm_raft_transaction_latency_seconds_bucket{le="10"} 0 swarm_raft_transaction_latency_seconds_bucket{le="+Inf"} 0 swarm_raft_transaction_latency_seconds_sum 0 swarm_raft_transaction_latency_seconds_count 0 # HELP swarm_store_batch_latency_seconds Raft store batch latency. # TYPE swarm_store_batch_latency_seconds histogram swarm_store_batch_latency_seconds_bucket{le="0.005"} 0 swarm_store_batch_latency_seconds_bucket{le="0.01"} 0 swarm_store_batch_latency_seconds_bucket{le="0.025"} 0 swarm_store_batch_latency_seconds_bucket{le="0.05"} 0 swarm_store_batch_latency_seconds_bucket{le="0.1"} 0 swarm_store_batch_latency_seconds_bucket{le="0.25"} 0 swarm_store_batch_latency_seconds_bucket{le="0.5"} 0 swarm_store_batch_latency_seconds_bucket{le="1"} 0 swarm_store_batch_latency_seconds_bucket{le="2.5"} 0 swarm_store_batch_latency_seconds_bucket{le="5"} 0 swarm_store_batch_latency_seconds_bucket{le="10"} 0 swarm_store_batch_latency_seconds_bucket{le="+Inf"} 0 swarm_store_batch_latency_seconds_sum 0 swarm_store_batch_latency_seconds_count 0 # HELP swarm_store_lookup_latency_seconds Raft store read latency. # TYPE swarm_store_lookup_latency_seconds histogram swarm_store_lookup_latency_seconds_bucket{le="0.005"} 0 swarm_store_lookup_latency_seconds_bucket{le="0.01"} 0 swarm_store_lookup_latency_seconds_bucket{le="0.025"} 0 swarm_store_lookup_latency_seconds_bucket{le="0.05"} 0 swarm_store_lookup_latency_seconds_bucket{le="0.1"} 0 swarm_store_lookup_latency_seconds_bucket{le="0.25"} 0 swarm_store_lookup_latency_seconds_bucket{le="0.5"} 0 swarm_store_lookup_latency_seconds_bucket{le="1"} 0 swarm_store_lookup_latency_seconds_bucket{le="2.5"} 0 swarm_store_lookup_latency_seconds_bucket{le="5"} 0 swarm_store_lookup_latency_seconds_bucket{le="10"} 0 swarm_store_lookup_latency_seconds_bucket{le="+Inf"} 0 swarm_store_lookup_latency_seconds_sum 0 swarm_store_lookup_latency_seconds_count 0 # HELP swarm_store_memory_store_lock_duration_seconds Duration for which the raft memory store lock was held. # TYPE swarm_store_memory_store_lock_duration_seconds histogram swarm_store_memory_store_lock_duration_seconds_bucket{le="0.005"} 0 swarm_store_memory_store_lock_duration_seconds_bucket{le="0.01"} 0 swarm_store_memory_store_lock_duration_seconds_bucket{le="0.025"} 0 swarm_store_memory_store_lock_duration_seconds_bucket{le="0.05"} 0 swarm_store_memory_store_lock_duration_seconds_bucket{le="0.1"} 0 swarm_store_memory_store_lock_duration_seconds_bucket{le="0.25"} 0 swarm_store_memory_store_lock_duration_seconds_bucket{le="0.5"} 0 swarm_store_memory_store_lock_duration_seconds_bucket{le="1"} 0 swarm_store_memory_store_lock_duration_seconds_bucket{le="2.5"} 0 swarm_store_memory_store_lock_duration_seconds_bucket{le="5"} 0 swarm_store_memory_store_lock_duration_seconds_bucket{le="10"} 0 swarm_store_memory_store_lock_duration_seconds_bucket{le="+Inf"} 0 swarm_store_memory_store_lock_duration_seconds_sum 0 swarm_store_memory_store_lock_duration_seconds_count 0 # HELP swarm_store_read_tx_latency_seconds Raft store read tx latency. # TYPE swarm_store_read_tx_latency_seconds histogram swarm_store_read_tx_latency_seconds_bucket{le="0.005"} 0 swarm_store_read_tx_latency_seconds_bucket{le="0.01"} 0 swarm_store_read_tx_latency_seconds_bucket{le="0.025"} 0 swarm_store_read_tx_latency_seconds_bucket{le="0.05"} 0 swarm_store_read_tx_latency_seconds_bucket{le="0.1"} 0 swarm_store_read_tx_latency_seconds_bucket{le="0.25"} 0 swarm_store_read_tx_latency_seconds_bucket{le="0.5"} 0 swarm_store_read_tx_latency_seconds_bucket{le="1"} 0 swarm_store_read_tx_latency_seconds_bucket{le="2.5"} 0 swarm_store_read_tx_latency_seconds_bucket{le="5"} 0 swarm_store_read_tx_latency_seconds_bucket{le="10"} 0 swarm_store_read_tx_latency_seconds_bucket{le="+Inf"} 0 swarm_store_read_tx_latency_seconds_sum 0 swarm_store_read_tx_latency_seconds_count 0 # HELP swarm_store_write_tx_latency_seconds Raft store write tx latency. # TYPE swarm_store_write_tx_latency_seconds histogram swarm_store_write_tx_latency_seconds_bucket{le="0.005"} 0 swarm_store_write_tx_latency_seconds_bucket{le="0.01"} 0 swarm_store_write_tx_latency_seconds_bucket{le="0.025"} 0 swarm_store_write_tx_latency_seconds_bucket{le="0.05"} 0 swarm_store_write_tx_latency_seconds_bucket{le="0.1"} 0 swarm_store_write_tx_latency_seconds_bucket{le="0.25"} 0 swarm_store_write_tx_latency_seconds_bucket{le="0.5"} 0 swarm_store_write_tx_latency_seconds_bucket{le="1"} 0 swarm_store_write_tx_latency_seconds_bucket{le="2.5"} 0 swarm_store_write_tx_latency_seconds_bucket{le="5"} 0 swarm_store_write_tx_latency_seconds_bucket{le="10"} 0 swarm_store_write_tx_latency_seconds_bucket{le="+Inf"} 0 swarm_store_write_tx_latency_seconds_sum 0 swarm_store_write_tx_latency_seconds_count 0
配置 /etc/prometheus/prometheus.yml
# my global config global: scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. # scrape_timeout is set to the global default (10s). # Attach these labels to any time series or alerts when communicating with # external systems (federation, remote storage, Alertmanager). external_labels: monitor: 'netkiller-monitor' # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. rule_files: # - "first.rules" # - "second.rules" # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs: # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. - job_name: 'prometheus' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ['host.docker.internal:9090'] # Only works on Docker Desktop for Mac - job_name: 'docker' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ['docker.for.mac.host.internal:9323'] - job_name: 'node-exporter' static_configs: - targets: ['node-exporter:9100']
$ docker service create --replicas 1 --name my-prometheus \ --mount type=bind,source=/tmp/prometheus.yml,destination=/etc/prometheus/prometheus.yml \ --publish published=9090,target=9090,protocol=tcp \ prom/prometheus
docker-compress
version: '3.8' services: prometheus: image: prom/prometheus:latest container_name: prometheus volumes: - ./mac/prometheus.yml:/etc/prometheus/prometheus.yml command: - '--config.file=/etc/prometheus/prometheus.yml' - "--web.console.libraries=/usr/share/prometheus/console_libraries" - "--web.console.templates=/usr/share/prometheus/consoles" ports: - '9090:9090' node-exporter: image: prom/node-exporter:latest container_name: node-exporter ports: - '9100:9100'
docker run \ --volume=/:/rootfs:ro \ --volume=/var/run:/var/run:rw \ --volume=/sys:/sys:ro \ --volume=/var/lib/docker/:/var/lib/docker:ro \ --publish=8080:8090 \ --detach=true \ --name=cadvisor \ google/cadvisor:latest
修改 prometheus.yml 添加 cadvisor 監控
- job_name: cadvisor1 static_configs: - targets: ['cadvisor:8090']