Set alternative `/proc` location
The go library gopsutil allows to set a custom /proc location via HOST_PROC environment variable. This is useful if the application is running inside a container to get proper system process info.
Other host metric collectors running inside docker also support this, e.g. prometheus node exporter where the locations can then be mounted from the host to the container
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
Wondering if there is a similar feature in this library, I was browsing a bit through the source code but did not find how I can customize this.
@nflaig currently there is no such option but I will try to add this ...
To add a bit more context, there are a few functions which do not report the desired data if the process is running inside container (docker)
disksIO()always returns0forrIOandwIOnetworkStats()will return a local network instead of external one, this might not be solvable even with mount points but need to investigatefsSize()might not show all relevant file systems, this highly depends on the setup I think, so far for the setups I tested, even without the mount point the data looks good- other functions such as
cpu()andmem()look mostly correct although,cpu()seems to return the count of logical CPU cores forphysicalCoreswhich is not correct as this is equal to the value ofcores