This topic describes how to use Managed Service for Prometheus to monitor an Elastic Compute Service (ECS) instance deployed in a VPC.
Prerequisites
- An ECS instance is deployed in a VPC.
- The ECS instance is monitored by Managed Service for Prometheus. For more information, see Create a Prometheus instance to monitor an ECS instance.
Note The parameter values in this topic are provided for reference. You can modify them based on your business requirements.
Procedure
- Download Prometheus Node Exporter.
- Download Prometheus Node Exporter from the official website of Prometheus .
- Download Prometheus Node Exporter by running the following command.
wget https://github.com/prometheus/node_exporter/releases/download/v1.2.0/node_exporter-1.2.0.linux-amd64.tar.gz
- Install Prometheus Node Exporter.
- Check the connectivity of Prometheus Node Exporter. After Prometheus Node Exporter is started, use the Command Line Interface (CLI) to access the following URL:
curl http://localhost:9100/metrics
Note- Replace the
localhost
and port in the command based on your business requirements. - We recommend that you try to access http:// [ECS IP]:9100/metrics from other ECS instances to check whether the network connectivity is blocked by a security group rule.
If connectivity is available, the following command output is returned.
# 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
- Replace the
- Create a service discovery.
- Create a Grafana dashboard