Chuyển đến nội dung chính

Mô tả

Probe host_resource thu thập metric tài nguyên hệ thống của host: CPU, memory, disk usage, disk I/O và network traffic. Đây là probe collector thuần — chỉ emit metric gauge/counter, không tạo check result. Yêu cầu platform adapter HostAdapter — chỉ hỗ trợ trên Linux và Windows (có adapter). Nếu adapter không khả dụng trên platform hiện tại, probe sẽ bị skip khi khởi tạo.

Config fields

FieldTypeBắt buộcDefaultMô tả
typestringPhải là "host_resource"
collectCpuboolKhôngfalseBật thu thập CPU usage percent
collectMemoryboolKhôngfalseBật thu thập memory usage percent
collectDiskboolKhôngfalseBật thu thập disk usage percent theo mount point
collectDiskIoboolKhôngfalseBật thu thập disk read/write bytes theo device
collectNetworkboolKhôngfalseBật thu thập network rx/tx bytes, errors, drops theo interface
diskMountsstring[]Khôngtất cả mountDanh sách mount point cần theo dõi disk usage. Nếu để trống, thu thập tất cả
diskDevicesstring[]Khôngtất cả deviceDanh sách disk device cần theo dõi I/O. Nếu để trống, thu thập tất cả block device thực (bỏ qua loop/ram)
networkInterfacesstring[]Khôngtất cả interfaceDanh sách network interface cần theo dõi. Nếu để trống, thu thập tất cả
Phải bật ít nhất một flag collect*, nếu không probe sẽ báo lỗi khi khởi tạo.

Metrics

MetricTypeUnitLabelsĐiều kiện
vms.host.cpu.usage_percentgaugepercentcollectCpu = true
vms.host.memory.usage_percentgaugepercentcollectMemory = true
vms.host.disk.usage_percentgaugepercentmountcollectDisk = true
vms.host.disk.read_bytescounterbytesdevicecollectDiskIo = true
vms.host.disk.write_bytescounterbytesdevicecollectDiskIo = true
vms.host.network.rx_bytescounterbytesifacecollectNetwork = true
vms.host.network.tx_bytescounterbytesifacecollectNetwork = true
vms.host.network.rx_errorscounterifacecollectNetwork = true
vms.host.network.rx_dropscounterifacecollectNetwork = true
vms.host.network.tx_errorscounterifacecollectNetwork = true
vms.host.network.tx_dropscounterifacecollectNetwork = true
vms.host.uptime_secondsgaugesecondsLuôn thu thập nếu adapter hỗ trợ

Ví dụ config

{
  "type": "host_resource",
  "collectCpu": true,
  "collectMemory": true,
  "collectDisk": true,
  "collectDiskIo": true,
  "collectNetwork": true,
  "diskMounts": ["/", "/data"],
  "diskDevices": ["sda", "nvme0n1"],
  "networkInterfaces": ["eth0", "bond0"]
}
Config tối thiểu:
{
  "type": "host_resource",
  "collectCpu": true,
  "collectMemory": true
}

Lưu ý

  • Nếu một metric family lỗi (ví dụ disk mount không tồn tại), probe tiếp tục thu thập các family khác và báo trạng thái degraded thay vì fail hoàn toàn.
  • Counter metric (disk I/O, network) là tích lũy từ lúc boot — downstream sẽ tính rate bằng cách so sánh 2 mẫu liên tiếp.