Skip to content

Commit

Permalink
HAProxy module cleanup part one
Browse files Browse the repository at this point in the history
* HAProxy status module has many fields which are not populated before values are set. These fields were marked Optional to not throw errors.
* Add data tests to haproxy module to generate data.json
* Cleanup config to be similar to the other configs

Part of elastic#2485
Closes elastic#2574
  • Loading branch information
ruflin committed Oct 7, 2016
1 parent 5e0e7e7 commit 8e9bf14
Show file tree
Hide file tree
Showing 10 changed files with 221 additions and 140 deletions.
4 changes: 2 additions & 2 deletions metricbeat/docs/modules/haproxy.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ in <<configuration-metricbeat>>. 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]
Expand Down
4 changes: 2 additions & 2 deletions metricbeat/etc/beat.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions metricbeat/metricbeat.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions metricbeat/module/haproxy/_meta/config.full.yml
Original file line number Diff line number Diff line change
@@ -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"]
4 changes: 2 additions & 2 deletions metricbeat/module/haproxy/_meta/config.yml
Original file line number Diff line number Diff line change
@@ -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"]
121 changes: 75 additions & 46 deletions metricbeat/module/haproxy/info/_meta/data.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
25 changes: 25 additions & 0 deletions metricbeat/module/haproxy/info/info_integration_test.go
Original file line number Diff line number Diff line change
@@ -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"},
}
}
90 changes: 46 additions & 44 deletions metricbeat/module/haproxy/stat/_meta/data.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading

0 comments on commit 8e9bf14

Please sign in to comment.