chore: Embed sample configurations into README for inputs (#11136)

This commit is contained in:
Sven Rebhan 2022-05-24 15:49:47 +02:00 committed by GitHub
parent a840006e58
commit 56eb914998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
677 changed files with 3164 additions and 2422 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
/telegraf
/telegraf.exe
/telegraf.gz
/tools/readme_config_includer/generator
/vendor
.DS_Store
process.yml

View File

@ -115,13 +115,22 @@ versioninfo:
go run scripts/generate_versioninfo/main.go; \
go generate cmd/telegraf/telegraf_windows.go; \
.PHONY: build_generator
build_generator:
go build -o ./tools/readme_config_includer/generator ./tools/readme_config_includer/generator.go
insert_config_to_readme_%: build_generator
go generate -run="readme_config_includer/generator$$" ./plugins/$*/...
generate_plugins_%: build_generator
go generate -run="plugindata/main.go$$" ./plugins/$*/...
.PHONY: generate
generate:
go generate -run="plugindata/main.go$$" ./plugins/inputs/... ./plugins/outputs/... ./plugins/processors/... ./plugins/aggregators/...
generate: insert_config_to_readme_inputs generate_plugins_outputs generate_plugins_processors generate_plugins_aggregators
.PHONY: generate-clean
generate-clean:
go generate -run="plugindata/main.go --clean" ./plugins/inputs/... ./plugins/outputs/... ./plugins/processors/... ./plugins/aggregators/...
go generate -run="plugindata/main.go --clean" ./plugins/outputs/... ./plugins/processors/... ./plugins/aggregators/...
.PHONY: build
build:
@ -223,6 +232,8 @@ clean:
rm -f telegraf
rm -f telegraf.exe
rm -rf build
rm -rf tools/readme_config_includer/generator
rm -rf tools/readme_config_includer/generator.exe
.PHONY: docker-image
docker-image:

View File

@ -539,7 +539,7 @@ The inverse of `tagpass`. If a match is found the metric is discarded. This
is tested on metrics after they have passed the `tagpass` test.
> NOTE: Due to the way TOML is parsed, `tagpass` and `tagdrop` parameters must be
defined at the *_end_* of the plugin definition, otherwise subsequent plugin config
defined at the **end** of the plugin definition, otherwise subsequent plugin config
options will be interpreted as part of the tagpass/tagdrop tables.
### Modifiers

View File

@ -4,7 +4,7 @@ This plugin gather queues, topics & subscribers metrics using ActiveMQ Console A
## Configuration
```toml
```toml @sample.conf
# Gather ActiveMQ metrics
[[inputs.activemq]]
## ActiveMQ WebConsole URL

View File

@ -1,6 +1,8 @@
//go:generate ../../../tools/readme_config_includer/generator
package activemq
import (
_ "embed"
"encoding/xml"
"fmt"
"io"
@ -17,6 +19,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type ActiveMQ struct {
Server string `toml:"server" deprecated:"1.11.0;use 'url' instead"`
Port int `toml:"port" deprecated:"1.11.0;use 'url' instead"`
@ -98,6 +104,10 @@ func (a *ActiveMQ) createHTTPClient() (*http.Client, error) {
return client, nil
}
func (*ActiveMQ) SampleConfig() string {
return sampleConfig
}
func (a *ActiveMQ) Init() error {
if a.ResponseTimeout < config.Duration(time.Second) {
a.ResponseTimeout = config.Duration(time.Second * 5)

View File

@ -1,8 +0,0 @@
//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 activemq
func (a *ActiveMQ) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -11,7 +11,7 @@ All metrics are attempted to be cast to integers, then booleans, then strings.
## Configuration
```toml
```toml @sample.conf
# Read stats from aerospike server(s)
[[inputs.aerospike]]
## Aerospike servers to connect to (with port)

View File

@ -1,7 +1,9 @@
//go:generate ../../../tools/readme_config_includer/generator
package aerospike
import (
"crypto/tls"
_ "embed"
"fmt"
"math"
"strconv"
@ -16,6 +18,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type Aerospike struct {
Servers []string `toml:"servers"`
@ -50,6 +56,10 @@ var protectedHexFields = map[string]bool{
"paxos_principal": true,
}
func (*Aerospike) SampleConfig() string {
return sampleConfig
}
func (a *Aerospike) Gather(acc telegraf.Accumulator) error {
if !a.initialized {
tlsConfig, err := a.ClientConfig.TLSConfig()

View File

@ -1,8 +0,0 @@
//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 aerospike
func (a *Aerospike) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -19,7 +19,7 @@ In the following order the plugin will attempt to authenticate.
## Configuration
```toml
```toml @sample.conf
# Pull Metric Statistics from Aliyun CMS
[[inputs.aliyuncms]]
## Aliyun Credentials

View File

@ -1,6 +1,8 @@
//go:generate ../../../tools/readme_config_includer/generator
package aliyuncms
import (
_ "embed"
"encoding/json"
"fmt"
"strconv"
@ -11,15 +13,20 @@ import (
"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/providers"
"github.com/aliyun/alibaba-cloud-sdk-go/services/cms"
"github.com/jmespath/go-jmespath"
"github.com/pkg/errors"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/config"
"github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/internal/limiter"
"github.com/influxdata/telegraf/plugins/inputs"
"github.com/jmespath/go-jmespath"
"github.com/pkg/errors"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type (
// AliyunCMS is aliyun cms config info.
AliyunCMS struct {
@ -103,6 +110,10 @@ var aliyunRegionList = []string{
"me-east-1",
}
func (*AliyunCMS) SampleConfig() string {
return sampleConfig
}
// Init perform checks of plugin inputs and initialize internals
func (s *AliyunCMS) Init() error {
if s.Project == "" {

View File

@ -1,8 +0,0 @@
//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 aliyuncms
func (s *AliyunCMS) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -4,7 +4,7 @@ This plugin uses a query on the [`rocm-smi`](https://github.com/RadeonOpenComput
## Configuration
```toml
```toml @sample.conf
# Query statistics from AMD Graphics cards using rocm-smi binary
[[inputs.amd_rocm_smi]]
## Optional: path to rocm-smi binary, defaults to $PATH via exec.LookPath

View File

@ -1,6 +1,8 @@
//go:generate ../../../tools/readme_config_includer/generator
package amd_rocm_smi
import (
_ "embed"
"encoding/json"
"fmt"
"os"
@ -15,6 +17,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
const measurement = "amd_rocm_smi"
type ROCmSMI struct {
@ -22,6 +28,10 @@ type ROCmSMI struct {
Timeout config.Duration
}
func (*ROCmSMI) SampleConfig() string {
return sampleConfig
}
// Gather implements the telegraf interface
func (rsmi *ROCmSMI) Gather(acc telegraf.Accumulator) error {
if _, err := os.Stat(rsmi.BinPath); os.IsNotExist(err) {

View File

@ -1,8 +0,0 @@
//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 amd_rocm_smi
func (rsmi *ROCmSMI) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -15,7 +15,7 @@ For an introduction to AMQP see:
The following defaults are known to work with RabbitMQ:
```toml
```toml @sample.conf
# AMQP consumer plugin
[[inputs.amqp_consumer]]
## Brokers to consume from. If multiple brokers are specified a random broker

View File

@ -1,7 +1,9 @@
//go:generate ../../../tools/readme_config_includer/generator
package amqp_consumer
import (
"context"
_ "embed"
"errors"
"fmt"
"math/rand"
@ -18,6 +20,10 @@ import (
"github.com/influxdata/telegraf/plugins/parsers"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
const (
defaultMaxUndeliveredMessages = 1000
)
@ -88,6 +94,10 @@ const (
DefaultPrefetchCount = 50
)
func (*AMQPConsumer) SampleConfig() string {
return sampleConfig
}
func (a *AMQPConsumer) SetParser(parser parsers.Parser) {
a.parser = parser
}

View File

@ -1,8 +0,0 @@
//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 amqp_consumer
func (a *AMQPConsumer) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -6,7 +6,7 @@ Typically, the `mod_status` module is configured to expose a page at the `/serve
## Configuration
```toml
```toml @sample.conf
# Read Apache status information (mod_status)
[[inputs.apache]]
## An array of URLs to gather from, must be directed at the machine

View File

@ -1,7 +1,9 @@
//go:generate ../../../tools/readme_config_includer/generator
package apache
import (
"bufio"
_ "embed"
"fmt"
"net"
"net/http"
@ -17,6 +19,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type Apache struct {
Urls []string
Username string
@ -27,6 +33,10 @@ type Apache struct {
client *http.Client
}
func (*Apache) SampleConfig() string {
return sampleConfig
}
func (n *Apache) Gather(acc telegraf.Accumulator) error {
var wg sync.WaitGroup

View File

@ -1,8 +0,0 @@
//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 apache
func (n *Apache) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -8,7 +8,7 @@ apcupsd should be installed and it's daemon should be running.
## Configuration
```toml
```toml @sample.conf
# Monitor APC UPSes connected to apcupsd
[[inputs.apcupsd]]
# A list of running apcupsd server to connect to.

View File

@ -1,7 +1,9 @@
//go:generate ../../../tools/readme_config_includer/generator
package apcupsd
import (
"context"
_ "embed"
"net/url"
"strconv"
"strings"
@ -14,6 +16,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
const defaultAddress = "tcp://127.0.0.1:3551"
var defaultTimeout = config.Duration(5 * time.Second)
@ -23,6 +29,10 @@ type ApcUpsd struct {
Timeout config.Duration
}
func (*ApcUpsd) SampleConfig() string {
return sampleConfig
}
func (h *ApcUpsd) Gather(acc telegraf.Accumulator) error {
ctx := context.Background()

View File

@ -1,8 +0,0 @@
//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 apcupsd
func (*ApcUpsd) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -6,7 +6,7 @@ For monitoring recommendations reference [Monitoring your Aurora cluster](https:
## Configuration
```toml
```toml @sample.conf
# Gather metrics from Apache Aurora schedulers
[[inputs.aurora]]
## Schedulers are the base addresses of your Aurora Schedulers

View File

@ -1,7 +1,9 @@
//go:generate ../../../tools/readme_config_includer/generator
package aurora
import (
"context"
_ "embed"
"encoding/json"
"fmt"
"net/http"
@ -16,6 +18,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type RoleType int
const (
@ -54,6 +60,10 @@ type Aurora struct {
urls []*url.URL
}
func (*Aurora) SampleConfig() string {
return sampleConfig
}
func (a *Aurora) Gather(acc telegraf.Accumulator) error {
if a.client == nil {
err := a.initialize()

View File

@ -1,8 +0,0 @@
//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 aurora
func (a *Aurora) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -4,7 +4,7 @@ This plugin gathers sizes of Azure Storage Queues.
## Configuration
```toml
```toml @sample.conf
# Gather Azure Storage Queue metrics
[[inputs.azure_storage_queue]]
## Required Azure Storage Account name

View File

@ -1,17 +1,24 @@
//go:generate ../../../tools/readme_config_includer/generator
package azure_storage_queue
import (
"context"
_ "embed"
"errors"
"net/url"
"strings"
"time"
"github.com/Azure/azure-storage-queue-go/azqueue"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type AzureStorageQueue struct {
StorageAccountName string `toml:"account_name"`
StorageAccountKey string `toml:"account_key"`
@ -21,6 +28,10 @@ type AzureStorageQueue struct {
serviceURL *azqueue.ServiceURL
}
func (*AzureStorageQueue) SampleConfig() string {
return sampleConfig
}
func (a *AzureStorageQueue) Init() error {
if a.StorageAccountName == "" {
return errors.New("account_name must be configured")

View File

@ -1,8 +0,0 @@
//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 azure_storage_queue
func (a *AzureStorageQueue) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -55,7 +55,7 @@ cache_readaheads
Using this configuration:
```toml
```toml @sample.conf
# Read metrics of bcache from stats_total and dirty_data
[[inputs.bcache]]
## Bcache sets path

View File

@ -1,3 +1,4 @@
//go:generate ../../../tools/readme_config_includer/generator
//go:build !windows
// +build !windows
@ -6,6 +7,7 @@
package bcache
import (
_ "embed"
"errors"
"fmt"
"os"
@ -17,6 +19,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type Bcache struct {
BcachePath string
BcacheDevs []string
@ -94,6 +100,10 @@ func (b *Bcache) gatherBcache(bdev string, acc telegraf.Accumulator) error {
return nil
}
func (*Bcache) SampleConfig() string {
return sampleConfig
}
func (b *Bcache) Gather(acc telegraf.Accumulator) error {
bcacheDevsChecked := make(map[string]bool)
var restrictDevs bool

View File

@ -1,11 +0,0 @@
//go:build !windows
// +build !windows
//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 bcache
func (b *Bcache) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -4,7 +4,7 @@ The `beanstalkd` plugin collects server stats as well as tube stats (reported by
## Configuration
```toml
```toml @sample.conf
# Collects Beanstalkd server and tubes stats
[[inputs.beanstalkd]]
## Server to collect data from

View File

@ -1,21 +1,32 @@
//go:generate ../../../tools/readme_config_includer/generator
package beanstalkd
import (
_ "embed"
"fmt"
"io"
"net/textproto"
"sync"
"gopkg.in/yaml.v2"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
"gopkg.in/yaml.v2"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type Beanstalkd struct {
Server string `toml:"server"`
Tubes []string `toml:"tubes"`
}
func (*Beanstalkd) SampleConfig() string {
return sampleConfig
}
func (b *Beanstalkd) Gather(acc telegraf.Accumulator) error {
connection, err := textproto.Dial("tcp", b.Server)
if err != nil {

View File

@ -1,8 +0,0 @@
//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 beanstalkd
func (b *Beanstalkd) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -5,7 +5,7 @@ known to work with Filebeat and Kafkabeat.
## Configuration
```toml
```toml @sample.conf
# Read metrics exposed by Beat
[[inputs.beat]]
## An URL from which to read Beat-formatted JSON

View File

@ -1,6 +1,8 @@
//go:generate ../../../tools/readme_config_includer/generator
package beat
import (
_ "embed"
"encoding/json"
"fmt"
"net/http"
@ -15,6 +17,10 @@ import (
jsonparser "github.com/influxdata/telegraf/plugins/parsers/json"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
const suffixInfo = "/"
const suffixStats = "/stats"
@ -59,6 +65,10 @@ func NewBeat() *Beat {
}
}
func (*Beat) SampleConfig() string {
return sampleConfig
}
func (beat *Beat) Init() error {
availableStats := []string{"beat", "libbeat", "system", "filebeat"}

View File

@ -1,8 +0,0 @@
//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 beat
func (beat *Beat) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -16,7 +16,7 @@ not enable support for JSON statistics in their BIND packages.
## Configuration
```toml
```toml @sample.conf
# Read BIND nameserver XML statistics
[[inputs.bind]]
## An array of BIND XML statistics URI to gather stats.

View File

@ -1,6 +1,8 @@
//go:generate ../../../tools/readme_config_includer/generator
package bind
import (
_ "embed"
"fmt"
"net/http"
"net/url"
@ -12,6 +14,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type Bind struct {
Urls []string
GatherMemoryContexts bool
@ -21,6 +27,10 @@ type Bind struct {
client http.Client
}
func (*Bind) SampleConfig() string {
return sampleConfig
}
func (b *Bind) Init() error {
b.client = http.Client{
Timeout: time.Duration(b.Timeout),

View File

@ -1,8 +0,0 @@
//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 bind
func (b *Bind) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -6,7 +6,7 @@ The plugin collects these metrics from `/proc/net/bonding/*` files.
## Configuration
```toml
```toml @sample.conf
# Collect bond interface status, slaves statuses and failures count
[[inputs.bond]]
## Sets 'proc' directory path

View File

@ -1,7 +1,9 @@
//go:generate ../../../tools/readme_config_includer/generator
package bond
import (
"bufio"
_ "embed"
"fmt"
"os"
"path/filepath"
@ -12,6 +14,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
// default host proc path
const defaultHostProc = "/proc"
const defaultHostSys = "/sys"
@ -34,6 +40,10 @@ type sysFiles struct {
ADPortsFile string
}
func (*Bond) SampleConfig() string {
return sampleConfig
}
func (bond *Bond) Gather(acc telegraf.Accumulator) error {
// load proc path, get default value if config value and env variable are empty
bond.loadPaths()

View File

@ -1,8 +0,0 @@
//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 bond
func (bond *Bond) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -7,7 +7,7 @@ Supported Burrow version: `1.x`
## Configuration
```toml
```toml @sample.conf
# Collect Kafka topics and consumers status from Burrow HTTP API.
[[inputs.burrow]]
## Burrow API endpoints in format "schema://host:port".

View File

@ -1,6 +1,8 @@
//go:generate ../../../tools/readme_config_includer/generator
package burrow
import (
_ "embed"
"encoding/json"
"fmt"
"net"
@ -18,6 +20,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
const (
defaultBurrowPrefix = "/v3/kafka"
defaultConcurrentConnections = 20
@ -92,6 +98,10 @@ func init() {
})
}
func (*burrow) SampleConfig() string {
return sampleConfig
}
func (b *burrow) Gather(acc telegraf.Accumulator) error {
var wg sync.WaitGroup

View File

@ -1,8 +0,0 @@
//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 burrow
func (b *burrow) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -20,7 +20,7 @@ Cassandra plugin produces one or more measurements for each metric configured, a
## Configuration
```toml
```toml @sample.conf
# Read Cassandra metrics through Jolokia
[[inputs.cassandra]]
## DEPRECATED: The cassandra plugin has been deprecated. Please use the

View File

@ -1,6 +1,8 @@
//go:generate ../../../tools/readme_config_includer/generator
package cassandra
import (
_ "embed"
"encoding/json"
"errors"
"fmt"
@ -13,6 +15,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type JolokiaClient interface {
MakeRequest(req *http.Request) (*http.Response, error)
}
@ -228,6 +234,10 @@ func parseServerTokens(server string) map[string]string {
return serverTokens
}
func (*Cassandra) SampleConfig() string {
return sampleConfig
}
func (c *Cassandra) Start(_ telegraf.Accumulator) error {
c.Log.Warn("DEPRECATED: The cassandra plugin has been deprecated. " +
"Please use the jolokia2 plugin instead. " +

View File

@ -1,8 +0,0 @@
//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 cassandra
func (c *Cassandra) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -43,7 +43,7 @@ the cluster. The currently supported commands are:
## Configuration
```toml
```toml @sample.conf
# Collects performance metrics from the MON, OSD, MDS and RGW nodes in a Ceph storage cluster.
[[inputs.ceph]]
## This is the recommended interval to poll. Too frequent and you will lose

View File

@ -1,7 +1,9 @@
//go:generate ../../../tools/readme_config_includer/generator
package ceph
import (
"bytes"
_ "embed"
"encoding/json"
"fmt"
"os"
@ -13,6 +15,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
const (
measurement = "ceph"
typeMon = "monitor"
@ -42,6 +48,10 @@ type Ceph struct {
Log telegraf.Logger `toml:"-"`
}
func (*Ceph) SampleConfig() string {
return sampleConfig
}
func (c *Ceph) Gather(acc telegraf.Accumulator) error {
if c.GatherAdminSocketStats {
if err := c.gatherAdminSocketStats(acc); err != nil {
@ -110,21 +120,21 @@ func (c *Ceph) gatherClusterStats(acc telegraf.Accumulator) error {
}
func init() {
c := Ceph{
CephBinary: "/usr/bin/ceph",
OsdPrefix: osdPrefix,
MonPrefix: monPrefix,
MdsPrefix: mdsPrefix,
RgwPrefix: rgwPrefix,
SocketDir: "/var/run/ceph",
SocketSuffix: sockSuffix,
CephUser: "client.admin",
CephConfig: "/etc/ceph/ceph.conf",
GatherAdminSocketStats: true,
GatherClusterStats: false,
}
inputs.Add(measurement, func() telegraf.Input { return &c })
inputs.Add(measurement, func() telegraf.Input {
return &Ceph{
CephBinary: "/usr/bin/ceph",
OsdPrefix: osdPrefix,
MonPrefix: monPrefix,
MdsPrefix: mdsPrefix,
RgwPrefix: rgwPrefix,
SocketDir: "/var/run/ceph",
SocketSuffix: sockSuffix,
CephUser: "client.admin",
CephConfig: "/etc/ceph/ceph.conf",
GatherAdminSocketStats: true,
GatherClusterStats: false,
}
})
}
var perfDump = func(binary string, socket *socket) (string, error) {

View File

@ -1,8 +0,0 @@
//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 ceph
func (c *Ceph) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -40,7 +40,7 @@ All measurements have the `path` tag.
## Configuration
```toml
```toml @sample.conf
# Read specific statistics per cgroup
[[inputs.cgroup]]
## Directories in which to look for files, globs are supported.

View File

@ -1,15 +1,26 @@
//go:generate ../../../tools/readme_config_includer/generator
package cgroup
import (
_ "embed"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type CGroup struct {
Paths []string `toml:"paths"`
Files []string `toml:"files"`
}
func (*CGroup) SampleConfig() string {
return sampleConfig
}
func init() {
inputs.Add("cgroup", func() telegraf.Input { return &CGroup{} })
}

View File

@ -1,8 +0,0 @@
//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 cgroup
func (g *CGroup) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -53,7 +53,7 @@ Delete second or Not synchronised.
## Configuration
```toml
```toml @sample.conf
# Get standard chrony metrics, requires chronyc executable.
[[inputs.chrony]]
## If true, chronyc tries to perform a DNS lookup for the time server.

View File

@ -1,6 +1,8 @@
//go:generate ../../../tools/readme_config_includer/generator
package chrony
import (
_ "embed"
"errors"
"fmt"
"os/exec"
@ -13,6 +15,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
var (
execCommand = exec.Command // execCommand is used to mock commands in tests.
)
@ -22,6 +28,10 @@ type Chrony struct {
path string
}
func (*Chrony) SampleConfig() string {
return sampleConfig
}
func (c *Chrony) Init() error {
var err error
c.path, err = exec.LookPath("chronyc")

View File

@ -1,8 +0,0 @@
//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 chrony
func (*Chrony) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -11,7 +11,7 @@ The TCP dialout transport is supported on IOS XR (32-bit and 64-bit) 6.1.x and l
## Configuration
```toml
```toml @sample.conf
# Cisco model-driven telemetry (MDT) input plugin for IOS XR, IOS XE and NX-OS platforms
[[inputs.cisco_telemetry_mdt]]
## Telemetry transport can be "tcp" or "grpc". TLS is only supported when

View File

@ -1,7 +1,9 @@
//go:generate ../../../tools/readme_config_includer/generator
package cisco_telemetry_mdt
import (
"bytes"
_ "embed"
"encoding/binary"
"encoding/json"
"fmt"
@ -17,7 +19,7 @@ import (
telemetry "github.com/cisco-ie/nx-telemetry-proto/telemetry_bis"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
_ "google.golang.org/grpc/encoding/gzip" // Register GRPC gzip decoder to support compressed telemetry
_ "google.golang.org/grpc/encoding/gzip" // Required to allow gzip encoding
"google.golang.org/grpc/peer"
"google.golang.org/protobuf/proto"
@ -27,6 +29,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
const (
// Maximum telemetry payload size (in bytes) to accept for GRPC dialout transport
tcpMaxMsgLen uint32 = 1024 * 1024
@ -74,6 +80,10 @@ type NxPayloadXfromStructure struct {
} `json:"prop"`
}
func (*CiscoTelemetryMDT) SampleConfig() string {
return sampleConfig
}
// Start the Cisco MDT service
func (c *CiscoTelemetryMDT) Start(acc telegraf.Accumulator) error {
var err error

View File

@ -1,8 +0,0 @@
//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 cisco_telemetry_mdt
func (c *CiscoTelemetryMDT) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -4,7 +4,7 @@ This plugin gathers the statistic data from [ClickHouse](https://github.com/Clic
## Configuration
```toml
```toml @sample.conf
# Read metrics from one or many ClickHouse servers
[[inputs.clickhouse]]
## Username for authorization on ClickHouse server

View File

@ -1,7 +1,9 @@
//go:generate ../../../tools/readme_config_includer/generator
package clickhouse
import (
"bytes"
_ "embed"
"encoding/json"
"fmt"
"io"
@ -19,6 +21,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
var defaultTimeout = 5 * time.Second
type connect struct {
@ -53,6 +59,10 @@ type ClickHouse struct {
tls.ClientConfig
}
func (*ClickHouse) SampleConfig() string {
return sampleConfig
}
// Start ClickHouse input service
func (ch *ClickHouse) Start(telegraf.Accumulator) error {
timeout := defaultTimeout

View File

@ -1,8 +0,0 @@
//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 clickhouse
func (*ClickHouse) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -5,7 +5,7 @@ and creates metrics using one of the supported [input data formats][].
## Configuration
```toml
```toml @sample.conf
# Read metrics from Google PubSub
[[inputs.cloud_pubsub]]
## Required. Name of Google Cloud Platform (GCP) Project that owns

View File

@ -1,23 +1,29 @@
//go:generate ../../../tools/readme_config_includer/generator
package cloud_pubsub
import (
"context"
_ "embed"
"encoding/base64"
"fmt"
"sync"
"encoding/base64"
"time"
"cloud.google.com/go/pubsub"
"golang.org/x/oauth2/google"
"google.golang.org/api/option"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/config"
"github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/plugins/inputs"
"github.com/influxdata/telegraf/plugins/parsers"
"golang.org/x/oauth2/google"
"google.golang.org/api/option"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type empty struct{}
type semaphore chan empty
@ -59,6 +65,10 @@ type PubSub struct {
sem semaphore
}
func (*PubSub) SampleConfig() string {
return sampleConfig
}
// Gather does nothing for this service input.
func (ps *PubSub) Gather(_ telegraf.Accumulator) error {
return nil

View File

@ -1,8 +0,0 @@
//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 cloud_pubsub
func (ps *PubSub) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -13,7 +13,7 @@ Enable mutually authenticated TLS and authorize client connections by signing ce
This is a sample configuration for the plugin.
```toml
```toml @sample.conf
# Google Cloud Pub/Sub Push HTTP listener
[[inputs.cloud_pubsub_push]]
## Address and port to host HTTP listener on

View File

@ -1,8 +1,10 @@
//go:generate ../../../tools/readme_config_includer/generator
package cloud_pubsub_push
import (
"context"
"crypto/subtle"
_ "embed"
"encoding/base64"
"encoding/json"
"io"
@ -17,6 +19,10 @@ import (
"github.com/influxdata/telegraf/plugins/parsers"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
// defaultMaxBodySize is the default maximum request body size, in bytes.
// if the request body is over this size, we will return an HTTP 413 error.
// 500 MB
@ -61,6 +67,10 @@ type Payload struct {
Subscription string `json:"subscription"`
}
func (*PubSubPush) SampleConfig() string {
return sampleConfig
}
func (p *PubSubPush) Gather(_ telegraf.Accumulator) error {
return nil
}

View File

@ -1,8 +0,0 @@
//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 cloud_pubsub_push
func (p *PubSubPush) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -16,7 +16,7 @@ API endpoint. In the following order the plugin will attempt to authenticate.
## Configuration
```toml
```toml @sample.conf
# Pull Metric Statistics from Amazon CloudWatch
[[inputs.cloudwatch]]
## Amazon Region

View File

@ -1,7 +1,9 @@
//go:generate ../../../tools/readme_config_includer/generator
package cloudwatch
import (
"context"
_ "embed"
"fmt"
"net"
"net/http"
@ -25,6 +27,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
const (
StatisticAverage = "Average"
StatisticMaximum = "Maximum"
@ -90,6 +96,10 @@ type cloudwatchClient interface {
GetMetricData(context.Context, *cwClient.GetMetricDataInput, ...func(*cwClient.Options)) (*cwClient.GetMetricDataOutput, error)
}
func (*CloudWatch) SampleConfig() string {
return sampleConfig
}
func (c *CloudWatch) Init() error {
if len(c.Namespace) != 0 {
c.Namespaces = append(c.Namespaces, c.Namespace)

View File

@ -1,8 +0,0 @@
//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 cloudwatch
func (c *CloudWatch) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -20,7 +20,7 @@ For more information on conntrack-tools, see the
## Configuration
```toml
```toml @sample.conf
# Collects conntrack stats from the configured directories and files.
[[inputs.conntrack]]
## The following defaults would work with multiple versions of conntrack.

View File

@ -1,20 +1,25 @@
//go:generate ../../../tools/readme_config_includer/generator
//go:build linux
// +build linux
package conntrack
import (
_ "embed"
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
"path/filepath"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type Conntrack struct {
Path string
Dirs []string
@ -47,6 +52,10 @@ func (c *Conntrack) setDefaults() {
}
}
func (*Conntrack) SampleConfig() string {
return sampleConfig
}
func (c *Conntrack) Gather(acc telegraf.Accumulator) error {
c.setDefaults()

View File

@ -1,11 +0,0 @@
//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 conntrack
func (c *Conntrack) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -8,7 +8,7 @@ report those stats already using StatsD protocol if needed.
## Configuration
```toml
```toml @sample.conf
# Gather health check statuses from services registered in Consul
[[inputs.consul]]
## Consul server address

View File

@ -1,15 +1,22 @@
//go:generate ../../../tools/readme_config_includer/generator
package consul
import (
_ "embed"
"net/http"
"strings"
"github.com/hashicorp/consul/api"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/common/tls"
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type Consul struct {
Address string
Scheme string
@ -27,6 +34,10 @@ type Consul struct {
client *api.Client
}
func (*Consul) SampleConfig() string {
return sampleConfig
}
func (c *Consul) Init() error {
if c.MetricVersion != 2 {
c.Log.Warnf("Use of deprecated configuration: 'metric_version = 1'; please update to 'metric_version = 2'")

View File

@ -1,8 +0,0 @@
//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 consul
func (c *Consul) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -6,7 +6,7 @@ This plugin grabs metrics from a Consul agent. Telegraf may be present in every
## Configuration
```toml
```toml @sample.conf
# Read metrics from the Consul Agent API
[[inputs.consul_agent]]
## URL for the Consul agent

View File

@ -1,6 +1,8 @@
//go:generate ../../../tools/readme_config_includer/generator
package consul_agent
import (
_ "embed"
"encoding/json"
"errors"
"fmt"
@ -15,6 +17,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
// consul_agent configuration object
type ConsulAgent struct {
URL string `toml:"url"`
@ -39,6 +45,10 @@ func init() {
})
}
func (*ConsulAgent) SampleConfig() string {
return sampleConfig
}
func (n *ConsulAgent) Init() error {
if n.URL == "" {
n.URL = "http://127.0.0.1:8500"

View File

@ -1,8 +0,0 @@
//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 consul_agent
func (n *ConsulAgent) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -5,7 +5,7 @@ This plugin gets metrics for each Couchbase node, as well as detailed metrics fo
## Configuration
```toml
```toml @sample.conf
# Read per-node and per-bucket metrics from Couchbase
[[inputs.couchbase]]
## specify servers via a url matching:

View File

@ -1,6 +1,8 @@
//go:generate ../../../tools/readme_config_includer/generator
package couchbase
import (
_ "embed"
"encoding/json"
"net/http"
"regexp"
@ -15,6 +17,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type Couchbase struct {
Servers []string
@ -28,6 +34,10 @@ type Couchbase struct {
var regexpURI = regexp.MustCompile(`(\S+://)?(\S+\:\S+@)`)
func (*Couchbase) SampleConfig() string {
return sampleConfig
}
// Reads stats from all configured clusters. Accumulates stats.
// Returns one of the errors encountered while gathering stats (if any).
func (cb *Couchbase) Gather(acc telegraf.Accumulator) error {

View File

@ -1,8 +0,0 @@
//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 couchbase
func (cb *Couchbase) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -4,7 +4,7 @@ The CouchDB plugin gathers metrics of CouchDB using [_stats] endpoint.
## Configuration
```toml
```toml @sample.conf
# Read CouchDB Stats from one or more servers
[[inputs.couchdb]]
## Works with CouchDB stats endpoints out of the box

View File

@ -1,6 +1,8 @@
//go:generate ../../../tools/readme_config_includer/generator
package couchdb
import (
_ "embed"
"encoding/json"
"fmt"
"net/http"
@ -11,6 +13,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type (
metaData struct {
Current *float64 `json:"current"`
@ -88,6 +94,10 @@ type (
}
)
func (*CouchDB) SampleConfig() string {
return sampleConfig
}
func (c *CouchDB) Gather(accumulator telegraf.Accumulator) error {
var wg sync.WaitGroup
for _, u := range c.Hosts {

View File

@ -1,8 +0,0 @@
//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 couchdb
func (*CouchDB) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -4,7 +4,7 @@ The `cpu` plugin gather metrics on the system CPUs.
## Configuration
```toml
```toml @sample.conf
# Read metrics about cpu usage
[[inputs.cpu]]
## Whether to report per-cpu stats or not

View File

@ -1,6 +1,8 @@
//go:generate ../../../tools/readme_config_includer/generator
package cpu
import (
_ "embed"
"fmt"
"time"
@ -11,6 +13,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs/system"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type CPUStats struct {
ps system.PS
lastStats map[string]cpuUtil.TimesStat
@ -35,6 +41,10 @@ func NewCPUStats(ps system.PS) *CPUStats {
}
}
func (*CPUStats) SampleConfig() string {
return sampleConfig
}
func (c *CPUStats) Gather(acc telegraf.Accumulator) error {
times, err := c.ps.CPUTimes(c.PerCPU, c.TotalCPU)
if err != nil {

View File

@ -1,8 +0,0 @@
//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 cpu
func (c *CPUStats) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -8,3 +8,5 @@
collect_cpu_time = false
## If true, compute and report the sum of all non-idle CPU states
report_active = false
## If true and the info is available then add core_id and physical_id tags
core_tags = false

View File

@ -4,7 +4,7 @@ The `csgo` plugin gather metrics from Counter-Strike: Global Offensive servers.
## Configuration
```toml
```toml @sample.conf
# Fetch metrics from a CSGO SRCDS
[[inputs.csgo]]
## Specify servers using the following format:

View File

@ -1,6 +1,8 @@
//go:generate ../../../tools/readme_config_includer/generator
package csgo
import (
_ "embed"
"encoding/json"
"errors"
"strconv"
@ -14,6 +16,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
type statsData struct {
CPU float64 `json:"cpu"`
NetIn float64 `json:"net_in"`
@ -31,6 +37,10 @@ type CSGO struct {
Servers [][]string `toml:"servers"`
}
func (*CSGO) SampleConfig() string {
return sampleConfig
}
func (s *CSGO) Gather(acc telegraf.Accumulator) error {
var wg sync.WaitGroup

View File

@ -1,8 +0,0 @@
//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 csgo
func (*CSGO) SampleConfig() string {
return `{{ .SampleConfig }}`
}

View File

@ -20,7 +20,7 @@ your database.
## Configuration
```toml
```toml @sample.conf
# Input plugin for DC/OS metrics
[[inputs.dcos]]
## The DC/OS cluster URL.

View File

@ -1,7 +1,9 @@
//go:generate ../../../tools/readme_config_includer/generator
package dcos
import (
"context"
_ "embed"
"net/url"
"os"
"sort"
@ -18,6 +20,10 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string
const (
defaultMaxConnections = 10
defaultResponseTimeout = 20 * time.Second
@ -69,6 +75,10 @@ type DCOS struct {
appFilter filter.Filter
}
func (*DCOS) SampleConfig() string {
return sampleConfig
}
func (d *DCOS) Gather(acc telegraf.Accumulator) error {
err := d.init()
if err != nil {

View File

@ -1,8 +0,0 @@
//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 dcos
func (d *DCOS) SampleConfig() string {
return `{{ .SampleConfig }}`
}

Some files were not shown because too many files have changed in this diff Show More