Metode 1
- Buka halaman utama dasbor Grafana.
- Di panel navigasi sebelah kiri, klik ikon Explore.
- Pada halaman Explore, pilih kluster dari daftar drop-down. Di bidang Metrics, masukkan pernyataan PromQL, lalu klik Run Query di pojok kanan atas.
Sebagai contoh, pernyataan PromQL untuk mengkueri rasio penggunaan CPU terhadap CPU Limit setiap Pod adalah
(sum(rate(container_cpu_usage_seconds_total[1m])) by (pod_name) / sum(label_replace(kube_pod_container_resource_limits_cpu_cores, "pod_name", "$1", "pod", "(.*)")) ) by (pod_name)). Atur Query type ke Range. Setelah dieksekusi, kurva penggunaan CPU setiap Pod akan ditampilkan dalam bentuk grafik garis.
Metode 2
Masuk ke Konsol ARMS.
- Di panel navigasi sebelah kiri, pilih .
- Di bilah navigasi atas halaman Prometheus Monitoring, pilih wilayah tempat kluster Kubernetes yang dipantau berada, lalu klik nama kluster Kubernetes tersebut.
- Di panel navigasi sebelah kiri, klik Service Discovery.
- Klik tab Targets.
- Klik ikon yang tampil di samping nama layanan, lalu klik tautan pada kolom Endpoint di tabel di bawah nama layanan untuk melihat metrik yang telah dikumpulkan.
Berikut ini adalah contoh output metrik mentah:
# 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"} 1.5523e-05 go_gc_duration_seconds{quantile="0.25"} 1.9759e-05 go_gc_duration_seconds{quantile="0.5"} 2.2416e-05 go_gc_duration_seconds{quantile="0.75"} 3.3419e-05 go_gc_duration_seconds{quantile="1"} 0.00019532 go_gc_duration_seconds_sum 12.423399336 go_gc_duration_seconds_count 422366 # HELP go_goroutines Number of goroutines that currently exist. # TYPE go_goroutines gauge go_goroutines 89 # HELP go_info Information about the Go environment. # TYPE go_info gauge go_info{version="go1.13.5"} 1 # HELP go_memstats_alloc_bytes Number of bytes allocated and still in use. # TYPE go_memstats_alloc_bytes gauge go_memstats_alloc_bytes 9.90884e+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 3.709689198752e+12 # 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 2.081594e+06 # HELP go_memstats_frees_total Total number of frees. # TYPE go_memstats_frees_total counter go_memstats_frees_total 2.6731819493e+10 # HELP go_memstats_gc_cpu_fraction The fraction of this program's available CPU time used by the GC since the program started. # TYPE go_memstats_gc_cpu_fraction gauge go_memstats_gc_cpu_fraction 1.0117824260779791e-05 # 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.414592e+06