feat: migrate input plugins to new sample config format (M-Z) (#10926)
This commit is contained in:
parent
66daef2f0c
commit
b355be5ccb
|
|
@ -124,6 +124,7 @@ import (
|
|||
_ "github.com/influxdata/telegraf/plugins/inputs/neptune_apex"
|
||||
_ "github.com/influxdata/telegraf/plugins/inputs/net"
|
||||
_ "github.com/influxdata/telegraf/plugins/inputs/net_response"
|
||||
_ "github.com/influxdata/telegraf/plugins/inputs/netstat"
|
||||
_ "github.com/influxdata/telegraf/plugins/inputs/nfsclient"
|
||||
_ "github.com/influxdata/telegraf/plugins/inputs/nginx"
|
||||
_ "github.com/influxdata/telegraf/plugins/inputs/nginx_plus"
|
||||
|
|
|
|||
|
|
@ -8,15 +8,16 @@ This section contains the default TOML to configure the plugin. You can
|
|||
generate it using `telegraf --usage mailchimp`.
|
||||
|
||||
```toml
|
||||
# Gathers metrics from the /3.0/reports MailChimp API
|
||||
[[inputs.mailchimp]]
|
||||
## MailChimp API key
|
||||
## get from https://admin.mailchimp.com/account/api/
|
||||
api_key = "" # required
|
||||
|
||||
|
||||
## Reports for campaigns sent more than days_old ago will not be collected.
|
||||
## 0 means collect all and is the default value.
|
||||
days_old = 0
|
||||
|
||||
|
||||
## Campaign ID to get, if empty gets all campaigns, this option overrides days_old
|
||||
# campaign_id = ""
|
||||
```
|
||||
|
|
|
|||
|
|
@ -18,25 +18,6 @@ type MailChimp struct {
|
|||
Log telegraf.Logger `toml:"-"`
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## MailChimp API key
|
||||
## get from https://admin.mailchimp.com/account/api/
|
||||
api_key = "" # required
|
||||
## Reports for campaigns sent more than days_old ago will not be collected.
|
||||
## 0 means collect all.
|
||||
days_old = 0
|
||||
## Campaign ID to get, if empty gets all campaigns, this option overrides days_old
|
||||
# campaign_id = ""
|
||||
`
|
||||
|
||||
func (m *MailChimp) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (m *MailChimp) Description() string {
|
||||
return "Gathers metrics from the /3.0/reports MailChimp API"
|
||||
}
|
||||
|
||||
func (m *MailChimp) Init() error {
|
||||
m.api = NewChimpAPI(m.APIKey, m.Log)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package mailchimp
|
||||
|
||||
func (m *MailChimp) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ The MarkLogic Telegraf plugin gathers health status metrics from one or more hos
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Retrieves information on a specific host in a MarkLogic Cluster
|
||||
[[inputs.marklogic]]
|
||||
## Base URL of the MarkLogic HTTP Server.
|
||||
url = "http://localhost:8002"
|
||||
|
|
|
|||
|
|
@ -82,30 +82,6 @@ type MlHost struct {
|
|||
} `json:"host-status"`
|
||||
}
|
||||
|
||||
// Description of plugin returned
|
||||
func (c *Marklogic) Description() string {
|
||||
return "Retrieves information on a specific host in a MarkLogic Cluster"
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## Base URL of the MarkLogic HTTP Server.
|
||||
url = "http://localhost:8002"
|
||||
|
||||
## List of specific hostnames to retrieve information. At least (1) required.
|
||||
# hosts = ["hostname1", "hostname2"]
|
||||
|
||||
## Using HTTP Basic Authentication. Management API requires 'manage-user' role privileges
|
||||
# username = "myuser"
|
||||
# password = "mypassword"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
`
|
||||
|
||||
// Init parse all source URLs and place on the Marklogic struct
|
||||
func (c *Marklogic) Init() error {
|
||||
if len(c.URL) == 0 {
|
||||
|
|
@ -128,11 +104,6 @@ func (c *Marklogic) Init() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// SampleConfig to gather stats from localhost, default port.
|
||||
func (c *Marklogic) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
// Gather metrics from HTTP Server.
|
||||
func (c *Marklogic) Gather(accumulator telegraf.Accumulator) error {
|
||||
var wg sync.WaitGroup
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package marklogic
|
||||
|
||||
func (c *Marklogic) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -29,15 +29,6 @@ const (
|
|||
typeFloat statType = iota
|
||||
)
|
||||
|
||||
var sampleConfig = `
|
||||
## An array of address to gather stats about. Specify an ip or hostname
|
||||
## with port. ie tcp://localhost:11211, tcp://10.0.0.1:11211, etc.
|
||||
servers = ["tcp://localhost:11211", "unix:///var/run/mcrouter.sock"]
|
||||
|
||||
## Timeout for metric collections from all servers. Minimum timeout is "1s".
|
||||
# timeout = "5s"
|
||||
`
|
||||
|
||||
var defaultTimeout = 5 * time.Second
|
||||
|
||||
var defaultServerURL = url.URL{
|
||||
|
|
@ -113,16 +104,6 @@ var sendMetrics = map[string]statType{
|
|||
"cmd_lease_set_out_all": typeInt,
|
||||
}
|
||||
|
||||
// SampleConfig returns sample configuration message
|
||||
func (m *Mcrouter) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
// Description returns description of Mcrouter plugin
|
||||
func (m *Mcrouter) Description() string {
|
||||
return "Read metrics from one or many mcrouter servers"
|
||||
}
|
||||
|
||||
// Gather reads stats from all configured servers accumulates stats
|
||||
func (m *Mcrouter) Gather(acc telegraf.Accumulator) error {
|
||||
ctx := context.Background()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package mcrouter
|
||||
|
||||
func (m *Mcrouter) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -62,20 +62,6 @@ type MdstatConf struct {
|
|||
FileName string `toml:"file_name"`
|
||||
}
|
||||
|
||||
func (k *MdstatConf) Description() string {
|
||||
return "Get md array statistics from /proc/mdstat"
|
||||
}
|
||||
|
||||
var mdSampleConfig = `
|
||||
## Sets file path
|
||||
## If not specified, then default is /proc/mdstat
|
||||
# file_name = "/proc/mdstat"
|
||||
`
|
||||
|
||||
func (k *MdstatConf) SampleConfig() string {
|
||||
return mdSampleConfig
|
||||
}
|
||||
|
||||
func evalStatusLine(deviceLine, statusLineStr string) (statusLine, error) {
|
||||
sizeFields := strings.Fields(statusLineStr)
|
||||
if len(sizeFields) < 1 {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package mdstat
|
||||
|
||||
func (k *MdstatConf) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -14,12 +14,6 @@ type MemStats struct {
|
|||
platform string
|
||||
}
|
||||
|
||||
func (ms *MemStats) Description() string {
|
||||
return "Read metrics about memory usage"
|
||||
}
|
||||
|
||||
func (ms *MemStats) SampleConfig() string { return "" }
|
||||
|
||||
func (ms *MemStats) Init() error {
|
||||
ms.platform = runtime.GOOS
|
||||
return nil
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package mem
|
||||
|
||||
func (ms *MemStats) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -23,21 +23,6 @@ type Memcached struct {
|
|||
tlsint.ClientConfig
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## An array of address to gather stats about. Specify an ip on hostname
|
||||
## with optional port. ie localhost, 10.0.0.1:11211, etc.
|
||||
servers = ["localhost:11211"]
|
||||
# unix_sockets = ["/var/run/memcached.sock"]
|
||||
|
||||
## Optional TLS Config
|
||||
# enable_tls = true
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## If false, skip chain & host verification
|
||||
# insecure_skip_verify = true
|
||||
`
|
||||
|
||||
var defaultTimeout = 5 * time.Second
|
||||
|
||||
// The list of metrics that should be sent
|
||||
|
|
@ -91,16 +76,6 @@ var sendMetrics = []string{
|
|||
"uptime",
|
||||
}
|
||||
|
||||
// SampleConfig returns sample configuration message
|
||||
func (m *Memcached) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
// Description returns description of Memcached plugin
|
||||
func (m *Memcached) Description() string {
|
||||
return "Read metrics from one or many memcached servers"
|
||||
}
|
||||
|
||||
// Gather reads stats from all configured servers accumulates stats
|
||||
func (m *Memcached) Gather(acc telegraf.Accumulator) error {
|
||||
if len(m.Servers) == 0 && len(m.UnixSockets) == 0 {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package memcached
|
||||
|
||||
func (m *Memcached) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -46,59 +46,6 @@ var allMetrics = map[Role][]string{
|
|||
SLAVE: {"resources", "agent", "system", "executors", "tasks", "messages"},
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## Timeout, in ms.
|
||||
timeout = 100
|
||||
|
||||
## A list of Mesos masters.
|
||||
masters = ["http://localhost:5050"]
|
||||
|
||||
## Master metrics groups to be collected, by default, all enabled.
|
||||
master_collections = [
|
||||
"resources",
|
||||
"master",
|
||||
"system",
|
||||
"agents",
|
||||
"frameworks",
|
||||
"framework_offers",
|
||||
"tasks",
|
||||
"messages",
|
||||
"evqueue",
|
||||
"registrar",
|
||||
"allocator",
|
||||
]
|
||||
|
||||
## A list of Mesos slaves, default is []
|
||||
# slaves = []
|
||||
|
||||
## Slave metrics groups to be collected, by default, all enabled.
|
||||
# slave_collections = [
|
||||
# "resources",
|
||||
# "agent",
|
||||
# "system",
|
||||
# "executors",
|
||||
# "tasks",
|
||||
# "messages",
|
||||
# ]
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
`
|
||||
|
||||
// SampleConfig returns a sample configuration block
|
||||
func (m *Mesos) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
// Description just returns a short description of the Mesos plugin
|
||||
func (m *Mesos) Description() string {
|
||||
return "Telegraf plugin for gathering metrics from N Mesos masters"
|
||||
}
|
||||
|
||||
func (m *Mesos) parseURL(s string, role Role) (*url.URL, error) {
|
||||
if !strings.HasPrefix(s, "http://") && !strings.HasPrefix(s, "https://") {
|
||||
host, port, err := net.SplitHostPort(s)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package mesos
|
||||
|
||||
func (m *Mesos) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -45,6 +45,7 @@ View the current scores with a command, substituting your player name:
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Collects scores from a Minecraft server's scoreboard using the RCON protocol
|
||||
[[inputs.minecraft]]
|
||||
## Address of the Minecraft server.
|
||||
# server = "localhost"
|
||||
|
|
@ -54,6 +55,9 @@ View the current scores with a command, substituting your player name:
|
|||
|
||||
## Server RCON Password.
|
||||
password = ""
|
||||
|
||||
## Uncomment to remove deprecated metric components.
|
||||
# tagdrop = ["server"]
|
||||
```
|
||||
|
||||
## Metrics
|
||||
|
|
|
|||
|
|
@ -5,20 +5,6 @@ import (
|
|||
"github.com/influxdata/telegraf/plugins/inputs"
|
||||
)
|
||||
|
||||
const sampleConfig = `
|
||||
## Address of the Minecraft server.
|
||||
# server = "localhost"
|
||||
|
||||
## Server RCON Port.
|
||||
# port = "25575"
|
||||
|
||||
## Server RCON Password.
|
||||
password = ""
|
||||
|
||||
## Uncomment to remove deprecated metric components.
|
||||
# tagdrop = ["server"]
|
||||
`
|
||||
|
||||
// Client is a client for the Minecraft server.
|
||||
type Client interface {
|
||||
// Connect establishes a connection to the server.
|
||||
|
|
@ -40,14 +26,6 @@ type Minecraft struct {
|
|||
client Client
|
||||
}
|
||||
|
||||
func (s *Minecraft) Description() string {
|
||||
return "Collects scores from a Minecraft server's scoreboard using the RCON protocol"
|
||||
}
|
||||
|
||||
func (s *Minecraft) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (s *Minecraft) Gather(acc telegraf.Accumulator) error {
|
||||
if s.client == nil {
|
||||
connector := newConnector(s.Server, s.Port, s.Password)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package minecraft
|
||||
|
||||
func (s *Minecraft) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ The mock plugin only requires that:
|
|||
Below is a sample config to generate one of each of the four types:
|
||||
|
||||
```toml
|
||||
# Generate metrics for test and demonstration purposes
|
||||
[[inputs.mock]]
|
||||
## Set the metric name to use for reporting
|
||||
metric_name = "mock"
|
||||
|
|
|
|||
|
|
@ -49,42 +49,6 @@ type stock struct {
|
|||
Volatility float64 `toml:"volatility"`
|
||||
}
|
||||
|
||||
const sampleConfig = `
|
||||
## Set the metric name to use for reporting
|
||||
metric_name = "mock"
|
||||
|
||||
## Optional string key-value pairs of tags to add to all metrics
|
||||
# [inputs.mock.tags]
|
||||
# "key" = "value"
|
||||
|
||||
## One or more mock data fields *must* be defined.
|
||||
##
|
||||
## [[inputs.mock.random]]
|
||||
## name = "rand"
|
||||
## min = 1.0
|
||||
## max = 6.0
|
||||
## [[inputs.mock.sine_wave]]
|
||||
## name = "wave"
|
||||
## amplitude = 1.0
|
||||
## period = 0.5
|
||||
## [[inputs.mock.step]]
|
||||
## name = "plus_one"
|
||||
## start = 0.0
|
||||
## step = 1.0
|
||||
## [[inputs.mock.stock]]
|
||||
## name = "abc"
|
||||
## price = 50.00
|
||||
## volatility = 0.2
|
||||
`
|
||||
|
||||
func (m *Mock) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (m *Mock) Description() string {
|
||||
return "Generate metrics for test and demonstration purposes"
|
||||
}
|
||||
|
||||
func (m *Mock) Init() error {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package mock
|
||||
|
||||
func (m *Mock) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -3,9 +3,10 @@
|
|||
The Modbus plugin collects Discrete Inputs, Coils, Input Registers and Holding
|
||||
Registers via Modbus TCP or Modbus RTU/ASCII.
|
||||
|
||||
## Example configuration
|
||||
## Configuration
|
||||
|
||||
```toml
|
||||
# Retrieve data from MODBUS slave devices
|
||||
[[inputs.modbus]]
|
||||
## Connection Configuration
|
||||
##
|
||||
|
|
@ -187,7 +188,7 @@ Registers via Modbus TCP or Modbus RTU/ASCII.
|
|||
{ address=1, name="temperature", type="INT16", scale=0.1 }, # will result in FLOAT64 field
|
||||
{ address=2, name="force", type="INT32", output="FLOAT64" }, # will result in FLOAT64 field
|
||||
{ address=4, name="hours", type="UINT32" }, # will result in UIN64 field
|
||||
]
|
||||
]
|
||||
|
||||
[[inputs.modbus.request.tags]]
|
||||
machine = "impresser"
|
||||
|
|
|
|||
|
|
@ -74,84 +74,6 @@ const (
|
|||
cInputRegisters = "input_register"
|
||||
)
|
||||
|
||||
const description = `Retrieve data from MODBUS slave devices`
|
||||
const sampleConfigStart = `
|
||||
## Connection Configuration
|
||||
##
|
||||
## The plugin supports connections to PLCs via MODBUS/TCP, RTU over TCP, ASCII over TCP or
|
||||
## via serial line communication in binary (RTU) or readable (ASCII) encoding
|
||||
##
|
||||
## Device name
|
||||
name = "Device"
|
||||
|
||||
## Slave ID - addresses a MODBUS device on the bus
|
||||
## Range: 0 - 255 [0 = broadcast; 248 - 255 = reserved]
|
||||
slave_id = 1
|
||||
|
||||
## Timeout for each request
|
||||
timeout = "1s"
|
||||
|
||||
## Maximum number of retries and the time to wait between retries
|
||||
## when a slave-device is busy.
|
||||
# busy_retries = 0
|
||||
# busy_retries_wait = "100ms"
|
||||
|
||||
# TCP - connect via Modbus/TCP
|
||||
controller = "tcp://localhost:502"
|
||||
|
||||
## Serial (RS485; RS232)
|
||||
# controller = "file:///dev/ttyUSB0"
|
||||
# baud_rate = 9600
|
||||
# data_bits = 8
|
||||
# parity = "N"
|
||||
# stop_bits = 1
|
||||
|
||||
## Trace the connection to the modbus device as debug messages
|
||||
## Note: You have to enable telegraf's debug mode to see those messages!
|
||||
# debug_connection = false
|
||||
|
||||
## For Modbus over TCP you can choose between "TCP", "RTUoverTCP" and "ASCIIoverTCP"
|
||||
## default behaviour is "TCP" if the controller is TCP
|
||||
## For Serial you can choose between "RTU" and "ASCII"
|
||||
# transmission_mode = "RTU"
|
||||
|
||||
## Define the configuration schema
|
||||
## |---register -- define fields per register type in the original style (only supports one slave ID)
|
||||
## |---request -- define fields on a requests base
|
||||
configuration_type = "register"
|
||||
`
|
||||
const sampleConfigEnd = `
|
||||
## Enable workarounds required by some devices to work correctly
|
||||
# [inputs.modbus.workarounds]
|
||||
## Pause between read requests sent to the device. This might be necessary for (slow) serial devices.
|
||||
# pause_between_requests = "0ms"
|
||||
## Close the connection after every gather cycle. Usually the plugin closes the connection after a certain
|
||||
## idle-timeout, however, if you query a device with limited simultaneous connectivity (e.g. serial devices)
|
||||
## from multiple instances you might want to only stay connected during gather and disconnect afterwards.
|
||||
# close_connection_after_gather = false
|
||||
`
|
||||
|
||||
// SampleConfig returns a basic configuration for the plugin
|
||||
func (m *Modbus) SampleConfig() string {
|
||||
configs := []Configuration{}
|
||||
cfgOriginal := m.ConfigurationOriginal
|
||||
cfgPerRequest := m.ConfigurationPerRequest
|
||||
configs = append(configs, &cfgOriginal, &cfgPerRequest)
|
||||
|
||||
totalConfig := sampleConfigStart
|
||||
for _, c := range configs {
|
||||
totalConfig += c.SampleConfigPart() + "\n"
|
||||
}
|
||||
totalConfig += "\n"
|
||||
totalConfig += sampleConfigEnd
|
||||
return totalConfig
|
||||
}
|
||||
|
||||
// Description returns a short description of what the plugin does
|
||||
func (m *Modbus) Description() string {
|
||||
return description
|
||||
}
|
||||
|
||||
func (m *Modbus) Init() error {
|
||||
//check device name
|
||||
if m.Name == "" {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package modbus
|
||||
|
||||
func (m *Modbus) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ All MongoDB server versions from 2.6 and higher are supported.
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Read metrics from one or many MongoDB servers
|
||||
[[inputs.mongodb]]
|
||||
## An array of URLs of the form:
|
||||
## "mongodb://" [user ":" pass "@"] host [ ":" port]
|
||||
|
|
|
|||
|
|
@ -38,49 +38,6 @@ type Ssl struct {
|
|||
CaCerts []string `toml:"cacerts" deprecated:"1.3.0;use 'tls_ca' instead"`
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## An array of URLs of the form:
|
||||
## "mongodb://" [user ":" pass "@"] host [ ":" port]
|
||||
## For example:
|
||||
## mongodb://user:auth_key@10.10.3.30:27017,
|
||||
## mongodb://10.10.3.33:18832,
|
||||
servers = ["mongodb://127.0.0.1:27017?connect=direct"]
|
||||
|
||||
## When true, collect cluster status
|
||||
## Note that the query that counts jumbo chunks triggers a COLLSCAN, which
|
||||
## may have an impact on performance.
|
||||
# gather_cluster_status = true
|
||||
|
||||
## When true, collect per database stats
|
||||
# gather_perdb_stats = false
|
||||
|
||||
## When true, collect per collection stats
|
||||
# gather_col_stats = false
|
||||
|
||||
## When true, collect usage statistics for each collection
|
||||
## (insert, update, queries, remove, getmore, commands etc...).
|
||||
# gather_top_stat = false
|
||||
|
||||
## List of db where collections stats are collected
|
||||
## If empty, all db are concerned
|
||||
# col_stats_dbs = ["local"]
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
`
|
||||
|
||||
func (m *MongoDB) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (*MongoDB) Description() string {
|
||||
return "Read metrics from one or many MongoDB servers"
|
||||
}
|
||||
|
||||
func (m *MongoDB) Init() error {
|
||||
var tlsConfig *tls.Config
|
||||
if m.Ssl.Enabled {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package mongodb
|
||||
|
||||
func (m *MongoDB) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ Minimum Version of Monit tested with is 5.16.
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Read metrics and status information about processes managed by Monit
|
||||
[[inputs.monit]]
|
||||
## Monit HTTPD address
|
||||
address = "http://127.0.0.1:2812"
|
||||
|
|
|
|||
|
|
@ -187,33 +187,6 @@ type Messagebody struct {
|
|||
Metrics []string `json:"metrics"`
|
||||
}
|
||||
|
||||
func (m *Monit) Description() string {
|
||||
return "Read metrics and status information about processes managed by Monit"
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## Monit HTTPD address
|
||||
address = "http://127.0.0.1:2812"
|
||||
|
||||
## Username and Password for Monit
|
||||
# username = ""
|
||||
# password = ""
|
||||
|
||||
## Amount of time allowed to complete the HTTP request
|
||||
# timeout = "5s"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
`
|
||||
|
||||
func (m *Monit) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (m *Monit) Init() error {
|
||||
tlsCfg, err := m.ClientConfig.TLSConfig()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package monit
|
||||
|
||||
func (m *Monit) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -85,81 +85,6 @@ type MQTTConsumer struct {
|
|||
cancel context.CancelFunc
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## Broker URLs for the MQTT server or cluster. To connect to multiple
|
||||
## clusters or standalone servers, use a separate plugin instance.
|
||||
## example: servers = ["tcp://localhost:1883"]
|
||||
## servers = ["ssl://localhost:1883"]
|
||||
## servers = ["ws://localhost:1883"]
|
||||
servers = ["tcp://127.0.0.1:1883"]
|
||||
## Topics that will be subscribed to.
|
||||
topics = [
|
||||
"telegraf/host01/cpu",
|
||||
"telegraf/+/mem",
|
||||
"sensors/#",
|
||||
]
|
||||
# topic_fields = "_/_/_/temperature"
|
||||
## The message topic will be stored in a tag specified by this value. If set
|
||||
## to the empty string no topic tag will be created.
|
||||
# topic_tag = "topic"
|
||||
## QoS policy for messages
|
||||
## 0 = at most once
|
||||
## 1 = at least once
|
||||
## 2 = exactly once
|
||||
##
|
||||
## When using a QoS of 1 or 2, you should enable persistent_session to allow
|
||||
## resuming unacknowledged messages.
|
||||
# qos = 0
|
||||
## Connection timeout for initial connection in seconds
|
||||
# connection_timeout = "30s"
|
||||
## Maximum messages to read from the broker that have not been written by an
|
||||
## output. For best throughput set based on the number of metrics within
|
||||
## each message and the size of the output's metric_batch_size.
|
||||
##
|
||||
## For example, if each message from the queue contains 10 metrics and the
|
||||
## output metric_batch_size is 1000, setting this to 100 will ensure that a
|
||||
## full batch is collected and the write is triggered immediately without
|
||||
## waiting until the next flush_interval.
|
||||
# max_undelivered_messages = 1000
|
||||
## Persistent session disables clearing of the client session on connection.
|
||||
## In order for this option to work you must also set client_id to identify
|
||||
## the client. To receive messages that arrived while the client is offline,
|
||||
## also set the qos option to 1 or 2 and don't forget to also set the QoS when
|
||||
## publishing.
|
||||
# persistent_session = false
|
||||
## If unset, a random client ID will be generated.
|
||||
# client_id = ""
|
||||
## Username and password to connect MQTT server.
|
||||
# username = "telegraf"
|
||||
# password = "metricsmetricsmetricsmetrics"
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
## Data format to consume.
|
||||
## Each data format has its own unique set of configuration options, read
|
||||
## more about them here:
|
||||
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
|
||||
data_format = "influx"
|
||||
## Enable extracting tag values from MQTT topics
|
||||
## _ denotes an ignored entry in the topic path
|
||||
## [[inputs.mqtt_consumer.topic_parsing]]
|
||||
## topic = ""
|
||||
## measurement = ""
|
||||
## tags = ""
|
||||
## fields = ""
|
||||
## [inputs.mqtt_consumer.topic_parsing.types]
|
||||
##
|
||||
`
|
||||
|
||||
func (m *MQTTConsumer) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
func (m *MQTTConsumer) Description() string {
|
||||
return "Read metrics from MQTT topic(s)"
|
||||
}
|
||||
func (m *MQTTConsumer) SetParser(parser parsers.Parser) {
|
||||
m.parser = parser
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package mqtt_consumer
|
||||
|
||||
func (m *MQTTConsumer) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ useful creating custom metrics from the `/sys` or `/proc` filesystems.
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Aggregates the contents of multiple files into a single point
|
||||
[[inputs.multifile]]
|
||||
## Base directory where telegraf will look for files.
|
||||
## Omit this option to use absolute paths.
|
||||
|
|
|
|||
|
|
@ -27,39 +27,6 @@ type File struct {
|
|||
Conversion string
|
||||
}
|
||||
|
||||
const sampleConfig = `
|
||||
## Base directory where telegraf will look for files.
|
||||
## Omit this option to use absolute paths.
|
||||
base_dir = "/sys/bus/i2c/devices/1-0076/iio:device0"
|
||||
|
||||
## If true, Telegraf discard all data when a single file can't be read.
|
||||
## Else, Telegraf omits the field generated from this file.
|
||||
# fail_early = true
|
||||
|
||||
## Files to parse each interval.
|
||||
[[inputs.multifile.file]]
|
||||
file = "in_pressure_input"
|
||||
dest = "pressure"
|
||||
conversion = "float"
|
||||
[[inputs.multifile.file]]
|
||||
file = "in_temp_input"
|
||||
dest = "temperature"
|
||||
conversion = "float(3)"
|
||||
[[inputs.multifile.file]]
|
||||
file = "in_humidityrelative_input"
|
||||
dest = "humidityrelative"
|
||||
conversion = "float(3)"
|
||||
`
|
||||
|
||||
// SampleConfig returns the default configuration of the Input
|
||||
func (m *MultiFile) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (m *MultiFile) Description() string {
|
||||
return "Aggregates the contents of multiple files into a single point"
|
||||
}
|
||||
|
||||
func (m *MultiFile) init() {
|
||||
if m.initialized {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package multifile
|
||||
|
||||
func (m *MultiFile) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -21,6 +21,7 @@ This plugin gathers the statistic data from MySQL server
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Read metrics from one or many mysql servers
|
||||
[[inputs.mysql]]
|
||||
## specify servers via a url matching:
|
||||
## [username[:password]@][protocol[(address)]]/[?tls=[true|false|skip-verify|custom]]
|
||||
|
|
@ -65,7 +66,7 @@ This plugin gathers the statistic data from MySQL server
|
|||
|
||||
## gather metrics from all channels from SHOW SLAVE STATUS command output
|
||||
# gather_all_slave_channels = false
|
||||
|
||||
|
||||
## gather metrics from SHOW SLAVE STATUS command output
|
||||
# gather_slave_status = false
|
||||
|
||||
|
|
|
|||
|
|
@ -52,105 +52,6 @@ type Mysql struct {
|
|||
getStatusQuery string
|
||||
}
|
||||
|
||||
const sampleConfig = `
|
||||
## specify servers via a url matching:
|
||||
## [username[:password]@][protocol[(address)]]/[?tls=[true|false|skip-verify|custom]]
|
||||
## see https://github.com/go-sql-driver/mysql#dsn-data-source-name
|
||||
## e.g.
|
||||
## servers = ["user:passwd@tcp(127.0.0.1:3306)/?tls=false"]
|
||||
## servers = ["user@tcp(127.0.0.1:3306)/?tls=false"]
|
||||
#
|
||||
## If no servers are specified, then localhost is used as the host.
|
||||
servers = ["tcp(127.0.0.1:3306)/"]
|
||||
|
||||
## Selects the metric output format.
|
||||
##
|
||||
## This option exists to maintain backwards compatibility, if you have
|
||||
## existing metrics do not set or change this value until you are ready to
|
||||
## migrate to the new format.
|
||||
##
|
||||
## If you do not have existing metrics from this plugin set to the latest
|
||||
## version.
|
||||
##
|
||||
## Telegraf >=1.6: metric_version = 2
|
||||
## <1.6: metric_version = 1 (or unset)
|
||||
metric_version = 2
|
||||
|
||||
## if the list is empty, then metrics are gathered from all database tables
|
||||
# table_schema_databases = []
|
||||
|
||||
## gather metrics from INFORMATION_SCHEMA.TABLES for databases provided above list
|
||||
# gather_table_schema = false
|
||||
|
||||
## gather thread state counts from INFORMATION_SCHEMA.PROCESSLIST
|
||||
# gather_process_list = false
|
||||
|
||||
## gather user statistics from INFORMATION_SCHEMA.USER_STATISTICS
|
||||
# gather_user_statistics = false
|
||||
|
||||
## gather auto_increment columns and max values from information schema
|
||||
# gather_info_schema_auto_inc = false
|
||||
|
||||
## gather metrics from INFORMATION_SCHEMA.INNODB_METRICS
|
||||
# gather_innodb_metrics = false
|
||||
|
||||
## gather metrics from SHOW SLAVE STATUS command output
|
||||
# gather_slave_status = false
|
||||
|
||||
## gather metrics from all channels from SHOW SLAVE STATUS command output
|
||||
# gather_all_slave_channels = false
|
||||
|
||||
## use MariaDB dialect for all channels SHOW SLAVE STATUS
|
||||
# mariadb_dialect = false
|
||||
|
||||
## gather metrics from SHOW BINARY LOGS command output
|
||||
# gather_binary_logs = false
|
||||
|
||||
## gather metrics from PERFORMANCE_SCHEMA.GLOBAL_VARIABLES
|
||||
# gather_global_variables = true
|
||||
|
||||
## gather metrics from PERFORMANCE_SCHEMA.TABLE_IO_WAITS_SUMMARY_BY_TABLE
|
||||
# gather_table_io_waits = false
|
||||
|
||||
## gather metrics from PERFORMANCE_SCHEMA.TABLE_LOCK_WAITS
|
||||
# gather_table_lock_waits = false
|
||||
|
||||
## gather metrics from PERFORMANCE_SCHEMA.TABLE_IO_WAITS_SUMMARY_BY_INDEX_USAGE
|
||||
# gather_index_io_waits = false
|
||||
|
||||
## gather metrics from PERFORMANCE_SCHEMA.EVENT_WAITS
|
||||
# gather_event_waits = false
|
||||
|
||||
## gather metrics from PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME
|
||||
# gather_file_events_stats = false
|
||||
|
||||
## gather metrics from PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_SUMMARY_BY_DIGEST
|
||||
# gather_perf_events_statements = false
|
||||
|
||||
## the limits for metrics form perf_events_statements
|
||||
# perf_events_statements_digest_text_limit = 120
|
||||
# perf_events_statements_limit = 250
|
||||
# perf_events_statements_time_limit = 86400
|
||||
|
||||
## gather metrics from PERFORMANCE_SCHEMA.EVENTS_STATEMENTS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME
|
||||
# gather_perf_sum_per_acc_per_event = false
|
||||
|
||||
## list of events to be gathered for gather_perf_sum_per_acc_per_event
|
||||
## in case of empty list all events will be gathered
|
||||
# perf_summary_events = []
|
||||
|
||||
## Some queries we may want to run less often (such as SHOW GLOBAL VARIABLES)
|
||||
## example: interval_slow = "30m"
|
||||
# interval_slow = ""
|
||||
|
||||
## Optional TLS Config (will be used if tls=custom parameter specified in server uri)
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
`
|
||||
|
||||
const (
|
||||
defaultPerfEventsStatementsDigestTextLimit = 120
|
||||
defaultPerfEventsStatementsLimit = 250
|
||||
|
|
@ -158,14 +59,6 @@ const (
|
|||
defaultGatherGlobalVars = true
|
||||
)
|
||||
|
||||
func (m *Mysql) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (m *Mysql) Description() string {
|
||||
return "Read metrics from one or many mysql servers"
|
||||
}
|
||||
|
||||
const localhost = ""
|
||||
|
||||
func (m *Mysql) InitMysql() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package mysql
|
||||
|
||||
func (m *Mysql) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ the NATS [monitoring http server](https://www.nats.io/documentation/server/gnats
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Provides metrics about the state of a NATS server
|
||||
[[inputs.nats]]
|
||||
## The address of the monitoring endpoint of the NATS server
|
||||
server = "http://localhost:8222"
|
||||
|
|
|
|||
|
|
@ -25,22 +25,6 @@ type Nats struct {
|
|||
client *http.Client
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## The address of the monitoring endpoint of the NATS server
|
||||
server = "http://localhost:8222"
|
||||
|
||||
## Maximum time to receive response
|
||||
# response_timeout = "5s"
|
||||
`
|
||||
|
||||
func (n *Nats) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (n *Nats) Description() string {
|
||||
return "Provides metrics about the state of a NATS server"
|
||||
}
|
||||
|
||||
func (n *Nats) Gather(acc telegraf.Accumulator) error {
|
||||
address, err := url.Parse(n.Server)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
//go:build !freebsd || (freebsd && cgo)
|
||||
// +build !freebsd freebsd,cgo
|
||||
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nats
|
||||
|
||||
func (n *Nats) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package natsconsumer
|
||||
package nats_consumer
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -64,63 +64,6 @@ type natsConsumer struct {
|
|||
cancel context.CancelFunc
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## urls of NATS servers
|
||||
servers = ["nats://localhost:4222"]
|
||||
|
||||
## subject(s) to consume
|
||||
subjects = ["telegraf"]
|
||||
|
||||
## name a queue group
|
||||
queue_group = "telegraf_consumers"
|
||||
|
||||
## Optional credentials
|
||||
# username = ""
|
||||
# password = ""
|
||||
|
||||
## Optional NATS 2.0 and NATS NGS compatible user credentials
|
||||
# credentials = "/etc/telegraf/nats.creds"
|
||||
|
||||
## Use Transport Layer Security
|
||||
# secure = false
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
|
||||
## Sets the limits for pending msgs and bytes for each subscription
|
||||
## These shouldn't need to be adjusted except in very high throughput scenarios
|
||||
# pending_message_limit = 65536
|
||||
# pending_bytes_limit = 67108864
|
||||
|
||||
## Maximum messages to read from the broker that have not been written by an
|
||||
## output. For best throughput set based on the number of metrics within
|
||||
## each message and the size of the output's metric_batch_size.
|
||||
##
|
||||
## For example, if each message from the queue contains 10 metrics and the
|
||||
## output metric_batch_size is 1000, setting this to 100 will ensure that a
|
||||
## full batch is collected and the write is triggered immediately without
|
||||
## waiting until the next flush_interval.
|
||||
# max_undelivered_messages = 1000
|
||||
|
||||
## Data format to consume.
|
||||
## Each data format has its own unique set of configuration options, read
|
||||
## more about them here:
|
||||
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
|
||||
data_format = "influx"
|
||||
`
|
||||
|
||||
func (n *natsConsumer) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (n *natsConsumer) Description() string {
|
||||
return "Read metrics from NATS subject(s)"
|
||||
}
|
||||
|
||||
func (n *natsConsumer) SetParser(parser parsers.Parser) {
|
||||
n.parser = parser
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nats_consumer
|
||||
|
||||
func (n *natsConsumer) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ The [Neptune Apex](https://www.neptunesystems.com/) input plugin collects real-t
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Neptune Apex data collector
|
||||
[[inputs.neptune_apex]]
|
||||
## The Neptune Apex plugin reads the publicly available status.xml data from a local Apex.
|
||||
## Measurements will be logged under "apex".
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Package neptuneapex implements an input plugin for the Neptune Apex
|
||||
// Package neptune_apex implements an input plugin for the Neptune Apex
|
||||
// aquarium controller.
|
||||
package neptuneapex
|
||||
package neptune_apex
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
|
@ -55,28 +55,6 @@ type NeptuneApex struct {
|
|||
httpClient *http.Client
|
||||
}
|
||||
|
||||
// Description implements telegraf.Input.Description
|
||||
func (*NeptuneApex) Description() string {
|
||||
return "Neptune Apex data collector"
|
||||
}
|
||||
|
||||
// SampleConfig implements telegraf.Input.SampleConfig
|
||||
func (*NeptuneApex) SampleConfig() string {
|
||||
return `
|
||||
## The Neptune Apex plugin reads the publicly available status.xml data from a local Apex.
|
||||
## Measurements will be logged under "apex".
|
||||
|
||||
## The base URL of the local Apex(es). If you specify more than one server, they will
|
||||
## be differentiated by the "source" tag.
|
||||
servers = [
|
||||
"http://apex.local",
|
||||
]
|
||||
|
||||
## The response_timeout specifies how long to wait for a reply from the Apex.
|
||||
#response_timeout = "5s"
|
||||
`
|
||||
}
|
||||
|
||||
// Gather implements telegraf.Input.Gather
|
||||
func (n *NeptuneApex) Gather(acc telegraf.Accumulator) error {
|
||||
var wg sync.WaitGroup
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package neptune_apex
|
||||
|
||||
func (*NeptuneApex) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package neptuneapex
|
||||
package neptune_apex
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
|
|||
|
|
@ -20,28 +20,6 @@ type NetIOStats struct {
|
|||
Interfaces []string
|
||||
}
|
||||
|
||||
func (n *NetIOStats) Description() string {
|
||||
return "Read metrics about network interface usage"
|
||||
}
|
||||
|
||||
var netSampleConfig = `
|
||||
## By default, telegraf gathers stats from any up interface (excluding loopback)
|
||||
## Setting interfaces will tell it to gather these explicit interfaces,
|
||||
## regardless of status.
|
||||
##
|
||||
# interfaces = ["eth0"]
|
||||
##
|
||||
## On linux systems telegraf also collects protocol stats.
|
||||
## Setting ignore_protocol_stats to true will skip reporting of protocol metrics.
|
||||
##
|
||||
# ignore_protocol_stats = false
|
||||
##
|
||||
`
|
||||
|
||||
func (n *NetIOStats) SampleConfig() string {
|
||||
return netSampleConfig
|
||||
}
|
||||
|
||||
func (n *NetIOStats) Gather(acc telegraf.Accumulator) error {
|
||||
netio, err := n.ps.NetIO()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package net
|
||||
|
||||
func (n *NetIOStats) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"syscall"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/telegraf/plugins/inputs/netstat"
|
||||
"github.com/influxdata/telegraf/plugins/inputs/system"
|
||||
"github.com/influxdata/telegraf/testutil"
|
||||
"github.com/shirou/gopsutil/v3/net"
|
||||
|
|
@ -88,7 +89,9 @@ func TestNetStats(t *testing.T) {
|
|||
|
||||
acc.Metrics = nil
|
||||
|
||||
err = (&NetStats{&mps}).Gather(&acc)
|
||||
err = (&netstat.NetStats{
|
||||
PS: &mps,
|
||||
}).Gather(&acc)
|
||||
require.NoError(t, err)
|
||||
|
||||
fields3 := map[string]interface{}{
|
||||
|
|
|
|||
|
|
@ -33,44 +33,6 @@ type NetResponse struct {
|
|||
Protocol string
|
||||
}
|
||||
|
||||
var description = "Collect response time of a TCP or UDP connection"
|
||||
|
||||
// Description will return a short string to explain what the plugin does.
|
||||
func (*NetResponse) Description() string {
|
||||
return description
|
||||
}
|
||||
|
||||
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 = "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"
|
||||
|
||||
## Uncomment to remove deprecated fields
|
||||
# fielddrop = ["result_type", "string_found"]
|
||||
`
|
||||
|
||||
// SampleConfig will return a complete configuration example with details about each field.
|
||||
func (*NetResponse) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
// TCPGather will execute if there are TCP tests defined in the configuration.
|
||||
// It will return a map[string]interface{} for fields and a map[string]string for tags
|
||||
func (n *NetResponse) TCPGather() (map[string]string, map[string]interface{}, error) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package net_response
|
||||
|
||||
func (*NetResponse) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -12,17 +12,6 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestSample(t *testing.T) {
|
||||
c := &NetResponse{}
|
||||
output := c.SampleConfig()
|
||||
require.Equal(t, output, sampleConfig, "Sample config doesn't match")
|
||||
}
|
||||
|
||||
func TestDescription(t *testing.T) {
|
||||
c := &NetResponse{}
|
||||
output := c.Description()
|
||||
require.Equal(t, output, description, "Description output is not correct")
|
||||
}
|
||||
func TestBadProtocol(t *testing.T) {
|
||||
var acc testutil.Accumulator
|
||||
// Init plugin
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ This plugin collects TCP connections state and UDP socket counts by using `lsof`
|
|||
## Configuration
|
||||
|
||||
``` toml
|
||||
# Collect TCP connections state and UDP socket counts
|
||||
# Read TCP metrics such as established, time wait and sockets counts.
|
||||
[[inputs.netstat]]
|
||||
# no configuration
|
||||
```
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package net
|
||||
package netstat
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
|
@ -10,21 +10,11 @@ import (
|
|||
)
|
||||
|
||||
type NetStats struct {
|
||||
ps system.PS
|
||||
}
|
||||
|
||||
func (ns *NetStats) Description() string {
|
||||
return "Read TCP metrics such as established, time wait and sockets counts."
|
||||
}
|
||||
|
||||
var tcpstatSampleConfig = ""
|
||||
|
||||
func (ns *NetStats) SampleConfig() string {
|
||||
return tcpstatSampleConfig
|
||||
PS system.PS
|
||||
}
|
||||
|
||||
func (ns *NetStats) Gather(acc telegraf.Accumulator) error {
|
||||
netconns, err := ns.ps.NetConnections()
|
||||
netconns, err := ns.PS.NetConnections()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting net connections info: %s", err)
|
||||
}
|
||||
|
|
@ -67,6 +57,6 @@ func (ns *NetStats) Gather(acc telegraf.Accumulator) error {
|
|||
|
||||
func init() {
|
||||
inputs.Add("netstat", func() telegraf.Input {
|
||||
return &NetStats{ps: system.NewSystemPS()}
|
||||
return &NetStats{PS: system.NewSystemPS()}
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package netstat
|
||||
|
||||
func (n *NetStats) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ If `fullstat` is set, a great deal of additional metrics are collected, detailed
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Read per-mount NFS client metrics from /proc/self/mountstats
|
||||
[[inputs.nfsclient]]
|
||||
## Read more low-level metrics (optional, defaults to false)
|
||||
# fullstat = false
|
||||
|
|
|
|||
|
|
@ -25,42 +25,6 @@ type NFSClient struct {
|
|||
mountstatsPath string
|
||||
}
|
||||
|
||||
const sampleConfig = `
|
||||
## Read more low-level metrics (optional, defaults to false)
|
||||
# fullstat = false
|
||||
|
||||
## List of mounts to explictly include or exclude (optional)
|
||||
## The pattern (Go regexp) is matched against the mount point (not the
|
||||
## device being mounted). If include_mounts is set, all mounts are ignored
|
||||
## unless present in the list. If a mount is listed in both include_mounts
|
||||
## and exclude_mounts, it is excluded. Go regexp patterns can be used.
|
||||
# include_mounts = []
|
||||
# exclude_mounts = []
|
||||
|
||||
## List of operations to include or exclude from collecting. This applies
|
||||
## only when fullstat=true. Symantics are similar to {include,exclude}_mounts:
|
||||
## the default is to collect everything; when include_operations is set, only
|
||||
## those OPs are collected; when exclude_operations is set, all are collected
|
||||
## except those listed. If include and exclude are set, the OP is excluded.
|
||||
## See /proc/self/mountstats for a list of valid operations; note that
|
||||
## NFSv3 and NFSv4 have different lists. While it is not possible to
|
||||
## have different include/exclude lists for NFSv3/4, unused elements
|
||||
## in the list should be okay. It is possible to have different lists
|
||||
## for different mountpoints: use mulitple [[input.nfsclient]] stanzas,
|
||||
## with their own lists. See "include_mounts" above, and be careful of
|
||||
## duplicate metrics.
|
||||
# include_operations = []
|
||||
# exclude_operations = []
|
||||
`
|
||||
|
||||
func (n *NFSClient) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (n *NFSClient) Description() string {
|
||||
return "Read per-mount NFS client metrics from /proc/self/mountstats"
|
||||
}
|
||||
|
||||
func convertToUint64(line []string) ([]uint64, error) {
|
||||
/* A "line" of input data (a pre-split array of strings) is
|
||||
processed one field at a time. Each field is converted to
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nfsclient
|
||||
|
||||
func (n *NFSClient) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -26,29 +26,6 @@ type Nginx struct {
|
|||
client *http.Client
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
# An array of Nginx stub_status URI to gather stats.
|
||||
urls = ["http://localhost/server_status"]
|
||||
|
||||
## Optional TLS Config
|
||||
tls_ca = "/etc/telegraf/ca.pem"
|
||||
tls_cert = "/etc/telegraf/cert.cer"
|
||||
tls_key = "/etc/telegraf/key.key"
|
||||
## Use TLS but skip chain & host verification
|
||||
insecure_skip_verify = false
|
||||
|
||||
# HTTP response timeout (default: 5s)
|
||||
response_timeout = "5s"
|
||||
`
|
||||
|
||||
func (n *Nginx) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (n *Nginx) Description() string {
|
||||
return "Read Nginx's basic status information (ngx_http_stub_status_module)"
|
||||
}
|
||||
|
||||
func (n *Nginx) Gather(acc telegraf.Accumulator) error {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nginx
|
||||
|
||||
func (n *Nginx) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -12,6 +12,16 @@ Structures for Nginx Plus have been built based on history of
|
|||
[[inputs.nginx_plus]]
|
||||
## An array of Nginx status URIs to gather stats.
|
||||
urls = ["http://localhost/status"]
|
||||
|
||||
# HTTP response timeout (default: 5s)
|
||||
response_timeout = "5s"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
```
|
||||
|
||||
## Measurements & Fields
|
||||
|
|
|
|||
|
|
@ -26,29 +26,6 @@ type NginxPlus struct {
|
|||
client *http.Client
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## An array of ngx_http_status_module or status URI to gather stats.
|
||||
urls = ["http://localhost/status"]
|
||||
|
||||
# HTTP response timeout (default: 5s)
|
||||
response_timeout = "5s"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
`
|
||||
|
||||
func (n *NginxPlus) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (n *NginxPlus) Description() string {
|
||||
return "Read Nginx Plus' full status information (ngx_http_status_module)"
|
||||
}
|
||||
|
||||
func (n *NginxPlus) Gather(acc telegraf.Accumulator) error {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nginx_plus
|
||||
|
||||
func (n *NginxPlus) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -11,6 +11,16 @@ Nginx Plus is a commercial version of the open source web server Nginx. The use
|
|||
urls = ["http://localhost/api"]
|
||||
# Nginx API version, default: 3
|
||||
# api_version = 3
|
||||
|
||||
# HTTP response timeout (default: 5s)
|
||||
response_timeout = "5s"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
```
|
||||
|
||||
## Migration from Nginx Plus (Status) input plugin
|
||||
|
|
|
|||
|
|
@ -43,32 +43,6 @@ const (
|
|||
streamUpstreamsPath = "stream/upstreams"
|
||||
)
|
||||
|
||||
var sampleConfig = `
|
||||
## An array of API URI to gather stats.
|
||||
urls = ["http://localhost/api"]
|
||||
|
||||
# Nginx API version, default: 3
|
||||
# api_version = 3
|
||||
|
||||
# HTTP response timeout (default: 5s)
|
||||
response_timeout = "5s"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
`
|
||||
|
||||
func (n *NginxPlusAPI) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (n *NginxPlusAPI) Description() string {
|
||||
return "Read Nginx Plus Api documentation"
|
||||
}
|
||||
|
||||
func (n *NginxPlusAPI) Gather(acc telegraf.Accumulator) error {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nginx_plus_api
|
||||
|
||||
func (n *NginxPlusAPI) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ Telegraf minimum version: Telegraf 1.15.0
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Read Nginx virtual host traffic status module information (nginx-module-sts)
|
||||
[[inputs.nginx_sts]]
|
||||
## An array of ngx_http_status_module or status URI to gather stats.
|
||||
urls = ["http://localhost/status"]
|
||||
|
|
|
|||
|
|
@ -25,29 +25,6 @@ type NginxSTS struct {
|
|||
client *http.Client
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## An array of ngx_http_status_module or status URI to gather stats.
|
||||
urls = ["http://localhost/status"]
|
||||
|
||||
## HTTP response timeout (default: 5s)
|
||||
response_timeout = "5s"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
`
|
||||
|
||||
func (n *NginxSTS) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (n *NginxSTS) Description() string {
|
||||
return "Read Nginx virtual host traffic status module information (nginx-module-sts)"
|
||||
}
|
||||
|
||||
func (n *NginxSTS) Gather(acc telegraf.Accumulator) error {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nginx_sts
|
||||
|
||||
func (n *NginxSTS) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -11,6 +11,8 @@ checks. This information can be exported in JSON format and parsed by this input
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Read nginx_upstream_check module status information (https://github.com/yaoweibin/nginx_upstream_check_module)
|
||||
[[inputs.nginx_upstream_check]]
|
||||
## An URL where Nginx Upstream check module is enabled
|
||||
## It should be set to return a JSON formatted response
|
||||
url = "http://127.0.0.1/status?format=json"
|
||||
|
|
|
|||
|
|
@ -15,37 +15,6 @@ import (
|
|||
"github.com/influxdata/telegraf/plugins/inputs"
|
||||
)
|
||||
|
||||
const sampleConfig = `
|
||||
## An URL where Nginx Upstream check module is enabled
|
||||
## It should be set to return a JSON formatted response
|
||||
url = "http://127.0.0.1/status?format=json"
|
||||
|
||||
## HTTP method
|
||||
# method = "GET"
|
||||
|
||||
## Optional HTTP headers
|
||||
# headers = {"X-Special-Header" = "Special-Value"}
|
||||
|
||||
## Override HTTP "Host" header
|
||||
# host_header = "check.example.com"
|
||||
|
||||
## Timeout for HTTP requests
|
||||
timeout = "5s"
|
||||
|
||||
## Optional HTTP Basic Auth credentials
|
||||
# username = "username"
|
||||
# password = "pa$$word"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
`
|
||||
|
||||
const description = "Read nginx_upstream_check module status information (https://github.com/yaoweibin/nginx_upstream_check_module)"
|
||||
|
||||
type NginxUpstreamCheck struct {
|
||||
URL string `toml:"url"`
|
||||
|
||||
|
|
@ -76,14 +45,6 @@ func init() {
|
|||
})
|
||||
}
|
||||
|
||||
func (check *NginxUpstreamCheck) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (check *NginxUpstreamCheck) Description() string {
|
||||
return description
|
||||
}
|
||||
|
||||
type NginxUpstreamCheckData struct {
|
||||
Servers struct {
|
||||
Total uint64 `json:"total"`
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nginx_upstream_check
|
||||
|
||||
func (check *NginxUpstreamCheck) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -6,10 +6,20 @@ For module configuration details please see its [documentation](https://github.c
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Read nginx status information using nginx-module-vts module
|
||||
# Read Nginx virtual host traffic status module information (nginx-module-vts)
|
||||
[[inputs.nginx_vts]]
|
||||
## An array of Nginx status URIs to gather stats.
|
||||
## An array of ngx_http_status_module or status URI to gather stats.
|
||||
urls = ["http://localhost/status"]
|
||||
|
||||
## HTTP response timeout (default: 5s)
|
||||
response_timeout = "5s"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
```
|
||||
|
||||
## Measurements & Fields
|
||||
|
|
|
|||
|
|
@ -25,29 +25,6 @@ type NginxVTS struct {
|
|||
client *http.Client
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## An array of ngx_http_status_module or status URI to gather stats.
|
||||
urls = ["http://localhost/status"]
|
||||
|
||||
## HTTP response timeout (default: 5s)
|
||||
response_timeout = "5s"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
`
|
||||
|
||||
func (n *NginxVTS) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (n *NginxVTS) Description() string {
|
||||
return "Read Nginx virtual host traffic status module information (nginx-module-vts)"
|
||||
}
|
||||
|
||||
func (n *NginxVTS) Gather(acc telegraf.Accumulator) error {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nginx_vts
|
||||
|
||||
func (n *NginxVTS) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ The Nomad plugin must grab metrics from every Nomad agent of the cluster. Telegr
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Read metrics from the Nomad API
|
||||
[[inputs.nomad]]
|
||||
## URL for the Nomad agent
|
||||
# url = "http://127.0.0.1:4646"
|
||||
|
|
|
|||
|
|
@ -25,19 +25,6 @@ type Nomad struct {
|
|||
|
||||
const timeLayout = "2006-01-02 15:04:05 -0700 MST"
|
||||
|
||||
var sampleConfig = `
|
||||
## URL for the Nomad agent
|
||||
# url = "http://127.0.0.1:4646"
|
||||
|
||||
## Set response_timeout (default 5 seconds)
|
||||
# response_timeout = "5s"
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = /path/to/cafile
|
||||
# tls_cert = /path/to/certfile
|
||||
# tls_key = /path/to/keyfile
|
||||
`
|
||||
|
||||
func init() {
|
||||
inputs.Add("nomad", func() telegraf.Input {
|
||||
return &Nomad{
|
||||
|
|
@ -46,16 +33,6 @@ func init() {
|
|||
})
|
||||
}
|
||||
|
||||
// SampleConfig returns a sample config
|
||||
func (n *Nomad) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
// Description returns a description of the plugin
|
||||
func (n *Nomad) Description() string {
|
||||
return "Read metrics from the Nomad API"
|
||||
}
|
||||
|
||||
func (n *Nomad) Init() error {
|
||||
if n.URL == "" {
|
||||
n.URL = "http://127.0.0.1:4646"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nomad
|
||||
|
||||
func (n *Nomad) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -32,34 +32,6 @@ type NSD struct {
|
|||
var defaultBinary = "/usr/sbin/nsd-control"
|
||||
var defaultTimeout = config.Duration(time.Second)
|
||||
|
||||
var sampleConfig = `
|
||||
## Address of server to connect to, optionally ':port'. Defaults to the
|
||||
## address in the nsd config file.
|
||||
server = "127.0.0.1:8953"
|
||||
|
||||
## If running as a restricted user you can prepend sudo for additional access:
|
||||
# use_sudo = false
|
||||
|
||||
## The default location of the nsd-control binary can be overridden with:
|
||||
# binary = "/usr/sbin/nsd-control"
|
||||
|
||||
## The default location of the nsd config file can be overridden with:
|
||||
# config_file = "/etc/nsd/nsd.conf"
|
||||
|
||||
## The default timeout of 1s can be overridden with:
|
||||
# timeout = "1s"
|
||||
`
|
||||
|
||||
// Description displays what this plugin is about
|
||||
func (s *NSD) Description() string {
|
||||
return "A plugin to collect stats from the NSD authoritative DNS name server"
|
||||
}
|
||||
|
||||
// SampleConfig displays configuration instructions
|
||||
func (s *NSD) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
// Shell out to nsd_stat and return the output
|
||||
func nsdRunner(cmdName string, timeout config.Duration, useSudo bool, server string, configFile string) (*bytes.Buffer, error) {
|
||||
cmdArgs := []string{"stats_noreset"}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nsd
|
||||
|
||||
func (s *NSD) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Description
|
||||
# Read NSQ topic and channel statistics.
|
||||
[[inputs.nsq]]
|
||||
## An array of NSQD HTTP API endpoints
|
||||
endpoints = ["http://localhost:4151"]
|
||||
|
|
|
|||
|
|
@ -44,18 +44,6 @@ type NSQ struct {
|
|||
httpClient *http.Client
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## An array of NSQD HTTP API endpoints
|
||||
endpoints = ["http://localhost:4151"]
|
||||
|
||||
## Optional TLS Config
|
||||
# tls_ca = "/etc/telegraf/ca.pem"
|
||||
# tls_cert = "/etc/telegraf/cert.pem"
|
||||
# tls_key = "/etc/telegraf/key.pem"
|
||||
## Use TLS but skip chain & host verification
|
||||
# insecure_skip_verify = false
|
||||
`
|
||||
|
||||
const (
|
||||
requestPattern = `%s/stats?format=json`
|
||||
)
|
||||
|
|
@ -70,14 +58,6 @@ func New() *NSQ {
|
|||
return &NSQ{}
|
||||
}
|
||||
|
||||
func (n *NSQ) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (n *NSQ) Description() string {
|
||||
return "Read NSQ topic and channel statistics."
|
||||
}
|
||||
|
||||
func (n *NSQ) Gather(acc telegraf.Accumulator) error {
|
||||
var err error
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nsq
|
||||
|
||||
func (n *NSQ) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -49,48 +49,11 @@ type NSQConsumer struct {
|
|||
cancel context.CancelFunc
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## An array representing the NSQD TCP HTTP Endpoints
|
||||
nsqd = ["localhost:4150"]
|
||||
|
||||
## An array representing the NSQLookupd HTTP Endpoints
|
||||
nsqlookupd = ["localhost:4161"]
|
||||
topic = "telegraf"
|
||||
channel = "consumer"
|
||||
max_in_flight = 100
|
||||
|
||||
## Maximum messages to read from the broker that have not been written by an
|
||||
## output. For best throughput set based on the number of metrics within
|
||||
## each message and the size of the output's metric_batch_size.
|
||||
##
|
||||
## For example, if each message from the queue contains 10 metrics and the
|
||||
## output metric_batch_size is 1000, setting this to 100 will ensure that a
|
||||
## full batch is collected and the write is triggered immediately without
|
||||
## waiting until the next flush_interval.
|
||||
# max_undelivered_messages = 1000
|
||||
|
||||
## Data format to consume.
|
||||
## Each data format has its own unique set of configuration options, read
|
||||
## more about them here:
|
||||
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
|
||||
data_format = "influx"
|
||||
`
|
||||
|
||||
// SetParser takes the data_format from the config and finds the right parser for that format
|
||||
func (n *NSQConsumer) SetParser(parser parsers.Parser) {
|
||||
n.parser = parser
|
||||
}
|
||||
|
||||
// SampleConfig returns config values for generating a sample configuration file
|
||||
func (n *NSQConsumer) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
// Description prints description string
|
||||
func (n *NSQConsumer) Description() string {
|
||||
return "Read NSQ topic for metrics."
|
||||
}
|
||||
|
||||
// Start pulls data from nsq
|
||||
func (n *NSQConsumer) Start(ac telegraf.Accumulator) error {
|
||||
acc := ac.WithTracking(n.MaxUndeliveredMessages)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nsq_consumer
|
||||
|
||||
func (n *NSQConsumer) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -30,14 +30,16 @@ So if nothing is given, no paths in config and in env vars, the plugin takes the
|
|||
The sample config file
|
||||
|
||||
```toml
|
||||
# Collect kernel snmp counters and network interface statistics
|
||||
[[inputs.nstat]]
|
||||
## file paths
|
||||
## e.g: /proc/net/netstat, /proc/net/snmp, /proc/net/snmp6
|
||||
# proc_net_netstat = ""
|
||||
# proc_net_snmp = ""
|
||||
# proc_net_snmp6 = ""
|
||||
## file paths for proc files. If empty default paths will be used:
|
||||
## /proc/net/netstat, /proc/net/snmp, /proc/net/snmp6
|
||||
## These can also be overridden with env variables, see README.
|
||||
proc_net_netstat = "/proc/net/netstat"
|
||||
proc_net_snmp = "/proc/net/snmp"
|
||||
proc_net_snmp6 = "/proc/net/snmp6"
|
||||
## dump metrics with 0 values too
|
||||
# dump_zeros = true
|
||||
dump_zeros = true
|
||||
```
|
||||
|
||||
In case that `proc_net_snmp6` path doesn't exist (e.g. IPv6 is not enabled) no error would be raised.
|
||||
|
|
|
|||
|
|
@ -38,25 +38,6 @@ type Nstat struct {
|
|||
DumpZeros bool `toml:"dump_zeros"`
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
## file paths for proc files. If empty default paths will be used:
|
||||
## /proc/net/netstat, /proc/net/snmp, /proc/net/snmp6
|
||||
## These can also be overridden with env variables, see README.
|
||||
proc_net_netstat = "/proc/net/netstat"
|
||||
proc_net_snmp = "/proc/net/snmp"
|
||||
proc_net_snmp6 = "/proc/net/snmp6"
|
||||
## dump metrics with 0 values too
|
||||
dump_zeros = true
|
||||
`
|
||||
|
||||
func (ns *Nstat) Description() string {
|
||||
return "Collect kernel snmp counters and network interface statistics"
|
||||
}
|
||||
|
||||
func (ns *Nstat) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (ns *Nstat) Gather(acc telegraf.Accumulator) error {
|
||||
// load paths, get from env if config values are empty
|
||||
ns.loadPaths()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nstat
|
||||
|
||||
func (ns *Nstat) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -27,9 +27,9 @@ server (RMS of difference of multiple time samples, milliseconds);
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Get standard NTP query metrics, requires ntpq executable
|
||||
# Get standard NTP query metrics, requires ntpq executable.
|
||||
[[inputs.ntpq]]
|
||||
## If false, add -n for ntpq command. Can reduce metric gather times.
|
||||
## If false, set the -n ntpq flag. Can reduce metric gather time.
|
||||
dns_lookup = true
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -30,17 +30,6 @@ type NTPQ struct {
|
|||
DNSLookup bool `toml:"dns_lookup"`
|
||||
}
|
||||
|
||||
func (n *NTPQ) Description() string {
|
||||
return "Get standard NTP query metrics, requires ntpq executable."
|
||||
}
|
||||
|
||||
func (n *NTPQ) SampleConfig() string {
|
||||
return `
|
||||
## If false, set the -n ntpq flag. Can reduce metric gather time.
|
||||
dns_lookup = true
|
||||
`
|
||||
}
|
||||
|
||||
func (n *NTPQ) Gather(acc telegraf.Accumulator) error {
|
||||
out, err := n.runQ()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package ntpq
|
||||
|
||||
func (n *NTPQ) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -23,24 +23,6 @@ type NvidiaSMI struct {
|
|||
Timeout config.Duration
|
||||
}
|
||||
|
||||
// Description returns the description of the NvidiaSMI plugin
|
||||
func (smi *NvidiaSMI) Description() string {
|
||||
return "Pulls statistics from nvidia GPUs attached to the host"
|
||||
}
|
||||
|
||||
// SampleConfig returns the sample configuration for the NvidiaSMI plugin
|
||||
func (smi *NvidiaSMI) SampleConfig() string {
|
||||
return `
|
||||
## Optional: path to nvidia-smi binary, defaults "/usr/bin/nvidia-smi"
|
||||
## We will first try to locate the nvidia-smi binary with the explicitly specified value (or default value),
|
||||
## if it is not found, we will try to locate it on PATH(exec.LookPath), if it is still not found, an error will be returned
|
||||
# bin_path = "/usr/bin/nvidia-smi"
|
||||
|
||||
## Optional: timeout for GPU polling
|
||||
# timeout = "5s"
|
||||
`
|
||||
}
|
||||
|
||||
func (smi *NvidiaSMI) Init() error {
|
||||
if _, err := os.Stat(smi.BinPath); os.IsNotExist(err) {
|
||||
binPath, err := exec.LookPath("nvidia-smi")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
||||
package nvidia_smi
|
||||
|
||||
func (smi *NvidiaSMI) SampleConfig() string {
|
||||
return `{{ .SampleConfig }}`
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ Plugin minimum tested version: 1.16
|
|||
## Configuration
|
||||
|
||||
```toml
|
||||
# Retrieve data from OPCUA devices
|
||||
[[inputs.opcua]]
|
||||
## Metric name
|
||||
# name = "opcua"
|
||||
|
|
@ -89,7 +90,7 @@ Plugin minimum tested version: 1.16
|
|||
# {name="", namespace="", identifier_type="", identifier=""},
|
||||
# {name="", namespace="", identifier_type="", identifier=""},
|
||||
#]
|
||||
|
||||
|
||||
## Enable workarounds required by some devices to work correctly
|
||||
# [inputs.opcua.workarounds]
|
||||
## Set additional valid status codes, StatusOK (0x0) is always considered valid
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package opcua_client
|
||||
package opcua
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -106,104 +106,6 @@ const (
|
|||
Connected
|
||||
)
|
||||
|
||||
const description = `Retrieve data from OPCUA devices`
|
||||
const sampleConfig = `
|
||||
## Metric name
|
||||
# name = "opcua"
|
||||
#
|
||||
## OPC UA Endpoint URL
|
||||
# endpoint = "opc.tcp://localhost:4840"
|
||||
#
|
||||
## Maximum time allowed to establish a connect to the endpoint.
|
||||
# connect_timeout = "10s"
|
||||
#
|
||||
## Maximum time allowed for a request over the estabilished connection.
|
||||
# request_timeout = "5s"
|
||||
#
|
||||
## Security policy, one of "None", "Basic128Rsa15", "Basic256",
|
||||
## "Basic256Sha256", or "auto"
|
||||
# security_policy = "auto"
|
||||
#
|
||||
## Security mode, one of "None", "Sign", "SignAndEncrypt", or "auto"
|
||||
# security_mode = "auto"
|
||||
#
|
||||
## Path to cert.pem. Required when security mode or policy isn't "None".
|
||||
## If cert path is not supplied, self-signed cert and key will be generated.
|
||||
# certificate = "/etc/telegraf/cert.pem"
|
||||
#
|
||||
## Path to private key.pem. Required when security mode or policy isn't "None".
|
||||
## If key path is not supplied, self-signed cert and key will be generated.
|
||||
# private_key = "/etc/telegraf/key.pem"
|
||||
#
|
||||
## Authentication Method, one of "Certificate", "UserName", or "Anonymous". To
|
||||
## authenticate using a specific ID, select 'Certificate' or 'UserName'
|
||||
# auth_method = "Anonymous"
|
||||
#
|
||||
## Username. Required for auth_method = "UserName"
|
||||
# username = ""
|
||||
#
|
||||
## Password. Required for auth_method = "UserName"
|
||||
# password = ""
|
||||
#
|
||||
## Option to select the metric timestamp to use. Valid options are:
|
||||
## "gather" -- uses the time of receiving the data in telegraf
|
||||
## "server" -- uses the timestamp provided by the server
|
||||
## "source" -- uses the timestamp provided by the source
|
||||
# timestamp = "gather"
|
||||
#
|
||||
## Node ID configuration
|
||||
## name - field name to use in the output
|
||||
## namespace - OPC UA namespace of the node (integer value 0 thru 3)
|
||||
## identifier_type - OPC UA ID type (s=string, i=numeric, g=guid, b=opaque)
|
||||
## identifier - OPC UA ID (tag as shown in opcua browser)
|
||||
## Example:
|
||||
## {name="ProductUri", namespace="0", identifier_type="i", identifier="2262"}
|
||||
# nodes = [
|
||||
# {name="", namespace="", identifier_type="", identifier=""},
|
||||
# {name="", namespace="", identifier_type="", identifier=""},
|
||||
#]
|
||||
#
|
||||
## Node Group
|
||||
## Sets defaults for OPC UA namespace and ID type so they aren't required in
|
||||
## every node. A group can also have a metric name that overrides the main
|
||||
## plugin metric name.
|
||||
##
|
||||
## Multiple node groups are allowed
|
||||
#[[inputs.opcua.group]]
|
||||
## Group Metric name. Overrides the top level name. If unset, the
|
||||
## top level name is used.
|
||||
# name =
|
||||
#
|
||||
## Group default namespace. If a node in the group doesn't set its
|
||||
## namespace, this is used.
|
||||
# namespace =
|
||||
#
|
||||
## Group default identifier type. If a node in the group doesn't set its
|
||||
## namespace, this is used.
|
||||
# identifier_type =
|
||||
#
|
||||
## Node ID Configuration. Array of nodes with the same settings as above.
|
||||
# nodes = [
|
||||
# {name="", namespace="", identifier_type="", identifier=""},
|
||||
# {name="", namespace="", identifier_type="", identifier=""},
|
||||
#]
|
||||
|
||||
## Enable workarounds required by some devices to work correctly
|
||||
# [inputs.opcua.workarounds]
|
||||
## Set additional valid status codes, StatusOK (0x0) is always considered valid
|
||||
# additional_valid_status_codes = ["0xC0"]
|
||||
`
|
||||
|
||||
// Description will appear directly above the plugin definition in the config file
|
||||
func (o *OpcUA) Description() string {
|
||||
return description
|
||||
}
|
||||
|
||||
// SampleConfig will populate the sample configuration portion of the plugin's configuration
|
||||
func (o *OpcUA) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
// Init will initialize all tags
|
||||
func (o *OpcUA) Init() error {
|
||||
o.state = Disconnected
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue