Windows Exporter mengekspos metrik sistem Windows dalam format Prometheus sehingga Managed Service for Prometheus dapat mengambil dan memantau instans Elastic Compute Service (ECS) Windows Anda. Panduan ini mencakup instalasi, konfigurasi, serta penambahan tag pada ECS yang diperlukan untuk Service Discovery.
Prasyarat
Sebelum memulai, pastikan Anda memiliki:
Instans ECS Windows dengan akses administrator
Konektivitas jaringan antara instans ECS dan lingkungan Managed Service for Prometheus Anda
Langkah 1: Instal Windows Exporter
Masuk ke instans ECS Windows Anda sebagai administrator.
Unduh paket instalasi Windows Exporter (
windows_exporter-1.22.0-amd64.msi).Jalankan installer dengan salah satu metode berikut. Installer menggunakan pengaturan default berikut:
Klik ganda file
.msi.Jalankan perintah berikut: ``
powershell msiexec /i windows_exporter-1.22.0-amd64.msi``
Setting Nilai default Directory instalasi C:\Program Files (x86)\windows_exporterPort pendengar 9182 Collector yang diaktifkan cpu, cpu_info, memory, process, tcp, cs, logical_disk, net, os, system, textfile, time Setelah instalasi selesai, verifikasi bahwa layanan
windows_exportermuncul di Konsol Layanan Windows.Konfirmasi bahwa exporter sedang menyajikan metrik: buka
http://localhost:9182/metricsdi browser. Jika exporter berjalan dengan benar, Anda akan melihat output metrik dalam format Prometheus.Catatan: Jika Anda mengubah port default, ganti
9182dengan nomor port yang telah Anda konfigurasi.curl http://localhost:9182/metricsDirektori instalasi
C:\Program Files (x86)\windows_exporterberisi foldertextfile_inputs, fileconfig.yml, danwindows_exporter.exe. Contoh fileconfig.yml:collectors: enabled: cpu,cpu_info,memory,process,tcp,cs,logical_disk,net,os,system,time,logon,textfile collector: scheduled_task: blacklist: /Microsoft/.+ log: level: info scrape: timeout-margin: 0.5 telemetry: addr: ":9182" path: /metrics max-requests: 5Akses
http://localhost:9182/metricsdi browser untuk memverifikasi bahwa exporter sedang berjalan. Jika berjalan dengan benar, Anda akan melihat metrik dalam format Prometheus:# 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.0002118 go_gc_duration_seconds{quantile="1"} 0.0007327 go_gc_duration_seconds_sum 0.0031355 go_gc_duration_seconds_count 24 # HELP go_goroutines Number of goroutines that currently exist. # TYPE go_goroutines gauge go_goroutines 14 # HELP go_info Information about the Go environment. # TYPE go_info gauge go_info{version="go1.19.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 4.227856e+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.5879624e+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.46185e+06 # HELP go_memstats_frees_total Total number of frees. # TYPE go_memstats_frees_total counter go_memstats_frees_total 80306 # 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 7.639728e+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 4.227856e+06 # 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 5.767168e+06 # 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 6.520832e+06 # HELP go_memstats_heap_objects Number of allocated objects. # TYPE go_memstats_heap_objects gauge go_memstats_heap_objects 17582 # HELP go_memstats_heap_released_bytes Number of heap bytes released to OS. # TYPE go_memstats_heap_released_bytes gauge go_memstats_heap_released_bytes 5.767168e+06
Langkah 2: Konfigurasikan Windows Exporter
Anda dapat memodifikasi file konfigurasi untuk mengubah port pendengar atau menyesuaikan collector yang digunakan. Untuk informasi lebih lanjut, lihat dokumentasi Windows Exporter.
Setelah mengubah konfigurasi, restart layanan:
sc stop windows_exporter && sc start windows_exporterAtau, restart layanan dari Konsol Layanan Windows.
Di Konsol Layanan Windows, klik kanan layanan windows_exporter, pilih , lalu restart layanan tersebut.
Langkah 3: Tambahkan tag pada instans ECS Anda untuk Service Discovery
Managed Service for Prometheus menggunakan tag instans ECS untuk Service Discovery. Tambahkan tag pada instans ECS Windows Anda agar Prometheus dapat secara otomatis menemukan dan mengambil datanya.
Sebagai contoh, tambahkan tag ecs_os:windows pada instans ECS Windows Anda.
Catatan: Jika instans ECS Windows Anda sudah memiliki tag bersama yang membedakannya dari instans lain, lewati langkah ini dan gunakan tag yang sudah ada.
Pada halaman Instance Details instans ECS Anda, di bagian Tags di bawah, verifikasi bahwa tag ecs_os:windows telah ditambahkan. Untuk mengubahnya, klik Edit Tags.
Langkah selanjutnya
Setelah mengonfigurasi Windows Exporter, atur integrasi di Konsol Managed Service for Prometheus untuk mulai melihat data pemantauan. Untuk instruksi lengkap, lihat Monitoring Windows with Prometheus.