Skip to content

Commit 4313767

Browse files
author
Remi Hakim
committed
Merge remote-tracking branch 'origin/tristan/haproxy-events' into v4.3.1
2 parents ee153a1 + aa850e4 commit 4313767

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Changes
66

77
### Changes
88

9-
# 4.3.0 / Unreleased
9+
# 4.3.0 / 05-22-2014
1010

1111
### Integrations affected
1212
* MongoDB
@@ -1052,4 +1052,4 @@ If you use ganglia, you want this version.
10521052
[@steeve]: https://github.com/steeve
10531053
[@stefan-mees]: https://github.com/stefan-mees
10541054
[@tomduckering]: https://github.com/tomduckering
1055-
[@walkeran]: https://github.com/walkeran
1055+
[@walkeran]: https://github.com/walkeran

checks.d/haproxy.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ def _process_data(
129129
)
130130
# Send the list of data to the metric and event callbacks
131131
self._process_metrics(data_dict, url)
132-
if process_events:
133-
self._process_event(data_dict, url)
132+
if process_events:
133+
self._process_event(data_dict, url)
134134

135135
if collect_status_metrics:
136136
self._process_status_metric(hosts_statuses, collect_status_metrics_by_host)
@@ -263,32 +263,39 @@ def _process_event(self, data, url):
263263
lastchg = 0
264264

265265
# Create the event object
266-
ev = self._create_event(data['status'], hostname, lastchg, service_name)
266+
ev = self._create_event(
267+
data['status'], hostname, lastchg, service_name,
268+
data['back_or_front']
269+
)
267270
self.event(ev)
268271

269272
# Store this host status so we can check against it later
270273
self.host_status[url][key] = data['status']
271274

272-
def _create_event(self, status, hostname, lastchg, service_name):
275+
def _create_event(self, status, hostname, lastchg, service_name, back_or_front):
276+
HAProxy_agent = self.hostname.decode('utf-8')
273277
if status == "DOWN":
274278
alert_type = "error"
275-
title = "%s reported %s %s" % (service_name, hostname, status)
279+
title = "%s reported %s:%s %s" % (HAProxy_agent, service_name, hostname, status)
276280
else:
277281
if status == "UP":
278282
alert_type = "success"
279283
else:
280284
alert_type = "info"
281-
title = "%s reported %s back and %s" % (service_name, hostname, status)
285+
title = "%s reported %s:%s back and %s" % (HAProxy_agent, service_name, hostname, status)
282286

287+
tags = ["service:%s" % service_name]
288+
if back_or_front == Services.BACKEND:
289+
tags.append('backend:%s' % hostname)
283290
return {
284291
'timestamp': int(time.time() - lastchg),
285292
'event_type': EVENT_TYPE,
286-
'host': hostname,
293+
'host': HAProxy_agent,
287294
'msg_title': title,
288295
'alert_type': alert_type,
289296
"source_type_name": SOURCE_TYPE_NAME,
290297
"event_object": hostname,
291-
"tags": ["frontend:%s" % service_name, "host:%s" % hostname]
298+
"tags": tags
292299
}
293300

294301
@staticmethod

packaging/datadog-agent/source/setup_agent.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
# figure out where to pull from
4-
tag="4.2.1"
4+
tag="4.3.0"
55

66
#######################
77
# Define some helpers #

0 commit comments

Comments
 (0)