Skip to content
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

filesystem: Ignore Docker netns mounts #1047

Merged
merged 2 commits into from
Sep 26, 2018
Merged

filesystem: Ignore Docker netns mounts #1047

merged 2 commits into from
Sep 26, 2018

Conversation

daenney
Copy link
Contributor

@daenney daenney commented Aug 18, 2018

When starting Docker containers a whole bunch of netns (network namespace) mounts are created that the node exporter can't make any sense of (and can't read either).

This ignores the Docker specific mounts under /run/docker/netns.

Fixes #875

@daenney
Copy link
Contributor Author

daenney commented Aug 18, 2018

From what I've been able to see there's no way to just ignore nsfs mounts by default, which imho would be preferred. nsfs doesn't show up in /proc/filesystems either so passing it to defIgnoredFSTypes wouldn't work.

Copy link
Member

@discordianfish discordianfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@discordianfish
Copy link
Member

Ok, let's do it this way for now. Thanks for the PR!

@SuperQ
Copy link
Member

SuperQ commented Aug 18, 2018

@daenney We don't read /proc/filesystems, defIgnoredFSTypes should work, we ignore by parsing /proc/mounts.

@daenney
Copy link
Contributor Author

daenney commented Aug 18, 2018

Aha, that's good to know. Alright, that now begs the question then, should we ignore nsfs by default instead?

@discordianfish
Copy link
Member

Yeah if possible, ignoring nsfs seems better.

When starting Docker containers a whole bunch of netns (network
namespace) mounts are created that the node exporter can't make any
sense of (and can't read either).

This ignores all nsfs filesystems.

Fixes #875

Signed-off-by: Daniele Sluijters <daenney@users.noreply.github.com>
@daenney
Copy link
Contributor Author

daenney commented Aug 19, 2018

Alright, updated to ignore nsfs instead. A line in /proc/mounts looks like this: nsfs /run/docker/netns/47a3aeb11bab nsfs rw 0 0

@daenney
Copy link
Contributor Author

daenney commented Sep 26, 2018

Is there anything left for me to do on this one?

Copy link
Member

@grobie grobie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -28,7 +28,7 @@ import (

const (
defIgnoredMountPoints = "^/(dev|proc|sys|var/lib/docker/.+)($|/)"
defIgnoredFSTypes = "^(autofs|binfmt_misc|cgroup|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|mqueue|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|sysfs|tracefs)$"
defIgnoredFSTypes = "^(autofs|binfmt_misc|cgroup|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|mqueue|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|sysfs|tracefs|nsfs)$"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the list sorted alphabetically.

@grobie grobie merged commit d999dac into prometheus:master Sep 26, 2018
@daenney daenney deleted the ignore-docker-netns branch September 26, 2018 10:39
oblitorum pushed a commit to shatteredsilicon/node_exporter that referenced this pull request Apr 9, 2024
When starting Docker containers a whole bunch of netns (network
namespace) mounts are created that the node exporter can't make any
sense of (and can't read either).

This ignores all nsfs filesystems.

Fixes prometheus#875

Signed-off-by: Daniele Sluijters <daenney@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants