Try ping plugin with -n and -s options added
This commit is contained in:
parent
9a59512f75
commit
1e03a9440b
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue