夜莺v4版本中有个端口监控功能,我们来看一下Telegraf如何实现这个功能。遍历了一下Telegraf的input plugin列表,看起来可以用net_response这个plugin来实现。该plugin配置如下:
# # Collect response time of a TCP or UDP connection
# [[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