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

Mô tả

Probe process_mon kiểm tra process đang chạy trên host, đếm số lượng và tùy chọn thu thập CPU/memory aggregate hoặc per-process detail. Matching theo tên process (glob, case-insensitive) và tùy chọn executable path. Yêu cầu platform adapter ProcessAdapter.

Config fields

FieldTypeBắt buộcDefaultMô tả
typestringPhải là "process_mon"
processNamestringTên process cần match. Hỗ trợ glob (*, ?, [). Case-insensitive. Ví dụ: "nginx", "java*", "node*"
executablePathstringKhôngĐường dẫn executable đầy đủ để thu hẹp match (AND với processName). Exact match
minCountintKhông1Số process tối thiểu. Nếu count < minCount → status down, severity critical
maxCountintKhôngSố process tối đa. Nếu count > maxCount → status warning, severity warning
collectCpuMemoryboolKhôngfalseThu thập tổng CPU% và memory bytes aggregate của tất cả process match
collectPerProcessboolKhôngfalseThu thập detail per-process (CPU, RSS, VMS, threads, FDs, disk I/O, uptime). Mỗi process có label pidname
collectConnectionsboolKhông= collectPerProcessThu thập số open connection của mỗi matched PID. Mặc định theo collectPerProcess. Cần ConnAdapter và có thể cần CAP_SYS_PTRACE
maxProcessesintKhông20Giới hạn số process emit per-process detail (busiest-by-CPU được giữ). Dùng để bound metric cardinality

Metrics

MetricTypeUnitLabelsĐiều kiện
vms.process_mon.runningstatusLuôn emit
vms.process_mon.countgaugeLuôn emit
vms.process_mon.cpu_percentgaugepercentcollectCpuMemory = true
vms.process_mon.memory_bytesgaugebytescollectCpuMemory = true
vms.process.cpu_percentgaugepercentpid, name, usercollectPerProcess = true
vms.process.memory_rss_bytesgaugebytespid, name, usercollectPerProcess = true
vms.process.memory_vms_bytesgaugebytespid, name, usercollectPerProcess = true
vms.process.num_threadsgaugepid, name, usercollectPerProcess = true
vms.process.num_fdsgaugepid, name, usercollectPerProcess = true
vms.process.disk_read_bytescounterbytespid, name, usercollectPerProcess = true
vms.process.disk_write_bytescounterbytespid, name, usercollectPerProcess = true
vms.process.uptime_secondsgaugesecondspid, name, usercollectPerProcess = true và process có createTime
vms.process.num_connectionsgaugepid, name, usercollectConnections = true

Ví dụ config

Kiểm tra nginx chạy ít nhất 1 process:
{
  "type": "process_mon",
  "processName": "nginx",
  "minCount": 1,
  "collectCpuMemory": true
}
Per-process detail cho Java app:
{
  "type": "process_mon",
  "processName": "java",
  "executablePath": "/usr/lib/jvm/java-17/bin/java",
  "minCount": 1,
  "collectPerProcess": true,
  "collectConnections": true,
  "maxProcesses": 10
}

Lưu ý

  • commandLinePattern regex đã bị loại bỏ — dùng processName glob thay thế.
  • Khi collectPerProcess = true và số process match vượt maxProcesses, chỉ giữ các process có CPU% cao nhất.
  • Per-process detail cần platform adapter — trên một số OS hoặc user khác, một số field (CPU, memory, disk I/O) có thể trả về 0 nếu thiếu quyền.