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

Tristan/agent checks ui #922

Merged
merged 12 commits into from
May 19, 2014
12 changes: 11 additions & 1 deletion checks/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@ def run(self, checksd=None, start_event=True):
payload['metrics'] = metrics
payload['events'] = events
payload['service_checks'] = service_checks

# Add agent_chekcs if needed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

if self._should_send_metadata():
payload['agent_checks'] = [
(c.name, c.instance_statuses[0].status, c.instance_statuses[0].error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should probably send the statuses for all our instances and they we can decide how to display an error or not on the server side. Also, please fix the indent

for c in check_statuses
]

collect_duration = timer.step()

if self.os != 'windows':
Expand Down Expand Up @@ -379,7 +387,7 @@ def _build_payload(self, start_event=True):
}]

# Periodically send the host metadata.
if self._is_first_run() or self._should_send_metadata():
if self._should_send_metadata():
payload['systemStats'] = get_system_stats()
payload['meta'] = self._get_metadata()
self.metadata_cache = payload['meta']
Expand Down Expand Up @@ -427,6 +435,8 @@ def _get_metadata(self):
return metadata

def _should_send_metadata(self):
if self._is_first_run():
return True
# If the interval has passed, send the metadata again
now = time.time()
if now - self.metadata_start >= self.metadata_interval:
Expand Down