Skip to content

Commit

Permalink
Merge pull request #2548 from DataDog/yann/vsphere-skip-external-host…
Browse files Browse the repository at this point in the history
…-tags-broken-instances

[vsphere] skip host tags for broken instances
  • Loading branch information
yannmh authored and gmmeyer committed Jun 17, 2016
1 parent b1bdbc4 commit 13c5aa3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions checks.d/vsphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,18 +507,25 @@ def _compute_needed_metrics(self, instance, available_metrics):

return wanted_metrics


def get_external_host_tags(self):
""" Returns a list of tags for every host that is detected by the vSphere
integration.
List of pairs (hostname, list_of_tags)
"""
self.log.info("Sending external_host_tags now")
self.log.debug(u"Sending external_host_tags now")
external_host_tags = []
for instance in self.instances:
i_key = self._instance_key(instance)
mor_list = self.morlist[i_key].items()
for mor_name, mor in mor_list:
mor_by_mor_name = self.morlist.get(i_key)

if not mor_by_mor_name:
self.log.warning(
u"Unable to extract hosts' tags for `%s` vSphere instance."
u"Is the check failing on this instance?", instance
)
continue

for mor in mor_by_mor_name.itervalues():
external_host_tags.append((mor['hostname'], {SOURCE_TYPE: mor['tags']}))

return external_host_tags
Expand Down

0 comments on commit 13c5aa3

Please sign in to comment.