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

[mesos_slave] Do not fail if no cluster name #1843

Merged
merged 2 commits into from
Aug 19, 2015
Merged
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
8 changes: 5 additions & 3 deletions checks.d/mesos_slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def _get_constant_attributes(self, url, timeout):
self.version = map(int, state_metrics['version'].split('.'))
master_state = self._get_state('http://' + state_metrics['master_hostname'] + ':5050', timeout)
if master_state is not None:
self.cluster_name = master_state['cluster']
self.cluster_name = master_state.get('cluster')

return state_metrics

Expand All @@ -157,10 +157,12 @@ def check(self, instance):
state_metrics = self._get_state(url, timeout)
if state_metrics:
tags = [
'mesos_cluster:{0}'.format(self.cluster_name),
'mesos_pid:{0}'.format(state_metrics['pid']),
'mesos_node:slave'
'mesos_node:slave',
]
if self.cluster_name:
tags.append('mesos_cluster:{0}'.format(self.cluster_name))

tags += instance_tags

for task in tasks:
Expand Down