diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 2f0d578f438..99e21336d90 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -47,6 +47,7 @@ https://github.com/elastic/beats/compare/v6.0.0-beta1...master[Check the HEAD di *Metricbeat* - Add support to exclude labels from kubernetes pod metadata. {pull}4757[4757] +- Add graphite protocol metricbeat module. {pull}4734[4734] *Packetbeat* @@ -171,6 +172,8 @@ https://github.com/elastic/beats/compare/v6.0.0-alpha2...v6.0.0-beta1[View commi - Add `test modules` command, to test modules expected output. {pull}4656[4656] - Add `processors` setting to metricbeat modules. {pull}4699[4699] +*Packetbeat* + *Winlogbeat* - Add the ability to use LevelRaw if Level isn't populated in the event XML. {pull}4257[4257] diff --git a/metricbeat/docs/modules/graphite.asciidoc b/metricbeat/docs/modules/graphite.asciidoc index 20dfe9c6142..0a03eb79f80 100644 --- a/metricbeat/docs/modules/graphite.asciidoc +++ b/metricbeat/docs/modules/graphite.asciidoc @@ -10,7 +10,7 @@ This is the graphite Module. [float] -=== Example Configuration +=== Example configuration The graphite module supports the standard configuration options that are described in <>. Here is an example configuration: @@ -21,6 +21,12 @@ metricbeat.modules: - module: graphite metricsets: ["server"] enabled: true +# protocol: "udp" +# templates: +# - filter: "test.*.bash.*" # This would match metrics like test.localhost.bash.stats +# namespace: "test" +# template: ".host.shell.metric*" # test.localhost.bash.stats would become metric=stats and tags host=localhost,shell=bash +# delimiter: "_" ---- diff --git a/metricbeat/docs/modules_list.asciidoc b/metricbeat/docs/modules_list.asciidoc index 030e7779c2a..61cef2e27ca 100644 --- a/metricbeat/docs/modules_list.asciidoc +++ b/metricbeat/docs/modules_list.asciidoc @@ -8,8 +8,8 @@ This file is generated! See scripts/docs_collector.py * <> * <> * <> - * <> - * <> + * <> + * <> * <> * <> * <> diff --git a/metricbeat/helper/server/tcp/tcp.go b/metricbeat/helper/server/tcp/tcp.go index f86add59398..a2ea7819779 100644 --- a/metricbeat/helper/server/tcp/tcp.go +++ b/metricbeat/helper/server/tcp/tcp.go @@ -65,13 +65,14 @@ func (g *TcpServer) WatchMetrics() { for { select { case <-g.done: - break + return default: } conn, err := g.listener.Accept() if err != nil { logp.Err("Unable to accept connection due to error: %v", err) + continue } defer func() { if conn != nil { @@ -97,7 +98,7 @@ func (g *TcpServer) GetEvents() chan server.Event { } func (g *TcpServer) Stop() { - g.listener.Close() close(g.done) + g.listener.Close() close(g.eventQueue) } diff --git a/metricbeat/helper/server/tcp/tcp_test.go b/metricbeat/helper/server/tcp/tcp_test.go index 78ce015b2ca..6fd1a55c5a7 100644 --- a/metricbeat/helper/server/tcp/tcp_test.go +++ b/metricbeat/helper/server/tcp/tcp_test.go @@ -44,6 +44,7 @@ func TestTcpServer(t *testing.T) { } svc.Start() + defer svc.Stop() writeToServer(t, "test1", host, port) msg := <-svc.GetEvents() @@ -52,7 +53,6 @@ func TestTcpServer(t *testing.T) { assert.True(t, ok) bytes, _ := msg.GetEvent()["data"].([]byte) assert.True(t, string(bytes) == "test1") - defer svc.Stop() } diff --git a/metricbeat/helper/server/udp/udp.go b/metricbeat/helper/server/udp/udp.go index 6d6c1267037..fc476b70207 100644 --- a/metricbeat/helper/server/udp/udp.go +++ b/metricbeat/helper/server/udp/udp.go @@ -66,7 +66,7 @@ func (g *UdpServer) WatchMetrics() { for { select { case <-g.done: - break + return default: } @@ -92,7 +92,7 @@ func (g *UdpServer) GetEvents() chan server.Event { } func (g *UdpServer) Stop() { - g.listener.Close() close(g.done) + g.listener.Close() close(g.eventQueue) } diff --git a/metricbeat/helper/server/udp/udp_test.go b/metricbeat/helper/server/udp/udp_test.go index 8edbb9ac61e..737f88dd4e5 100644 --- a/metricbeat/helper/server/udp/udp_test.go +++ b/metricbeat/helper/server/udp/udp_test.go @@ -1,3 +1,5 @@ +// +build !integration + package udp import ( @@ -51,7 +53,6 @@ func TestUdpServer(t *testing.T) { assert.True(t, ok) bytes, _ := msg.GetEvent()["data"].([]byte) assert.True(t, string(bytes) == "test1") - } func writeToServer(t *testing.T, message, host string, port int) { diff --git a/metricbeat/metricbeat.reference.yml b/metricbeat/metricbeat.reference.yml index e0f911cc34c..2061b943aa2 100644 --- a/metricbeat/metricbeat.reference.yml +++ b/metricbeat/metricbeat.reference.yml @@ -159,6 +159,12 @@ metricbeat.modules: - module: graphite metricsets: ["server"] enabled: true +# protocol: "udp" +# templates: +# - filter: "test.*.bash.*" # This would match metrics like test.localhost.bash.stats +# namespace: "test" +# template: ".host.shell.metric*" # test.localhost.bash.stats would become metric=stats and tags host=localhost,shell=bash +# delimiter: "_" #------------------------------- HAProxy Module ------------------------------ diff --git a/metricbeat/module/graphite/_meta/config.yml b/metricbeat/module/graphite/_meta/config.yml index d2006c77dba..b5318ecd7ad 100644 --- a/metricbeat/module/graphite/_meta/config.yml +++ b/metricbeat/module/graphite/_meta/config.yml @@ -1,4 +1,10 @@ - module: graphite metricsets: ["server"] enabled: true +# protocol: "udp" +# templates: +# - filter: "test.*.bash.*" # This would match metrics like test.localhost.bash.stats +# namespace: "test" +# template: ".host.shell.metric*" # test.localhost.bash.stats would become metric=stats and tags host=localhost,shell=bash +# delimiter: "_" diff --git a/metricbeat/module/graphite/server/data_test.go b/metricbeat/module/graphite/server/data_test.go index 500b00cf510..cb93978e056 100644 --- a/metricbeat/module/graphite/server/data_test.go +++ b/metricbeat/module/graphite/server/data_test.go @@ -8,6 +8,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/elastic/beats/libbeat/common" ) diff --git a/metricbeat/modules.d/graphite.yml.disabled b/metricbeat/modules.d/graphite.yml.disabled index d2006c77dba..b5318ecd7ad 100644 --- a/metricbeat/modules.d/graphite.yml.disabled +++ b/metricbeat/modules.d/graphite.yml.disabled @@ -1,4 +1,10 @@ - module: graphite metricsets: ["server"] enabled: true +# protocol: "udp" +# templates: +# - filter: "test.*.bash.*" # This would match metrics like test.localhost.bash.stats +# namespace: "test" +# template: ".host.shell.metric*" # test.localhost.bash.stats would become metric=stats and tags host=localhost,shell=bash +# delimiter: "_"