This topic describes monitoring metrics related to the number of process file descriptors on a host.
Details
Item |
Description |
|---|---|
| OCP display name | Number of Process File Descriptors |
| Original metric | process_fd_count |
| Collection API | proc.NumFDs() |
| Linux data source | Counts the number of entries in the /proc/<pid>/fd/ directory. |
| Meaning | The number of file descriptors (files, sockets, pipes, etc.) currently open by the process. |
| OCP aggregation | avg(process_fd_count{name="observer"}) |
| Related metric | observer_fd_usage = Number of file descriptors ÷ observer_ulimit_max_fd_count (%) |
Handling multiple processes with the same name
When multiple processes have the same name, the maximum value (math.Max()) is returned.
observer
Description
Metric |
Metric name |
Unit |
|---|---|---|
| observer | observer_fd_count | N/A |
Calculation expression
avg(process_fd_count{name="observer",@LABELS}) by (@GBLABELS)
Handle usage rate calculation expression
round(100 * avg(process_fd_count{name="observer"}) / avg(observer_ulimit_max_fd_count))
Verification command
PID=$(pidof observer)
# Total Handles
ls /proc/$PID/fd 2>/dev/null | wc -l
# Check the upper limit of ulimit.
cat /proc/$PID/limits | grep "open files"
# At a Glance by Type (sockets are more common in OB)
ls -l /proc/$PID/fd 2>/dev/null | awk '{print $NF}' | sed 's/.*\[//' | sed 's/\].*//' | sort | uniq -c | sort -rn | head
obproxy
Description
Metric |
Metric name |
Unit |
|---|---|---|
| obproxy | obproxy_fd_count | N/A |
Calculation expression
avg(process_fd_count{name="obproxy",@LABELS}) by (@GBLABELS)
monagent
Description
Metric |
Metric name |
Unit |
|---|---|---|
| monagent | monagent_open_fd_count | N/A |
Calculation expression
avg(process_fd_count{name="ocp_monagent",@LABELS}) by (@GBLABELS)
mgragent
Description
Metric |
Metric name |
Unit |
|---|---|---|
| mgragent | mgragent_open_fd_count | N/A |
Calculation expression
avg(process_fd_count{name="ocp_mgragent",@LABELS}) by (@GBLABELS)
Customer scenario reading suggestions
Metric |
Reading method |
|---|---|
| FD | Check if observer_fd_usage is close to 100%; FD increases when there are many OB connections. |
