-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
path.rootfs stripping in func mountPointDetails()
was not merged properly
#1418
Comments
In addition:
The PR I wrote (#1421) has corrected both of these issues as well. |
Change-type: patch Connects-to: prometheus#1418 Signed-off-by: dt-rush <[email protected]>
Change-type: patch Connects-to: #1418 Signed-off-by: dt-rush <[email protected]>
Now that #1421 is merged this issue resolved? |
@kinghrothgar yes, good check |
Is there any ETA on when a new minor release will happen? This is a significant bug for anyone running node_exporter inside of docker. It is preventing me to upgrading to get other added features / metrics. |
@kingkrothgar, I'm not sure as I'm not on the project but for my use case, I just clone at the specific commit where this was merged and build, doing a multi-stage build in docker so I just copy the built binary on into the runtime container image. Maybe that'll work for you for now as well. |
(It builds a mostly-static binary, but it is still linked to So here's what I do:
|
No time set but we'll release 1.0.0 probably in the next weeks. |
Change-type: patch Connects-to: prometheus#1418 Signed-off-by: dt-rush <[email protected]>
Change-type: patch Connects-to: prometheus#1418 Signed-off-by: dt-rush <[email protected]>
Host operating system
Linux ip-10-0-93-21.ec2.internal 4.14.11-coreos #1 SMP Fri Jan 5 11:00:14 UTC 2018 x86_64 GNU/Linux
node_exporter version: output of
node_exporter --version
node_exporter command line flags
working:
pathological:
Are you running node_exporter in Docker?
yes
What did you do that produced an error?
Attempt to export the
node_filesystem_avail_bytes
metric for a volume bind-mounted into the container viadocker -v "/:/host:ro,rslave"
(on the host machine, it lives at/media/MONITORDisk
, so inside the container, it's at/host/media/MONITORDisk
)What did you expect to see?
The filesystem info for
/host/media/MONITORDisk
should be found and exported at{mountpoint="/media/MONITORDisk"}
(/host
being stripped, because it's thepath.rootfs
argument)What did you see instead?
If
path.rootfs
is defined, we get the following errors in debug logs:If
path.rootfs
is undefined, we export the metric, but it doesn't have/host
stripped from themountpoint
label value.Analysis of why this is happening:
The ability to monitor bind-mounted volumes from host properly relies on removing a prefix directory they're mounted at.
In this case, we pass the parameter,
--path.rootfs /host
to thenode_exporter
binary so that/host/media/MONITORDisk
can be checked and reported at/media/MONITORDisk
in the labels of the resulting metric....but this feature was added in a PR that was closed, and then merged in another PR trying to replicate it after some discussion.
The second PR did not properly integrate the changes - so that instead of stripping
/host
from the metric on output, it appends it before trying to runstatfs
, and the binary ends up trying to runstatfs
on/host/host/media/MONITORDisk
which of course doesn't exist.The first (closed) PR had a function called rootfsStripPrefix which was used to strip the prefix for the
mountpoint
property of thefilesystemLabels
object whichfunc mountPointDetails()
outputs, so that when we runsyscall.Statfs(rootfsFilePath(labels.mountPoint), buf)
, the fact that therootfsFilePath
function re-appends the stripped prefix is not a problem, as it allows thestatfs()
call to find the proper path on disk.In the PR which was eventually merged instead, which was made as an imitation of this closed PR, the rootfsStripPrefix function was not included. Compare first PR and second PR (does not modify that line, which it should).
Suggested fix
Reinstate the
rootfsStripPrefix
function so that the code behaves as intended.I'll be opening a PR for this shortly linking to this issue.
The text was updated successfully, but these errors were encountered: