
Cập nhật lần cuối: 27/01/2026 17:00
Redis
Tài liệu này hướng dẫn cấu hình Alloy để thu thập Metrics của dịch vụ Redis
Tại đường dẫn alloy/config/example.alloy, chỉnh sửa cấu hình Alloy để tích hợp Redis:
Thay các trường ở file cấu hình trên, trong đó:
| Trường | Ý nghĩa | Giá trị mẫu |
| url | Endpoint của dịch vụ APM trên giao diện Console | https://metrics-0qcs3dsvvva.apm.vnptplatform.vn/api/v1/push |
| Authorization | Token của dịch vụ APM trên giao diện Console | a5130b91-ff9b-41ef-8722-9d923a574123 |
| redis_addr | IP VM Redis | 10.168.17.30 |
| redis_user | user truy cập redis | admin |
| redis_password | password truy cập redis | AW35YfYKg9iCoMPS38839H045zO626ur |
logging {
level = "debug"
format = "logfmt"
}
prometheus.remote_write "integrations_redis_exporter" {
endpoint {
url = "<endpoint dịch vụ APM>"
headers = {
"Authorization" = "<token dịch vụ APM>",
}
}
}
prometheus.exporter.redis "integrations_redis_exporter" {
redis_addr = "<endpoint Redis>:6379"
redis_user = "<username Redis>"
redis_password = "<password Redis>"
is_cluster = true
}
discovery.relabel "integrations_redis_exporter" {
targets = prometheus.exporter.redis.integrations_redis_exporter.targets
rule {
source_labels = ["instance"]
regex = "([^:]+)(?::[0-9]+)?"
target_label = "instance"
replacement = "$1"
}
rule {
target_label = "job"
replacement = "integrations/redis_exporter"
}
}
prometheus.scrape "integrations_redis_exporter" {
targets = discovery.relabel.integrations_redis_exporter.output
forward_to = [prometheus.relabel.integrations_redis_exporter.receiver]
job_name = "integrations/redis_exporter"
}
prometheus.relabel "integrations_redis_exporter" {
forward_to = [prometheus.remote_write.integrations_redis_exporter.receiver]
rule {
source_labels = ["__name__"]
regex = "up|redis_blocked_clients|redis_cluster_slots_fail|redis_cluster_slots_pfail|redis_cluster_state|redis_commands_duration_seconds_total|redis_commands_total|redis_connected_clients|redis_connected_slaves|redis_db_keys|redis_db_keys_expiring|redis_evicted_keys_total|redis_keyspace_hits_total|redis_keyspace_misses_total|redis_master_last_io_seconds_ago|redis_memory_fragmentation_ratio|redis_memory_max_bytes|redis_memory_used_bytes|redis_memory_used_rss_bytes|redis_total_system_memory_bytes|redis_up|redis_memory_fragmentation_ratio|redis_master_last_io_seconds_ago"
action = "keep"
}
}Thực hiện các lệnh sau:
cd alloy/
helm -n <namespace> install alloy-<tên dịch vụ Redis> . VD: Cài đặt Alloy cho dịch vụ Redis tên là redis-cloud trên namespace vnptcloud:
cd alloy/
helm -n vnptcloud install alloy-redis-cloud . Kiểm tra pod Alloy running:
kubectl -n <namespace> get pod VD: Pod Alloy cho dịch vụ Redis trên namespace vnptcloud:
kubectl -n vnptcloud get pod Tham khảo hướng dẫn tích hợp dashboard, kiểm tra metric Redis trên giao diện Dashboard:
Một số dashboard mẫu khi tích hợp thành công: