Containerized network check reports the host metrics#994
Merged
Conversation
JulienBalestra
commented
Jan 5, 2018
| @@ -237,13 +236,10 @@ def _submit_devicemetrics(self, iface, vals_by_metric): | |||
| self.log.debug("tracked %s network metrics for interface %s" % (count, iface)) | |||
|
|
|||
| def _parse_value(self, v): | |||
Contributor
Author
There was a problem hiding this comment.
Calling long("-") will raise ValueError
v = "-"
long(v)
Traceback (most recent call last):
File "<input>", line 1, in <module>
ValueError: invalid literal for long() with base 10: '-'
JulienBalestra
commented
Jan 5, 2018
| if self._collect_cx_state is False: | ||
| return False | ||
|
|
||
| if proc_location != "/proc": |
Contributor
Author
There was a problem hiding this comment.
I'm not sure if it's interesting to add a condition over Platform.is_containerized()
Contributor
There was a problem hiding this comment.
I think that's not necessary indeed
This was referenced Jan 10, 2018
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR allows to get some host network stats when the agent is running inside a container and not in the host network namespace.
To do so, you need to take advantage of the following entry in the agent
datadog.yaml:Then mount the host /proc inside the container to /host/proc.
However in this setup, the following network configuration is always ignored:
This is because the metrics associated with the option collect_connection_state are collected by
ss/netstat.Theses binaries don't support a custom /proc path.
Additional Notes
I refactor (pep8, 257, ...) some parts of the check in the first commit.
I'll comment inline to help the review.