diff --git a/metricbeat/docs/modules/haproxy.asciidoc b/metricbeat/docs/modules/haproxy.asciidoc index df7d441a4f2..bb6ebe06e10 100644 --- a/metricbeat/docs/modules/haproxy.asciidoc +++ b/metricbeat/docs/modules/haproxy.asciidoc @@ -24,10 +24,10 @@ in <>. Here is an example configuration: ---- metricbeat.modules: - module: haproxy - metricsets: [stat, info] + metricsets: ["info", "stat"] enabled: true period: 10s - hosts: ['tcp://127.0.0.1:14567'] + hosts: ["tcp://127.0.0.1:14567"] ---- [float] diff --git a/metricbeat/etc/beat.full.yml b/metricbeat/etc/beat.full.yml index 0d80293e0f6..7e3a874c116 100644 --- a/metricbeat/etc/beat.full.yml +++ b/metricbeat/etc/beat.full.yml @@ -93,10 +93,10 @@ metricbeat.modules: #------------------------------- haproxy Module ------------------------------ #- module: haproxy - #metricsets: [stat, info] + #metricsets: ["info", "stat"] #enabled: true #period: 10s - #hosts: ['tcp://127.0.0.1:14567'] + #hosts: ["tcp://127.0.0.1:14567"] #------------------------------- MongoDB Module ------------------------------ #- module: mongodb diff --git a/metricbeat/metricbeat.full.yml b/metricbeat/metricbeat.full.yml index 97817807ea7..707326412cf 100644 --- a/metricbeat/metricbeat.full.yml +++ b/metricbeat/metricbeat.full.yml @@ -93,10 +93,10 @@ metricbeat.modules: #------------------------------- haproxy Module ------------------------------ #- module: haproxy - #metricsets: [stat, info] + #metricsets: ["info", "stat"] #enabled: true #period: 10s - #hosts: ['tcp://127.0.0.1:14567'] + #hosts: ["tcp://127.0.0.1:14567"] #------------------------------- MongoDB Module ------------------------------ #- module: mongodb diff --git a/metricbeat/module/haproxy/_meta/config.full.yml b/metricbeat/module/haproxy/_meta/config.full.yml index 4754c31aa23..4dd6095c589 100644 --- a/metricbeat/module/haproxy/_meta/config.full.yml +++ b/metricbeat/module/haproxy/_meta/config.full.yml @@ -1,5 +1,5 @@ #- module: haproxy - #metricsets: [stat, info] + #metricsets: ["info", "stat"] #enabled: true #period: 10s - #hosts: ['tcp://127.0.0.1:14567'] + #hosts: ["tcp://127.0.0.1:14567"] diff --git a/metricbeat/module/haproxy/_meta/config.yml b/metricbeat/module/haproxy/_meta/config.yml index 51ac835f1f8..7c25a8a88cc 100644 --- a/metricbeat/module/haproxy/_meta/config.yml +++ b/metricbeat/module/haproxy/_meta/config.yml @@ -1,5 +1,5 @@ - module: haproxy - metricsets: [stat, info] + metricsets: ["info", "stat"] enabled: true period: 10s - hosts: ['tcp://127.0.0.1:14567'] + hosts: ["tcp://127.0.0.1:14567"] diff --git a/metricbeat/module/haproxy/info/_meta/data.json b/metricbeat/module/haproxy/info/_meta/data.json index 50e4ff99410..cbb64ce8b37 100644 --- a/metricbeat/module/haproxy/info/_meta/data.json +++ b/metricbeat/module/haproxy/info/_meta/data.json @@ -1,59 +1,88 @@ { - "@timestamp": "2016-08-13T19:44:21.036Z", - "beat": { - "hostname": "beathost", - "name": "beathost" - }, + "@timestamp": "2016-05-23T08:05:34.853Z", "haproxy": { "info": { - "compress_bps_in": 0, - "compress_bps_out": 0, - "compress_bps_rate_limit": 0, - "conn_rate": 0, - "conn_rate_limit": 0, - "cum_conns": 67, - "cum_req": 67, - "cum_ssl_conns": 0, - "curr_conns": 0, - "curr_ssl_conns": 0, - "hard_max_conn": 4000, - "idle_pct": 100, - "max_conn": 4000, - "max_conn_rate": 5, - "max_pipes": 0, - "max_sess_rate": 5, - "max_sock": 8033, - "max_ssl_conns": 0, - "max_ssl_rate": 0, - "max_zlib_mem_usage": 0, - "mem_max_mb": 0, + "compress": { + "bps": { + "in": 0, + "out": 0, + "rate_limit": 0 + } + }, + "conn": { + "rate": { + "limit": 0, + "value": 0 + } + }, + "cum": { + "conns": 4, + "req": 4, + "ssl_conns": 0 + }, + "curr": { + "conns": 0, + "ssl_conns": 0 + }, + "idle_pct": 1, + "max": { + "conn": { + "rate": 0, + "value": 4000 + }, + "hard_conn": 4000, + "pipes": 0, + "sess_rate": 0, + "sock": 8032, + "ssl": { + "conns": 0, + "rate": 0 + }, + "zlib_mem_usage": 0 + }, + "mem_max_bytes": 0, "nb_proc": 1, - "pid": 53858, - "pipes_free": 0, - "pipes_used": 0, + "pid": 7, + "pipes": { + "free": 0, + "used": 0 + }, "process_num": 1, - "run_queue": 2, - "sess_rate": 0, - "sess_rate_limit": 0, - "ssl_babckend_key_rate": 0, - "ssl_backend_max_key_rate": 0, - "ssl_cache_misses": 0, - "ssl_cached_lookups": 0, - "ssl_frontend_key_rate": 0, - "ssl_frontend_max_key_rate": 0, - "ssl_frontend_session_reuse_pct": 0, - "ssl_rate": 0, - "ssl_rate_limit": 0, - "tasks": 7, - "ulimit_n": 8033, - "uptime_sec": 13700, + "run_queue": 1, + "sess": { + "rate": { + "limit": 0, + "value": 0 + } + }, + "ssl": { + "backend": { + "key_rate": 0, + "max_key_rate": 0 + }, + "cache_misses": 0, + "cached_lookups": 0, + "frontend": { + "key_rate": 0, + "max_key_rate": 0, + "session_reuse_pct": 0 + }, + "rate": { + "limit": 0, + "value": 0 + } + }, + "tasks": 5, + "ulimit_n": 8032, + "uptime_sec": 78, "zlib_mem_usage": 0 } }, "metricset": { + "host": "localhost", "module": "haproxy", "name": "info", - "rtt": 707 + "rtt": 115 }, "type": "metricsets" -} +} \ No newline at end of file diff --git a/metricbeat/module/haproxy/info/info_integration_test.go b/metricbeat/module/haproxy/info/info_integration_test.go new file mode 100644 index 00000000000..1d9ebff982d --- /dev/null +++ b/metricbeat/module/haproxy/info/info_integration_test.go @@ -0,0 +1,25 @@ +// +build integration + +package info + +import ( + "testing" + + mbtest "github.com/elastic/beats/metricbeat/mb/testing" +) + +func TestData(t *testing.T) { + f := mbtest.NewEventFetcher(t, getConfig()) + err := mbtest.WriteEvent(f, t) + if err != nil { + t.Fatal("write", err) + } +} + +func getConfig() map[string]interface{} { + return map[string]interface{}{ + "module": "haproxy", + "metricsets": []string{"info"}, + "hosts": []string{"tcp://127.0.0.1:14567"}, + } +} diff --git a/metricbeat/module/haproxy/stat/_meta/data.json b/metricbeat/module/haproxy/stat/_meta/data.json index c2681ac53d9..840497ece21 100644 --- a/metricbeat/module/haproxy/stat/_meta/data.json +++ b/metricbeat/module/haproxy/stat/_meta/data.json @@ -1,61 +1,63 @@ { - "@timestamp": "2016-08-13T19:44:21.036Z", - "beat": { - "hostname": "beathost", - "name": "beathost" - }, + "@timestamp": "2016-05-23T08:05:34.853Z", "haproxy": { "stat": { - "act": 1, - "bck": 0, "bin": 0, "bout": 0, - "check_duration": 0, - "check_status": "L4CON", - "chkdown": 1, - "chkfail": 1, - "cli_abrt": 0, - "ctime": 0, - "downtime": 13700, + "check": { + "status": "" + }, + "comp": { + "byp": 0, + "in": 0, + "out": 0, + "rsp": 0 + }, + "component_type": 0, + "dreq": 0, "dresp": 0, - "econ": 0, - "eresp": 0, - "hanafail": 0, - "hrsp_1xx": 0, - "hrsp_2xx": 0, - "hrsp_3xx": 0, - "hrsp_4xx": 0, - "hrsp_5xx": 0, - "hrsp_other": 0, - "iid": 3, - "last_chk": "Connection refused", - "lastchg": 13700, - "lastsess": -1, - "lbtot": 0, + "ereq": 0, + "hrsp": { + "1xx": 0, + "2xx": 0, + "3xx": 0, + "4xx": 0, + "5xx": 0, + "other": 0 + }, + "iid": 2, + "last": { + "agt": "", + "chk": "" + }, "pid": 1, - "qcur": 0, - "qmax": 0, - "qtime": 0, - "rate": 0, - "rate_max": 0, - "rtime": 0, + "pxname": "http-webservices", + "rate": { + "lim": 0, + "max": 0, + "value": 0 + }, + "req": { + "rate": { + "max": 0, + "value": 0 + }, + "tot": 0 + }, "scur": 0, - "sid": 1, + "sid": 0, + "slim": 25000, "smax": 0, - "srv_abrt": 0, - "status": "DOWN", + "status": "OPEN", "stot": 0, - "svname": "log1", - "ttime": 0, - "weight": 1, - "wredis": 0, - "wretr": 0 + "svname": "FRONTEND" } }, "metricset": { + "host": "localhost", "module": "haproxy", "name": "stat", - "rtt": 2118 + "rtt": 115 }, "type": "metricsets" -} +} \ No newline at end of file diff --git a/metricbeat/module/haproxy/stat/data.go b/metricbeat/module/haproxy/stat/data.go index 411c0b13257..10ac3e520b7 100644 --- a/metricbeat/module/haproxy/stat/data.go +++ b/metricbeat/module/haproxy/stat/data.go @@ -13,48 +13,48 @@ var ( schema = s.Schema{ "pxname": c.Str("PxName"), "svname": c.Str("SvName"), - "qcur": c.Int("Qcur"), - "qmax": c.Int("Qmax"), + "qcur": c.Int("Qcur", s.Optional), + "qmax": c.Int("Qmax", s.Optional), "scur": c.Int("Scur"), "smax": c.Int("Smax"), - "slim": c.Int("Slim"), + "slim": c.Int("Slim", s.Optional), "stot": c.Int("Stot"), "bin": c.Int("Bin"), "bout": c.Int("Bout"), - "dreq": c.Int("Dreq"), + "dreq": c.Int("Dreq", s.Optional), "dresp": c.Int("Dresp"), - "ereq": c.Int("Ereq"), - "econ": c.Int("Econ"), - "eresp": c.Int("Eresp"), - "wretr": c.Int("Wretr"), - "wredis": c.Int("Wredis"), + "ereq": c.Int("Ereq", s.Optional), + "econ": c.Int("Econ", s.Optional), + "eresp": c.Int("Eresp", s.Optional), + "wretr": c.Int("Wretr", s.Optional), + "wredis": c.Int("Wredis", s.Optional), "status": c.Str("Status"), - "weight": c.Int("Weight"), - "act": c.Int("Act"), - "bck": c.Int("Bck"), - "chkfail": c.Int("ChkFail"), - "chkdown": c.Int("ChkDown"), - "lastchg": c.Int("Lastchg"), - "downtime": c.Int("Downtime"), - "qlimit": c.Int("Qlimit"), + "weight": c.Int("Weight", s.Optional), + "act": c.Int("Act", s.Optional), + "bck": c.Int("Bck", s.Optional), + "chkfail": c.Int("ChkFail", s.Optional), + "chkdown": c.Int("ChkDown", s.Optional), + "lastchg": c.Int("Lastchg", s.Optional), + "downtime": c.Int("Downtime", s.Optional), + "qlimit": c.Int("Qlimit", s.Optional), "pid": c.Int("Pid"), "iid": c.Int("Iid"), "sid": c.Int("Sid"), - "throttle": c.Int("Throttle"), - "lbtot": c.Int("Lbtot"), - "tracked": c.Int("Tracked"), + "throttle": c.Int("Throttle", s.Optional), + "lbtot": c.Int("Lbtot", s.Optional), + "tracked": c.Int("Tracked", s.Optional), "component_type": c.Int("Type"), "rate": s.Object{ - "value": c.Int("Rate"), - "lim": c.Int("RateLim"), - "max": c.Int("RateMax"), + "value": c.Int("Rate", s.Optional), + "lim": c.Int("RateLim", s.Optional), + "max": c.Int("RateMax", s.Optional), }, "check": s.Object{ "status": c.Str("CheckStatus"), - "code": c.Int("CheckCode"), - "duration": c.Int("CheckDuration"), + "code": c.Int("CheckCode", s.Optional), + "duration": c.Int("CheckDuration", s.Optional), }, "hrsp": s.Object{ @@ -66,36 +66,36 @@ var ( "other": c.Int("HrspOther"), }, - "hanafail": c.Int("Hanafail"), + "hanafail": c.Int("Hanafail", s.Optional), "req": s.Object{ "rate": s.Object{ - "value": c.Int("ReqRate"), - "max": c.Int("ReqRateMax"), + "value": c.Int("ReqRate", s.Optional), + "max": c.Int("ReqRateMax", s.Optional), }, - "tot": c.Int("ReqTot"), + "tot": c.Int("ReqTot", s.Optional), }, - "cli_abrt": c.Int("CliAbrt"), - "srv_abrt": c.Int("SrvAbrt"), + "cli_abrt": c.Int("CliAbrt", s.Optional), + "srv_abrt": c.Int("SrvAbrt", s.Optional), "comp": s.Object{ - "in": c.Int("CompIn"), - "out": c.Int("CompOut"), - "byp": c.Int("CompByp"), - "rsp": c.Int("CompRsp"), + "in": c.Int("CompIn", s.Optional), + "out": c.Int("CompOut", s.Optional), + "byp": c.Int("CompByp", s.Optional), + "rsp": c.Int("CompRsp", s.Optional), }, "last": s.Object{ - "sess": c.Int("LastSess"), + "sess": c.Int("LastSess", s.Optional), "chk": c.Str("LastChk"), "agt": c.Str("LastAgt"), }, - "qtime": c.Int("Qtime"), - "ctime": c.Int("Ctime"), - "rtime": c.Int("Rtime"), - "ttime": c.Int("Ttime"), + "qtime": c.Int("Qtime", s.Optional), + "ctime": c.Int("Ctime", s.Optional), + "rtime": c.Int("Rtime", s.Optional), + "ttime": c.Int("Ttime", s.Optional), } ) diff --git a/metricbeat/module/haproxy/stat/stat_ingetration_test.go b/metricbeat/module/haproxy/stat/stat_ingetration_test.go new file mode 100644 index 00000000000..a457d4273c5 --- /dev/null +++ b/metricbeat/module/haproxy/stat/stat_ingetration_test.go @@ -0,0 +1,25 @@ +// +build integration + +package stat + +import ( + "testing" + + mbtest "github.com/elastic/beats/metricbeat/mb/testing" +) + +func TestData(t *testing.T) { + f := mbtest.NewEventsFetcher(t, getConfig()) + err := mbtest.WriteEvents(f, t) + if err != nil { + t.Fatal("write", err) + } +} + +func getConfig() map[string]interface{} { + return map[string]interface{}{ + "module": "haproxy", + "metricsets": []string{"stat"}, + "hosts": []string{"tcp://127.0.0.1:14567"}, + } +}