2018-10-05 21:43:01 +00:00
|
|
|
package inputs
|
|
|
|
|
2018-10-16 00:38:36 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2018-10-05 21:43:01 +00:00
|
|
|
// NetResponse is based on telegraf NetResponse.
|
2018-10-16 00:38:36 +00:00
|
|
|
type NetResponse struct {
|
|
|
|
baseInput
|
|
|
|
}
|
|
|
|
|
|
|
|
// PluginName is based on telegraf plugin name.
|
|
|
|
func (n *NetResponse) PluginName() string {
|
|
|
|
return "net_response"
|
|
|
|
}
|
2018-10-05 21:43:01 +00:00
|
|
|
|
|
|
|
// TOML encodes to toml string
|
|
|
|
func (n *NetResponse) TOML() string {
|
2018-10-16 00:38:36 +00:00
|
|
|
return fmt.Sprintf(`[[inputs.%s]]
|
2018-10-17 19:51:35 +00:00
|
|
|
## 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"
|
2018-10-16 00:38:36 +00:00
|
|
|
`, n.PluginName())
|
2018-10-05 21:43:01 +00:00
|
|
|
}
|
2018-10-17 19:51:35 +00:00
|
|
|
|
|
|
|
// UnmarshalTOML decodes the parsed data to the object
|
|
|
|
func (n *NetResponse) UnmarshalTOML(data interface{}) error {
|
|
|
|
return nil
|
|
|
|
}
|