From b78859b331b945e5dc4a59a7066599d52d989ff5 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Tue, 13 Dec 2016 16:02:03 +0000 Subject: [PATCH] Fix documentation for net_response plugin closes #2103 --- plugins/inputs/net_response/README.md | 23 +++++++++++++++++++++ plugins/inputs/net_response/net_response.go | 16 +++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/plugins/inputs/net_response/README.md b/plugins/inputs/net_response/README.md index 1d075d1a1..e3836721c 100644 --- a/plugins/inputs/net_response/README.md +++ b/plugins/inputs/net_response/README.md @@ -6,6 +6,27 @@ It can also check response text. ### Configuration: ``` +[[inputs.net_response]] + ## Protocol, must be "tcp" or "udp" + ## NOTE: because the "udp" protocol does not respond to requests, it requires + ## a send/expect string pair (see below). + protocol = "tcp" + ## Server address (default localhost) + address = "localhost:80" + ## Set timeout + timeout = "1s" + + ## Set read timeout (only used if expecting a response) + read_timeout = "1s" + + ## The following options are required for UDP checks. For TCP, they are + ## optional. The plugin will send the given string to the server and then + ## expect to receive the given 'expect' string back. + ## string sent to the server + # send = "ssh" + ## expected string in answer + # expect = "ssh" + [[inputs.net_response]] protocol = "tcp" address = ":80" @@ -30,6 +51,8 @@ It can also check response text. protocol = "udp" address = "localhost:161" timeout = "2s" + send = "hello server" + expect = "hello client" ``` ### Measurements & Fields: diff --git a/plugins/inputs/net_response/net_response.go b/plugins/inputs/net_response/net_response.go index 15725ff27..ad0de46c3 100644 --- a/plugins/inputs/net_response/net_response.go +++ b/plugins/inputs/net_response/net_response.go @@ -29,18 +29,24 @@ func (_ *NetResponse) Description() string { var sampleConfig = ` ## Protocol, must be "tcp" or "udp" + ## NOTE: because the "udp" protocol does not respond to requests, it requires + ## a send/expect string pair (see below). protocol = "tcp" ## Server address (default localhost) - address = "github.com:80" + address = "localhost:80" ## Set timeout timeout = "1s" - ## Optional string sent to the server - # send = "ssh" - ## Optional expected string in answer - # expect = "ssh" ## Set read timeout (only used if expecting a response) read_timeout = "1s" + + ## The following options are required for UDP checks. For TCP, they are + ## optional. The plugin will send the given string to the server and then + ## expect to receive the given 'expect' string back. + ## string sent to the server + # send = "ssh" + ## expected string in answer + # expect = "ssh" ` func (_ *NetResponse) SampleConfig() string {