From 1e03a9440b51ad865ac48f6c89e4c9bc8c740dc0 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Mon, 1 Feb 2016 18:32:01 -0700 Subject: [PATCH] Try ping plugin with -n and -s options added --- plugins/inputs/ping/ping.go | 2 +- plugins/inputs/ping/ping_test.go | 8 ++++---- scripts/circle-test.sh | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/inputs/ping/ping.go b/plugins/inputs/ping/ping.go index b415c6d4d..3368a25e0 100644 --- a/plugins/inputs/ping/ping.go +++ b/plugins/inputs/ping/ping.go @@ -128,7 +128,7 @@ func hostPinger(args ...string) (string, error) { // args returns the arguments for the 'ping' executable func (p *Ping) args(url string) []string { // Build the ping command args based on toml config - args := []string{"-c", strconv.Itoa(p.Count)} + args := []string{"-c", strconv.Itoa(p.Count), "-n", "-s", "16"} if p.PingInterval > 0 { args = append(args, "-i", strconv.FormatFloat(p.PingInterval, 'f', 1, 64)) } diff --git a/plugins/inputs/ping/ping_test.go b/plugins/inputs/ping/ping_test.go index 64da15b51..6663207a0 100644 --- a/plugins/inputs/ping/ping_test.go +++ b/plugins/inputs/ping/ping_test.go @@ -76,7 +76,7 @@ func TestArgs(t *testing.T) { // Actual and Expected arg lists must be sorted for reflect.DeepEqual actual := p.args("www.google.com") - expected := []string{"-c", "2", "www.google.com"} + expected := []string{"-c", "2", "-n", "-s", "16", "www.google.com"} sort.Strings(actual) sort.Strings(expected) assert.True(t, reflect.DeepEqual(expected, actual), @@ -84,7 +84,7 @@ func TestArgs(t *testing.T) { p.Interface = "eth0" actual = p.args("www.google.com") - expected = []string{"-c", "2", "-I", "eth0", "www.google.com"} + expected = []string{"-c", "2", "-n", "-s", "16", "-I", "eth0", "www.google.com"} sort.Strings(actual) sort.Strings(expected) assert.True(t, reflect.DeepEqual(expected, actual), @@ -92,7 +92,7 @@ func TestArgs(t *testing.T) { p.Timeout = 12.0 actual = p.args("www.google.com") - expected = []string{"-c", "2", "-I", "eth0", "-t", "12.0", "www.google.com"} + expected = []string{"-c", "2", "-n", "-s", "16", "-I", "eth0", "-t", "12.0", "www.google.com"} sort.Strings(actual) sort.Strings(expected) assert.True(t, reflect.DeepEqual(expected, actual), @@ -100,7 +100,7 @@ func TestArgs(t *testing.T) { p.PingInterval = 1.2 actual = p.args("www.google.com") - expected = []string{"-c", "2", "-I", "eth0", "-t", "12.0", "-i", "1.2", + expected = []string{"-c", "2", "-n", "-s", "16", "-I", "eth0", "-t", "12.0", "-i", "1.2", "www.google.com"} sort.Strings(actual) sort.Strings(expected) diff --git a/scripts/circle-test.sh b/scripts/circle-test.sh index bbad51506..d4f150c83 100755 --- a/scripts/circle-test.sh +++ b/scripts/circle-test.sh @@ -68,4 +68,6 @@ tmpdir=$(mktemp -d) exit_if_fail ./telegraf -config $tmpdir/config.toml \ -test -input-filter cpu:mem +mv ./telegraf $CIRCLE_ARTIFACTS + exit $rc