-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add system.hostfs configuration option for system module #23831
Conversation
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Pinging @elastic/integrations (Team:Integrations) |
Signed-off-by: chrismark <chrismarkou92@gmail.com>
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
config.HostFS = *HostFS | ||
} | ||
|
||
return &Module{BaseModule: base, HostFS: config.HostFS, IsAgent: fleetmode.Enabled()}, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're probably gonna have to work a little harder to merge the values from the beat config and the CLI. First of all, system_linux.go
will need to be changed to grab its value from somewhere else, presumably the merged config. Secondly, we might want to be a little more clear about what value takes precedence, since one value can override another here. Maybe some logic for if *HostFS != "" && config.HostFS != "" { error() }
or something like that? Just worried about one implicitly overriding the other.
@@ -26,6 +26,7 @@ import ( | |||
) | |||
|
|||
var ( | |||
// TODO: remove this flag in 8.0 since it should be replaced by system.hostfs configuration option (config.HostFS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -177,6 +177,9 @@ metricbeat.modules: | |||
period: 10s | |||
processes: ['.*'] | |||
|
|||
# Configure the mount point of the host’s filesystem for use in monitoring a host from within a container | |||
#system.hostfs: "/hostfs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered adding this option to all beats as a global setting?
Apart of the system module, other features can benefit of accessing the host fs, as add_docker_metadata
, that actually has another setting for this, or the internal metrics, that rely on the global gosigar.Procd
to get the pid of the process. gosigar.Procd
is modified in Metricbeat by the system module, what can lead to inconsistent behaviour between Beats (Metricbeat managed by an agent in a container can be monitored from the host pid namespace, but other Beats cannot).
An option can be to have explicit settings for each feature (as there is one for the system module and another one for add_docker_metadata
) but I wonder if when wanting to override this setting this is not wanted for all features.
In any case, just food for thought, this could be decided later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for commenting @jsoriano ! Your suggestion sounds reasonable and definitely this configuration option could be revisited/refactored.
For now I would avoid adding more complexity on this since this issue is quite blocking for running system module through Agent in containerized environements.
@fearful-symmetry do you think we should create a follow-up issue to file what Jaime suggested?
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Thanks @fearful-symmetry for the review! I updated the linux subsystem initialisation so as to take into account the configuration option. As far as the check is concerned I don't think we should add a check like
I see CLI flags as more powerful since anyone adding them should know the reason for this. If there is a case of this won't work I'm happy to change it. Let me know what you think! |
Changes look good. As far as merging the configs, I think it's fine if we don't throw an error, but I've seen enough weird and crufty container deployments that I think at least printing a little warning message when the CLI overrides the config might be a good idea. I might be overreacting, but it can't hurt. As far as a further issue to deal with the gosigar stuff, unless it's an immediate need, I'm not sure it's needed. We're planning to do a fairly deep refactor of the system module sometime soon, and we might render a lot of the conversation obsolete. |
Signed-off-by: chrismark <chrismarkou92@gmail.com>
@fearful-symmetry I added the warn message. Feel free to have another look. Also after we merge this we need the corresponding change in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @jsoriano you're right, the metadata processors are all over the place when it comes to how we're gathering host data. We might want to consider some kind of holdover until we refactor a lot of the metricbeat code.
(cherry picked from commit 345a5ca)
What does this PR do?
This PR adds
system.hostfs
configuration option for system module.It will be used instead of the flag
-system.hostfs=/hostfs
where adding a flag is not possible ie in Agent. Using the-system.hostfs
will still be available until we completely remove it in 8.0Why is it important?
In some cases setting the
proc
filesystem using the-system.hostfs
is not possible like when running with Agent, see #22915. A configuration option should be used instead.How to test this PR manually
Note: Testing alongside with elastic/integrations#673 is recommended, means that testing the package directly is required for
test-plan
phase of this PR.GOOS=linux GOARCH=amd64 go build
vim system.yml
:docker build -f Dockefile.debug . -t metricbeat-hostfs
process
metricset collects data:-system.hostfs=/hostfs45
Related issues
cc: @blakerouse