This topic describes monitoring metrics related to process CPU utilization on a host.
Details
Item |
Description |
|---|---|
| OCP Display Name | Process CPU Utilization |
| Raw Metric | process_cpu_percent |
| Collection API | proc.percent(1 * time.Second) |
| Linux Data Source | /proc/<pid>/stat field 14 (utime) + 15 (stime) |
| Sampling Method | Read once → sleep 1s → Read again, calculating the increment |
| Calculation Formula | (ΔCPU_time_seconds / 1 second) × 100 |
| Unit | Full load per core = 100%, accumulates for multiple cores; theoretical peak for 64-core without hyper-threading is 6400% |
| OCP Aggregation | avg(process_cpu_percent{name="observer"}) |
| Normalized Metric | observer_process_cpu_percent_per_cpu = Process CPU ÷ cpu_count (0~100% of total host usage) |
Handling Multiple Processes with the Same Name
When multiple processes have the same name, the last one encountered is used directly.
Meaning of utime and stime
Field |
Description |
|---|---|
| utime | User space CPU time (in jiffies) |
| stime | Kernel space CPU time (in jiffies) |
| Total | The sum of CPU time for all threads in the process |
Explanation for 64-Core Without Hyper-Threading Scenarios
- Theoretical peak = 64 × 100% = 6400%
- If the monitored peak exceeds 6400% (e.g., 11405%), it is physically impossible to sustain for a long time; it is more likely a momentary spike from sampling
- It is recommended to cross-check
observer_process_cpu_percent_per_cpuwith the host'scpu_percentfor verification.
observer
Description
Metric |
Metric name |
Unit |
|---|---|---|
| observer | observer_process_cpu_percent | % |
Calculation expression
avg(process_cpu_percent{name="observer",@LABELS}) by (@GBLABELS)
Normalized calculation expression
sum(process_cpu_percent{name="observer",@LABELS}) by (@GBLABELS) / sum(cpu_count) by (@GBLABELS)
Verification command
PID=$(pidof observer)
# Recommended: Closest to the agent port
pidstat -p $PID 1 5
# Manually reproduce 1-second sampling
CLK=$(getconf CLK_TCK)
T1=$(awk '{print $14+$15}' /proc/$PID/stat)
sleep 1
T2=$(awk '{print $14+$15}' /proc/$PID/stat)
echo "scale=2; ($T2-$T1)/$CLK*100" | bc
obproxy
Description
Metric |
Metric name |
Unit |
|---|---|---|
| obproxy | obproxy_process_cpu_percent | % |
Calculation expression
avg(process_cpu_percent{name="obproxy",@LABELS}) by (@GBLABELS)
monagent
Description
Metric |
Metric name |
Unit |
|---|---|---|
| monagent | monagent_process_cpu_percent | % |
Calculation expression
avg(process_cpu_percent{name="ocp_monagent",@LABELS}) by (@GBLABELS)
mgragent
Description
Metric |
Metric name |
Unit |
|---|---|---|
| mgragent | mgragent_process_cpu_percent | % |
Calculation expression
avg(process_cpu_percent{name="ocp_mgragent",@LABELS}) by (@GBLABELS)
Cross-validation steps (when CPU is abnormal)
# 1. Confirm the number of CPU cores
lscpu | grep -E 'Thread|Core|Socket|^CPU\(s\)'
nproc
# 2. Confirm the number of observer processes (which should be 1).
pgrep -a observer
pgrep -c observer
# 3. Continuous sampling on the OS side
pidstat -p $(pidof observer) 1 60
# 4. View on OCP
# - observer_process_cpu_percent (original cumulative value)
# - observer_process_cpu_percent_per_cpu (0–100%, indicating the CPU utilization of the entire server)
# - cpu_percent (Host CPU)
# - process_count{name="observer"} (Number of processes)
