github.com/influxdata/influxdb/v2@v2.7.6/telegraf/plugins/inputs/net_response.go (about)

     1  package inputs
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  // NetResponse is based on telegraf NetResponse.
     8  type NetResponse struct {
     9  	baseInput
    10  }
    11  
    12  // PluginName is based on telegraf plugin name.
    13  func (n *NetResponse) PluginName() string {
    14  	return "net_response"
    15  }
    16  
    17  // TOML encodes to toml string
    18  func (n *NetResponse) TOML() string {
    19  	return fmt.Sprintf(`[[inputs.%s]]
    20    ## Protocol, must be "tcp" or "udp"
    21    ## NOTE: because the "udp" protocol does not respond to requests, it requires
    22    ## a send/expect string pair (see below).
    23    protocol = "tcp"
    24    ## Server address (default localhost)
    25    address = "localhost:80"
    26  
    27    ## Set timeout
    28    # timeout = "1s"
    29  
    30    ## Set read timeout (only used if expecting a response)
    31    # read_timeout = "1s"
    32  
    33    ## The following options are required for UDP checks. For TCP, they are
    34    ## optional. The plugin will send the given string to the server and then
    35    ## expect to receive the given 'expect' string back.
    36    ## string sent to the server
    37    # send = "ssh"
    38    ## expected string in answer
    39    # expect = "ssh"
    40  
    41    ## Uncomment to remove deprecated fields
    42    # fielddrop = ["result_type", "string_found"]
    43  `, n.PluginName())
    44  }
    45  
    46  // UnmarshalTOML decodes the parsed data to the object
    47  func (n *NetResponse) UnmarshalTOML(data interface{}) error {
    48  	return nil
    49  }