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

[docker/gce] Properly collect pod names for docker daemon check #2082

Merged
merged 1 commit into from
Nov 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions checks.d/docker_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,7 @@ def init(self):
# Set tagging options
self.custom_tags = instance.get("tags", [])
self.collect_labels_as_tags = instance.get("collect_labels_as_tags", [])
if self.is_k8s():
self.collect_labels_as_tags.append("io.kubernetes.pod.name")
self.kube_labels = {}
self.kube_labels = {}

self.use_histogram = _is_affirmative(instance.get('use_histogram', False))
performance_tags = instance.get("performance_tags", DEFAULT_PERFORMANCE_TAGS)
Expand Down Expand Up @@ -346,6 +344,11 @@ def _get_tags(self, entity=None, tag_type=None):
"""Generate the tags for a given entity (container or image) according to a list of tag names."""
# Start with custom tags
tags = list(self.custom_tags)

# Collect pod names as tags on kubernetes
if self.is_k8s() and POD_NAME_LABEL not in self.collect_labels_as_tags:
self.collect_labels_as_tags.append(POD_NAME_LABEL)

if entity is not None:
pod_name = None

Expand Down Expand Up @@ -508,7 +511,7 @@ def _report_performance_metrics(self, containers_by_id):

if containers_without_proc_root:
message = "Couldn't find pid directory for container: {0}. They'll be missing network metrics".format(
",".join(containers_without_proc_root))
",".join(containers_without_proc_root))
if not self.is_k8s():
self.warning(message)
else:
Expand Down
3 changes: 2 additions & 1 deletion util.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ class GCE(object):
TIMEOUT = 0.1 # second
SOURCE_TYPE_NAME = 'google cloud platform'
metadata = None
EXCLUDED_ATTRIBUTES = ["sshKeys", "user-data", "cli-cert", "ipsec-cert", "ssl-cert"]
EXCLUDED_ATTRIBUTES = ["kube-env", "startup-script", "sshKeys", "user-data",
"cli-cert", "ipsec-cert", "ssl-cert"]


@staticmethod
Expand Down