本文介绍在VPC网络下的ECS实例接入可观测监控 Prometheus 版后,如何监控ECS实例。
前提条件
- 已创建ECS。
- 已将VPC网络下ECS实例接入可观测监控 Prometheus 版。具体操作,请参见Prometheus实例 for ECS
说明 本文中的参数取值均为示例,您可以根据实际情况进行修改。
操作步骤
- 下载Node Exporter。
- 通过Prometheus官网下载。
- 通过命令下载。
wget https://github.com/prometheus/node_exporter/releases/download/v1.2.0/node_exporter-1.2.0.linux-amd64.tar.gz
- 安装Node Exporter。
- 检查服务。启动Node后通过命令访问以下地址。
curl http://localhost:9100/metrics
说明- 请根据实际情况替换命令中的
localhost
和端口。 - 建议在其他ECS实例上也进行地址访问测试(http://[ECS IP]:9100/metrics),检查连接是否通畅,避免被安全组限制。
预计可得到以下返回结果。
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles. # TYPE go_gc_duration_seconds summary go_gc_duration_seconds{quantile="0"} 0 go_gc_duration_seconds{quantile="0.25"} 0 go_gc_duration_seconds{quantile="0.5"} 0 go_gc_duration_seconds{quantile="0.75"} 0 go_gc_duration_seconds{quantile="1"} 0 go_gc_duration_seconds_sum 0 go_gc_duration_seconds_count 0 # HELP go_goroutines Number of goroutines that currently exist. # TYPE go_goroutines gauge go_goroutines 7 # HELP go_info Information about the Go environment. # TYPE go_info gauge go_info{version="go1.16.6"} 1 # HELP go_memstats_alloc_bytes Number of bytes allocated and still in use. # TYPE go_memstats_alloc_bytes gauge go_memstats_alloc_bytes 1.386192e+06 # 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 1.386192e+06 # 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 4562 # HELP go_memstats_frees_total Total number of frees. # TYPE go_memstats_frees_total counter go_memstats_frees_total 754
- 请根据实际情况替换命令中的
- 添加服务发现。
- 创建Grafana大盘。