From 211065565ff3ba050fa572bfcd5f9e333111481b Mon Sep 17 00:00:00 2001 From: Oliver Buschjost Date: Wed, 16 Sep 2015 22:55:55 +0200 Subject: [PATCH] Add HTTP 5xx stats to HAProxy plugin. Closes #194 --- plugins/haproxy/haproxy.go | 5 +++++ plugins/haproxy/haproxy_test.go | 1 + 2 files changed, 6 insertions(+) diff --git a/plugins/haproxy/haproxy.go b/plugins/haproxy/haproxy.go index df03ecced..351b4a8e7 100644 --- a/plugins/haproxy/haproxy.go +++ b/plugins/haproxy/haproxy.go @@ -245,6 +245,11 @@ func importCsvResult(r io.Reader, acc plugins.Accumulator, host string) ([][]str if err == nil { acc.Add("http_response.4xx", ival, tags) } + case HF_HRSP_5xx: + ival, err := strconv.ParseUint(v, 10, 64) + if err == nil { + acc.Add("http_response.5xx", ival, tags) + } case HF_EREQ: ival, err := strconv.ParseUint(v, 10, 64) if err == nil { diff --git a/plugins/haproxy/haproxy_test.go b/plugins/haproxy/haproxy_test.go index b54f516c9..0d63985d4 100644 --- a/plugins/haproxy/haproxy_test.go +++ b/plugins/haproxy/haproxy_test.go @@ -60,6 +60,7 @@ func TestHaproxyGeneratesMetricsWithAuthentication(t *testing.T) { {"http_response.2xx", 1314093}, {"http_response.3xx", 537036}, {"http_response.4xx", 123452}, + {"http_response.5xx", 11966}, {"dreq", 1102}, {"dresp", 80}, {"wretr", 17},