Procstat collect num_fds and io metrics permissions denied

I use telegraf version 1.6.1 to gather vm processes metrics, when install by rpm, num_fds and io metrics are missing in the resulting output. i see telegraf github issues procstat permission denied · Issue #517 · influxdata/telegraf · GitHub, Missing fields in procstat output · Issue #2403 · influxdata/telegraf · GitHub , but that running telegraf as root solves the issue, another ansower to solve this issue?

1 Like

I tried setting CAP_SYS_ADMIN to telegraf using setcap but it didn’t work. The only time it worked was when I ran it as root.

Did anyone elver find a fix for this?

There is no fix (at least that I am aware of :slight_smile: ). In Linux, the nubmer of fds comes from the files found under /proc/$PID/fd. That directory is read only for root. Here is an example from my system:

dr-x------  2 root root 7 May  4 14:08 fd

Meaning you must be root to access this data. Telegraf uses gopsutil to find the number of FDs based on the number of files listed in that directory.

CAP_SYS_ADMIN is used to do a number of “admin” operations and is commonly used for namespace operations. Should not apply here.