Skip to content

Commit

Permalink
Incorporating review comments, fixing build
Browse files Browse the repository at this point in the history
  • Loading branch information
vjsamuel committed Jul 26, 2017
1 parent b1612ad commit b28ceb6
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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*

Expand Down Expand Up @@ -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]
Expand Down
8 changes: 7 additions & 1 deletion metricbeat/docs/modules/graphite.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<configuration-metricbeat>>. Here is an example configuration:
Expand All @@ -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: "_"
----

Expand Down
4 changes: 2 additions & 2 deletions metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ This file is generated! See scripts/docs_collector.py
* <<metricbeat-module-couchbase,Couchbase>>
* <<metricbeat-module-docker,Docker>>
* <<metricbeat-module-dropwizard,Dropwizard>>
* <<metricbeat-module-elasticsearch,elasticsearch>>
* <<metricbeat-module-golang,golang>>
* <<metricbeat-module-elasticsearch,Elasticsearch>>
* <<metricbeat-module-golang,Golang>>
* <<metricbeat-module-graphite,graphite>>
* <<metricbeat-module-haproxy,HAProxy>>
* <<metricbeat-module-http,HTTP>>
Expand Down
5 changes: 3 additions & 2 deletions metricbeat/helper/server/tcp/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
2 changes: 1 addition & 1 deletion metricbeat/helper/server/tcp/tcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func TestTcpServer(t *testing.T) {
}

svc.Start()
defer svc.Stop()
writeToServer(t, "test1", host, port)
msg := <-svc.GetEvents()

Expand All @@ -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()

}

Expand Down
4 changes: 2 additions & 2 deletions metricbeat/helper/server/udp/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (g *UdpServer) WatchMetrics() {
for {
select {
case <-g.done:
break
return
default:
}

Expand All @@ -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)
}
3 changes: 2 additions & 1 deletion metricbeat/helper/server/udp/udp_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !integration

package udp

import (
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ------------------------------
Expand Down
6 changes: 6 additions & 0 deletions metricbeat/module/graphite/_meta/config.yml
Original file line number Diff line number Diff line change
@@ -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: "_"

1 change: 1 addition & 0 deletions metricbeat/module/graphite/server/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

"github.com/stretchr/testify/assert"

"github.com/elastic/beats/libbeat/common"
)

Expand Down
6 changes: 6 additions & 0 deletions metricbeat/modules.d/graphite.yml.disabled
Original file line number Diff line number Diff line change
@@ -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: "_"

0 comments on commit b28ceb6

Please sign in to comment.