diff --git a/.circleci/config.yml b/.circleci/config.yml index a91776647..a26637817 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ executors: working_directory: '/go/src/github.com/influxdata/telegraf' resource_class: large docker: - - image: 'quay.io/influxdb/telegraf-ci:1.18.5' + - image: 'quay.io/influxdb/telegraf-ci:1.19.1' environment: GOFLAGS: -p=4 mac: diff --git a/Makefile b/Makefile index 37b7ad7f1..231c91ddb 100644 --- a/Makefile +++ b/Makefile @@ -242,8 +242,8 @@ plugins/parsers/influx/machine.go: plugins/parsers/influx/machine.go.rl .PHONY: ci ci: - docker build -t quay.io/influxdb/telegraf-ci:1.18.5 - < scripts/ci.docker - docker push quay.io/influxdb/telegraf-ci:1.18.5 + docker build -t quay.io/influxdb/telegraf-ci:1.19.1 - < scripts/ci.docker + docker push quay.io/influxdb/telegraf-ci:1.19.1 .PHONY: install install: $(buildbin) diff --git a/agent/agent.go b/agent/agent.go index d5cd68ecc..6a6005b79 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -50,6 +50,7 @@ type inputUnit struct { // ______ ┌───────────┐ ______ // ()_____)──▶ │ Processor │──▶ ()_____) // └───────────┘ + type processorUnit struct { src <-chan telegraf.Metric dst chan<- telegraf.Metric @@ -59,7 +60,7 @@ type processorUnit struct { // aggregatorUnit is a group of Aggregators and their source and sink channels. // Typically the aggregators write to a processor channel and pass the original // metrics to the output channel. The sink channels may be the same channel. -// + // ┌────────────┐ // ┌──▶ │ Aggregator │───┐ // │ └────────────┘ │ @@ -71,6 +72,7 @@ type processorUnit struct { // │ └────────────┘ // │ ______ // └────────────────────────▶ ()_____) + type aggregatorUnit struct { src <-chan telegraf.Metric aggC chan<- telegraf.Metric @@ -80,7 +82,7 @@ type aggregatorUnit struct { // outputUnit is a group of Outputs and their source channel. Metrics on the // channel are written to all outputs. -// + // ┌────────┐ // ┌──▶ │ Output │ // │ └────────┘ @@ -90,6 +92,7 @@ type aggregatorUnit struct { // │ ┌────────┐ // └──▶ │ Output │ // └────────┘ + type outputUnit struct { src <-chan telegraf.Metric outputs []*models.RunningOutput diff --git a/cmd/telegraf/printer.go b/cmd/telegraf/printer.go index 4bf03734b..38d452465 100644 --- a/cmd/telegraf/printer.go +++ b/cmd/telegraf/printer.go @@ -54,6 +54,7 @@ var globalTagsConfig = ` ` // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the agentConfig data. +// //go:embed agent.conf var agentConfig string diff --git a/filter/filter.go b/filter/filter.go index 2af93ec8d..3e3798a47 100644 --- a/filter/filter.go +++ b/filter/filter.go @@ -14,11 +14,10 @@ type Filter interface { // for matching a given string against the filter list. The filter list // supports glob matching too, ie: // -// f, _ := Compile([]string{"cpu", "mem", "net*"}) -// f.Match("cpu") // true -// f.Match("network") // true -// f.Match("memory") // false -// +// f, _ := Compile([]string{"cpu", "mem", "net*"}) +// f.Match("cpu") // true +// f.Match("network") // true +// f.Match("memory") // false func Compile(filters []string) (Filter, error) { // return if there is nothing to compile if len(filters) == 0 { diff --git a/go.mod b/go.mod index bd79f8b71..449904f5b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/influxdata/telegraf -go 1.18 +go 1.19 // Workaround for https://github.com/lxc/lxd/issues/10745 (failing "go list -m all") replace google.golang.org/grpc/naming => google.golang.org/grpc v1.29.1 diff --git a/internal/snmp/translate.go b/internal/snmp/translate.go index 603dc2712..309ab5db0 100644 --- a/internal/snmp/translate.go +++ b/internal/snmp/translate.go @@ -49,7 +49,7 @@ func ClearCache() { cache = make(map[string]bool) } -//will give all found folders to gosmi and load in all modules found in the folders +// will give all found folders to gosmi and load in all modules found in the folders func LoadMibsFromPath(paths []string, log telegraf.Logger, loader MibLoader) error { folders, err := walkPaths(paths, log) if err != nil { @@ -89,7 +89,7 @@ func LoadMibsFromPath(paths []string, log telegraf.Logger, loader MibLoader) err return nil } -//should walk the paths given and find all folders +// should walk the paths given and find all folders func walkPaths(paths []string, log telegraf.Logger) ([]string, error) { once.Do(gosmi.Init) folders := []string{} diff --git a/internal/templating/node.go b/internal/templating/node.go index bf68509a0..8466fa7b3 100644 --- a/internal/templating/node.go +++ b/internal/templating/node.go @@ -105,16 +105,18 @@ type nodes []*node // less than a non-wildcard value. // // For example, the filters: -// "*.*" -// "servers.*" -// "servers.localhost" -// "*.localhost" +// +// "*.*" +// "servers.*" +// "servers.localhost" +// "*.localhost" // // Would be sorted as: -// "servers.localhost" -// "servers.*" -// "*.localhost" -// "*.*" +// +// "servers.localhost" +// "servers.*" +// "*.localhost" +// "*.*" func (n *nodes) Less(j, k int) bool { if (*n)[j].value == "*" && (*n)[k].value != "*" { return false diff --git a/plugins/aggregators/basicstats/basicstats.go b/plugins/aggregators/basicstats/basicstats.go index 7e912fe48..0d8e3db5c 100644 --- a/plugins/aggregators/basicstats/basicstats.go +++ b/plugins/aggregators/basicstats/basicstats.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/derivative/derivative.go b/plugins/aggregators/derivative/derivative.go index 3e86d7132..f2c4e91b4 100644 --- a/plugins/aggregators/derivative/derivative.go +++ b/plugins/aggregators/derivative/derivative.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/final/final.go b/plugins/aggregators/final/final.go index c67695a36..78b7fd3ea 100644 --- a/plugins/aggregators/final/final.go +++ b/plugins/aggregators/final/final.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/histogram/histogram.go b/plugins/aggregators/histogram/histogram.go index bacab1a1c..f40e92ce5 100644 --- a/plugins/aggregators/histogram/histogram.go +++ b/plugins/aggregators/histogram/histogram.go @@ -13,6 +13,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/merge/merge.go b/plugins/aggregators/merge/merge.go index a9735f26c..365fa5b85 100644 --- a/plugins/aggregators/merge/merge.go +++ b/plugins/aggregators/merge/merge.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/minmax/minmax.go b/plugins/aggregators/minmax/minmax.go index 076fae73c..8bd7080d6 100644 --- a/plugins/aggregators/minmax/minmax.go +++ b/plugins/aggregators/minmax/minmax.go @@ -9,6 +9,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/quantile/quantile.go b/plugins/aggregators/quantile/quantile.go index 551b6772e..7d132aa18 100644 --- a/plugins/aggregators/quantile/quantile.go +++ b/plugins/aggregators/quantile/quantile.go @@ -10,6 +10,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/starlark/starlark.go b/plugins/aggregators/starlark/starlark.go index 5c536fa33..c1b413eb0 100644 --- a/plugins/aggregators/starlark/starlark.go +++ b/plugins/aggregators/starlark/starlark.go @@ -12,6 +12,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/valuecounter/valuecounter.go b/plugins/aggregators/valuecounter/valuecounter.go index 0ddbe43b1..4672a6f60 100644 --- a/plugins/aggregators/valuecounter/valuecounter.go +++ b/plugins/aggregators/valuecounter/valuecounter.go @@ -10,6 +10,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/common/shim/example/cmd/main.go b/plugins/common/shim/example/cmd/main.go index 27c5b8741..6f6c5549b 100644 --- a/plugins/common/shim/example/cmd/main.go +++ b/plugins/common/shim/example/cmd/main.go @@ -22,16 +22,16 @@ var err error // However, if you want to do all your config in code, you can like so: // // // initialize your plugin with any settings you want -// myInput := &mypluginname.MyPlugin{ -// DefaultSettingHere: 3, -// } +// +// myInput := &mypluginname.MyPlugin{ +// DefaultSettingHere: 3, +// } // // shim := shim.New() // // shim.AddInput(myInput) // // // now the shim.Run() call as below. Note the shim is only intended to run a single plugin. -// func main() { // parse command line options flag.Parse() diff --git a/plugins/inputs/activemq/activemq.go b/plugins/inputs/activemq/activemq.go index 11dcb78f4..487711658 100644 --- a/plugins/inputs/activemq/activemq.go +++ b/plugins/inputs/activemq/activemq.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/aerospike/aerospike.go b/plugins/inputs/aerospike/aerospike.go index bd5724c3e..98e4f67b9 100644 --- a/plugins/inputs/aerospike/aerospike.go +++ b/plugins/inputs/aerospike/aerospike.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/aliyuncms/aliyuncms.go b/plugins/inputs/aliyuncms/aliyuncms.go index ef5ae4a9d..977c90066 100644 --- a/plugins/inputs/aliyuncms/aliyuncms.go +++ b/plugins/inputs/aliyuncms/aliyuncms.go @@ -24,6 +24,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -341,7 +342,7 @@ func (s *AliyunCMS) gatherMetric(acc telegraf.Accumulator, metricName string, me return nil } -//tag helper +// tag helper func parseTag(tagSpec string, data interface{}) (tagKey string, tagValue string, err error) { var ( ok bool diff --git a/plugins/inputs/aliyuncms/discovery.go b/plugins/inputs/aliyuncms/discovery.go index 2298f82b4..9d4aff17b 100644 --- a/plugins/inputs/aliyuncms/discovery.go +++ b/plugins/inputs/aliyuncms/discovery.go @@ -52,8 +52,8 @@ type parsedDResp struct { pageNumber int } -//getRPCReqFromDiscoveryRequest - utility function to map between aliyun request primitives -//discoveryRequest represents different type of discovery requests +// getRPCReqFromDiscoveryRequest - utility function to map between aliyun request primitives +// discoveryRequest represents different type of discovery requests func getRPCReqFromDiscoveryRequest(req discoveryRequest) (*requests.RpcRequest, error) { if reflect.ValueOf(req).Type().Kind() != reflect.Ptr || reflect.ValueOf(req).IsNil() { @@ -80,12 +80,12 @@ func getRPCReqFromDiscoveryRequest(req discoveryRequest) (*requests.RpcRequest, return nil, errors.Errorf("didn't find *requests.RpcRequest embedded struct in %q", ptrV.Type()) } -//newDiscoveryTool function returns discovery tool object. -//The object is used to periodically get data about aliyun objects and send this -//data into channel. The intention is to enrich reported metrics with discovery data. -//Discovery is supported for a limited set of object types (defined by project) and can be extended in future. -//Discovery can be limited by region if not set, then all regions is queried. -//Request against API can inquire additional costs, consult with aliyun API documentation. +// newDiscoveryTool function returns discovery tool object. +// The object is used to periodically get data about aliyun objects and send this +// data into channel. The intention is to enrich reported metrics with discovery data. +// Discovery is supported for a limited set of object types (defined by project) and can be extended in future. +// Discovery can be limited by region if not set, then all regions is queried. +// Request against API can inquire additional costs, consult with aliyun API documentation. func newDiscoveryTool(regions []string, project string, lg telegraf.Logger, credential auth.Credential, rateLimit int, discoveryInterval time.Duration) (*discoveryTool, error) { var ( dscReq = map[string]discoveryRequest{} diff --git a/plugins/inputs/amd_rocm_smi/amd_rocm_smi.go b/plugins/inputs/amd_rocm_smi/amd_rocm_smi.go index 53157d31d..069b767d2 100644 --- a/plugins/inputs/amd_rocm_smi/amd_rocm_smi.go +++ b/plugins/inputs/amd_rocm_smi/amd_rocm_smi.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/amqp_consumer/amqp_consumer.go b/plugins/inputs/amqp_consumer/amqp_consumer.go index 4c6d36612..80950423b 100644 --- a/plugins/inputs/amqp_consumer/amqp_consumer.go +++ b/plugins/inputs/amqp_consumer/amqp_consumer.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/apache/apache.go b/plugins/inputs/apache/apache.go index 761c25d31..50087a0a2 100644 --- a/plugins/inputs/apache/apache.go +++ b/plugins/inputs/apache/apache.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/apcupsd/apcupsd.go b/plugins/inputs/apcupsd/apcupsd.go index 1122df7e4..6af82177e 100644 --- a/plugins/inputs/apcupsd/apcupsd.go +++ b/plugins/inputs/apcupsd/apcupsd.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/aurora/aurora.go b/plugins/inputs/aurora/aurora.go index 131fd8882..a49b27ac4 100644 --- a/plugins/inputs/aurora/aurora.go +++ b/plugins/inputs/aurora/aurora.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/azure_storage_queue/azure_storage_queue.go b/plugins/inputs/azure_storage_queue/azure_storage_queue.go index ca80a16b7..ad924c94b 100644 --- a/plugins/inputs/azure_storage_queue/azure_storage_queue.go +++ b/plugins/inputs/azure_storage_queue/azure_storage_queue.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/bcache/bcache.go b/plugins/inputs/bcache/bcache.go index 67cb71419..e21a46401 100644 --- a/plugins/inputs/bcache/bcache.go +++ b/plugins/inputs/bcache/bcache.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/beanstalkd/beanstalkd.go b/plugins/inputs/beanstalkd/beanstalkd.go index 68c189f34..aed14c836 100644 --- a/plugins/inputs/beanstalkd/beanstalkd.go +++ b/plugins/inputs/beanstalkd/beanstalkd.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/beat/beat.go b/plugins/inputs/beat/beat.go index 7558d8e58..4483f9556 100644 --- a/plugins/inputs/beat/beat.go +++ b/plugins/inputs/beat/beat.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/bind/bind.go b/plugins/inputs/bind/bind.go index 321822d63..daedc8251 100644 --- a/plugins/inputs/bind/bind.go +++ b/plugins/inputs/bind/bind.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/bond/bond.go b/plugins/inputs/bond/bond.go index c8a6b7c84..be7ff2467 100644 --- a/plugins/inputs/bond/bond.go +++ b/plugins/inputs/bond/bond.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/burrow/burrow.go b/plugins/inputs/burrow/burrow.go index b5415ae2f..68552bf00 100644 --- a/plugins/inputs/burrow/burrow.go +++ b/plugins/inputs/burrow/burrow.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cassandra/cassandra.go b/plugins/inputs/cassandra/cassandra.go index 13f76c92b..c6d3ea57e 100644 --- a/plugins/inputs/cassandra/cassandra.go +++ b/plugins/inputs/cassandra/cassandra.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cassandra/cassandra_test.go b/plugins/inputs/cassandra/cassandra_test.go index 35551cf84..791686297 100644 --- a/plugins/inputs/cassandra/cassandra_test.go +++ b/plugins/inputs/cassandra/cassandra_test.go @@ -114,11 +114,13 @@ func (c jolokiaClientStub) MakeRequest(_ *http.Request) (*http.Response, error) // Generates a pointer to an HttpJson object that uses a mock HTTP client. // Parameters: -// response : Body of the response that the mock HTTP client should return -// statusCode: HTTP status code the mock HTTP client should return +// +// response : Body of the response that the mock HTTP client should return +// statusCode: HTTP status code the mock HTTP client should return // // Returns: -// *HttpJson: Pointer to an HttpJson object that uses the generated mock HTTP client +// +// *HttpJson: Pointer to an HttpJson object that uses the generated mock HTTP client func genJolokiaClientStub(response string, statusCode int, servers []string, metrics []string) *Cassandra { return &Cassandra{ jClient: jolokiaClientStub{responseBody: response, statusCode: statusCode}, diff --git a/plugins/inputs/ceph/ceph.go b/plugins/inputs/ceph/ceph.go index 8b1ac3b38..b338dd8ef 100644 --- a/plugins/inputs/ceph/ceph.go +++ b/plugins/inputs/ceph/ceph.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cgroup/cgroup.go b/plugins/inputs/cgroup/cgroup.go index f5ded195e..f62a531d4 100644 --- a/plugins/inputs/cgroup/cgroup.go +++ b/plugins/inputs/cgroup/cgroup.go @@ -9,6 +9,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/chrony/chrony.go b/plugins/inputs/chrony/chrony.go index 7052ae538..a6829426d 100644 --- a/plugins/inputs/chrony/chrony.go +++ b/plugins/inputs/chrony/chrony.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -63,19 +64,19 @@ func (c *Chrony) Gather(acc telegraf.Accumulator) error { // processChronycOutput takes in a string output from the chronyc command, like: // -// Reference ID : 192.168.1.22 (ntp.example.com) -// Stratum : 3 -// Ref time (UTC) : Thu May 12 14:27:07 2016 -// System time : 0.000020390 seconds fast of NTP time -// Last offset : +0.000012651 seconds -// RMS offset : 0.000025577 seconds -// Frequency : 16.001 ppm slow -// Residual freq : -0.000 ppm -// Skew : 0.006 ppm -// Root delay : 0.001655 seconds -// Root dispersion : 0.003307 seconds -// Update interval : 507.2 seconds -// Leap status : Normal +// Reference ID : 192.168.1.22 (ntp.example.com) +// Stratum : 3 +// Ref time (UTC) : Thu May 12 14:27:07 2016 +// System time : 0.000020390 seconds fast of NTP time +// Last offset : +0.000012651 seconds +// RMS offset : 0.000025577 seconds +// Frequency : 16.001 ppm slow +// Residual freq : -0.000 ppm +// Skew : 0.006 ppm +// Root delay : 0.001655 seconds +// Root dispersion : 0.003307 seconds +// Update interval : 507.2 seconds +// Leap status : Normal // // The value on the left side of the colon is used as field name, if the first field on // the right side is a float. If it cannot be parsed as float, it is a tag name. diff --git a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go index 28b300bbe..87ee5cd57 100644 --- a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go +++ b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go @@ -32,6 +32,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_util.go b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_util.go index 1d7d95a95..7454d60f9 100644 --- a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_util.go +++ b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_util.go @@ -7,7 +7,7 @@ import ( telemetry "github.com/cisco-ie/nx-telemetry-proto/telemetry_bis" ) -//xform Field to string +// xform Field to string func xformValueString(field *telemetry.TelemetryField) string { var str string switch val := field.ValueByType.(type) { @@ -31,7 +31,7 @@ func xformValueString(field *telemetry.TelemetryField) string { return "" } -//xform Uint64 to int64 +// xform Uint64 to int64 func nxosValueXformUint64Toint64(field *telemetry.TelemetryField, value interface{}) interface{} { if field.GetUint64Value() != 0 { return int64(value.(uint64)) @@ -39,7 +39,7 @@ func nxosValueXformUint64Toint64(field *telemetry.TelemetryField, value interfac return nil } -//xform string to float +// xform string to float func nxosValueXformStringTofloat(field *telemetry.TelemetryField, _ interface{}) interface{} { //convert property to float from string. vals := field.GetStringValue() @@ -51,7 +51,7 @@ func nxosValueXformStringTofloat(field *telemetry.TelemetryField, _ interface{}) return nil } -//xform string to uint64 +// xform string to uint64 func nxosValueXformStringToUint64(field *telemetry.TelemetryField, _ interface{}) interface{} { //string to uint64 vals := field.GetStringValue() @@ -63,7 +63,7 @@ func nxosValueXformStringToUint64(field *telemetry.TelemetryField, _ interface{} return nil } -//xform string to int64 +// xform string to int64 func nxosValueXformStringToInt64(field *telemetry.TelemetryField, _ interface{}) interface{} { //string to int64 vals := field.GetStringValue() @@ -75,7 +75,7 @@ func nxosValueXformStringToInt64(field *telemetry.TelemetryField, _ interface{}) return nil } -//auto-xform float properties +// auto-xform float properties func nxosValueAutoXformFloatProp(field *telemetry.TelemetryField, _ interface{}) interface{} { //check if we want auto xformation vals := field.GetStringValue() @@ -87,7 +87,7 @@ func nxosValueAutoXformFloatProp(field *telemetry.TelemetryField, _ interface{}) return nil } -//xform uint64 to string +// xform uint64 to string func nxosValueXformUint64ToString(field *telemetry.TelemetryField, _ interface{}) interface{} { switch val := field.ValueByType.(type) { case *telemetry.TelemetryField_StringValue: @@ -100,7 +100,7 @@ func nxosValueXformUint64ToString(field *telemetry.TelemetryField, _ interface{} return nil } -//Xform value field. +// Xform value field. func (c *CiscoTelemetryMDT) nxosValueXform(field *telemetry.TelemetryField, value interface{}, path string) interface{} { if strings.ContainsRune(path, ':') { // not NXOS diff --git a/plugins/inputs/clickhouse/clickhouse.go b/plugins/inputs/clickhouse/clickhouse.go index d444d6035..a0c7e0957 100644 --- a/plugins/inputs/clickhouse/clickhouse.go +++ b/plugins/inputs/clickhouse/clickhouse.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cloud_pubsub/cloud_pubsub.go b/plugins/inputs/cloud_pubsub/cloud_pubsub.go index 98858cfc9..978dabc1f 100644 --- a/plugins/inputs/cloud_pubsub/cloud_pubsub.go +++ b/plugins/inputs/cloud_pubsub/cloud_pubsub.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cloud_pubsub_push/cloud_pubsub_push.go b/plugins/inputs/cloud_pubsub_push/cloud_pubsub_push.go index f81adb508..1facd23ef 100644 --- a/plugins/inputs/cloud_pubsub_push/cloud_pubsub_push.go +++ b/plugins/inputs/cloud_pubsub_push/cloud_pubsub_push.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/conntrack/conntrack.go b/plugins/inputs/conntrack/conntrack.go index 57db11bfd..072e5a03d 100644 --- a/plugins/inputs/conntrack/conntrack.go +++ b/plugins/inputs/conntrack/conntrack.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/consul/consul.go b/plugins/inputs/consul/consul.go index 4a3da718f..498c6187e 100644 --- a/plugins/inputs/consul/consul.go +++ b/plugins/inputs/consul/consul.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/consul_agent/consul_agent.go b/plugins/inputs/consul_agent/consul_agent.go index d82c2f7f7..1426d900c 100644 --- a/plugins/inputs/consul_agent/consul_agent.go +++ b/plugins/inputs/consul_agent/consul_agent.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/couchbase/couchbase.go b/plugins/inputs/couchbase/couchbase.go index e3af5bbfe..915e089ea 100644 --- a/plugins/inputs/couchbase/couchbase.go +++ b/plugins/inputs/couchbase/couchbase.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/couchdb/couchdb.go b/plugins/inputs/couchdb/couchdb.go index a17523a3a..2c67093a3 100644 --- a/plugins/inputs/couchdb/couchdb.go +++ b/plugins/inputs/couchdb/couchdb.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cpu/cpu.go b/plugins/inputs/cpu/cpu.go index b71a40123..a29559bf3 100644 --- a/plugins/inputs/cpu/cpu.go +++ b/plugins/inputs/cpu/cpu.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cpu/cpu_test.go b/plugins/inputs/cpu/cpu_test.go index 3dc3242a6..235c08f25 100644 --- a/plugins/inputs/cpu/cpu_test.go +++ b/plugins/inputs/cpu/cpu_test.go @@ -103,14 +103,15 @@ func TestCPUStats(t *testing.T) { // if the measurement is of the wrong type, or if no matching measurements are found // // Parameters: -// t *testing.T : Testing object to use -// acc testutil.Accumulator: Accumulator to examine -// field string : Name of field to examine -// expectedValue float64 : Value to search for within the measurement -// delta float64 : Maximum acceptable distance of an accumulated value -// from the expectedValue parameter. Useful when -// floating-point arithmetic imprecision makes looking -// for an exact match impractical +// +// t *testing.T : Testing object to use +// acc testutil.Accumulator: Accumulator to examine +// field string : Name of field to examine +// expectedValue float64 : Value to search for within the measurement +// delta float64 : Maximum acceptable distance of an accumulated value +// from the expectedValue parameter. Useful when +// floating-point arithmetic imprecision makes looking +// for an exact match impractical func assertContainsTaggedFloat( t *testing.T, acc *testutil.Accumulator, diff --git a/plugins/inputs/csgo/csgo.go b/plugins/inputs/csgo/csgo.go index 1c05f4678..51c1eb6fe 100644 --- a/plugins/inputs/csgo/csgo.go +++ b/plugins/inputs/csgo/csgo.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/dcos/dcos.go b/plugins/inputs/dcos/dcos.go index 34014d0c5..d0f9029a3 100644 --- a/plugins/inputs/dcos/dcos.go +++ b/plugins/inputs/dcos/dcos.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/disk/disk.go b/plugins/inputs/disk/disk.go index 11c13189b..3ed5037bf 100644 --- a/plugins/inputs/disk/disk.go +++ b/plugins/inputs/disk/disk.go @@ -12,6 +12,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/diskio/diskio.go b/plugins/inputs/diskio/diskio.go index a129b7a09..936b482e8 100644 --- a/plugins/inputs/diskio/diskio.go +++ b/plugins/inputs/diskio/diskio.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/disque/disque.go b/plugins/inputs/disque/disque.go index 3414ed6ee..465d55ac9 100644 --- a/plugins/inputs/disque/disque.go +++ b/plugins/inputs/disque/disque.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/dmcache/dmcache.go b/plugins/inputs/dmcache/dmcache.go index 1cfab4d26..125cdba95 100644 --- a/plugins/inputs/dmcache/dmcache.go +++ b/plugins/inputs/dmcache/dmcache.go @@ -9,6 +9,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/dns_query/dns_query.go b/plugins/inputs/dns_query/dns_query.go index 60e0712c4..43f37d4c9 100644 --- a/plugins/inputs/dns_query/dns_query.go +++ b/plugins/inputs/dns_query/dns_query.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/docker/docker.go b/plugins/inputs/docker/docker.go index 4ecc448e2..7904f0204 100644 --- a/plugins/inputs/docker/docker.go +++ b/plugins/inputs/docker/docker.go @@ -28,6 +28,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/docker_log/docker_log.go b/plugins/inputs/docker_log/docker_log.go index 14441029d..57f4c7e6d 100644 --- a/plugins/inputs/docker_log/docker_log.go +++ b/plugins/inputs/docker_log/docker_log.go @@ -27,6 +27,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/dovecot/dovecot.go b/plugins/inputs/dovecot/dovecot.go index 3494ed843..2cfb83c43 100644 --- a/plugins/inputs/dovecot/dovecot.go +++ b/plugins/inputs/dovecot/dovecot.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/dpdk/dpdk.go b/plugins/inputs/dpdk/dpdk.go index f6e7b4ecd..afba20dce 100644 --- a/plugins/inputs/dpdk/dpdk.go +++ b/plugins/inputs/dpdk/dpdk.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ecs/ecs.go b/plugins/inputs/ecs/ecs.go index 7c93f18f4..647a5159e 100644 --- a/plugins/inputs/ecs/ecs.go +++ b/plugins/inputs/ecs/ecs.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/elasticsearch/elasticsearch.go b/plugins/inputs/elasticsearch/elasticsearch.go index 00aae60f2..21635e589 100644 --- a/plugins/inputs/elasticsearch/elasticsearch.go +++ b/plugins/inputs/elasticsearch/elasticsearch.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/elasticsearch_query/elasticsearch_query.go b/plugins/inputs/elasticsearch_query/elasticsearch_query.go index b6bbcf36c..69474ca22 100644 --- a/plugins/inputs/elasticsearch_query/elasticsearch_query.go +++ b/plugins/inputs/elasticsearch_query/elasticsearch_query.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ethtool/ethtool.go b/plugins/inputs/ethtool/ethtool.go index a6db2d6f3..40e6f8d76 100644 --- a/plugins/inputs/ethtool/ethtool.go +++ b/plugins/inputs/ethtool/ethtool.go @@ -8,6 +8,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/eventhub_consumer/eventhub_consumer.go b/plugins/inputs/eventhub_consumer/eventhub_consumer.go index a96a8c06b..b54589d5a 100644 --- a/plugins/inputs/eventhub_consumer/eventhub_consumer.go +++ b/plugins/inputs/eventhub_consumer/eventhub_consumer.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/example/example.go b/plugins/inputs/example/example.go index 83e0a51d7..647ee902a 100644 --- a/plugins/inputs/example/example.go +++ b/plugins/inputs/example/example.go @@ -13,6 +13,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/exec/exec.go b/plugins/inputs/exec/exec.go index 96a8fe072..061436c85 100644 --- a/plugins/inputs/exec/exec.go +++ b/plugins/inputs/exec/exec.go @@ -25,6 +25,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/execd/execd.go b/plugins/inputs/execd/execd.go index 582837219..79b42b39d 100644 --- a/plugins/inputs/execd/execd.go +++ b/plugins/inputs/execd/execd.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/fail2ban/fail2ban.go b/plugins/inputs/fail2ban/fail2ban.go index 819c15797..495139b6a 100644 --- a/plugins/inputs/fail2ban/fail2ban.go +++ b/plugins/inputs/fail2ban/fail2ban.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/fibaro/fibaro.go b/plugins/inputs/fibaro/fibaro.go index a5b523f52..8eb6ba1ad 100644 --- a/plugins/inputs/fibaro/fibaro.go +++ b/plugins/inputs/fibaro/fibaro.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/file/file.go b/plugins/inputs/file/file.go index c75fc9472..37d8a8672 100644 --- a/plugins/inputs/file/file.go +++ b/plugins/inputs/file/file.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/filecount/filecount.go b/plugins/inputs/filecount/filecount.go index 8e3171988..f8eed2ff3 100644 --- a/plugins/inputs/filecount/filecount.go +++ b/plugins/inputs/filecount/filecount.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/filestat/filestat.go b/plugins/inputs/filestat/filestat.go index 1983dbd4f..1bd472c85 100644 --- a/plugins/inputs/filestat/filestat.go +++ b/plugins/inputs/filestat/filestat.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/fireboard/fireboard.go b/plugins/inputs/fireboard/fireboard.go index 11ca85884..fe7e760bd 100644 --- a/plugins/inputs/fireboard/fireboard.go +++ b/plugins/inputs/fireboard/fireboard.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/fluentd/fluentd.go b/plugins/inputs/fluentd/fluentd.go index 1a5d667b1..5165e44fc 100644 --- a/plugins/inputs/fluentd/fluentd.go +++ b/plugins/inputs/fluentd/fluentd.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -53,11 +54,13 @@ type pluginData struct { // parse JSON from fluentd Endpoint // Parameters: -// data: unprocessed json received from endpoint +// +// data: unprocessed json received from endpoint // // Returns: -// pluginData: slice that contains parsed plugins -// error: error that may have occurred +// +// pluginData: slice that contains parsed plugins +// error: error that may have occurred func parse(data []byte) (datapointArray []pluginData, err error) { var endpointData endpointInfo diff --git a/plugins/inputs/github/github.go b/plugins/inputs/github/github.go index 428740ed6..90a3a6d46 100644 --- a/plugins/inputs/github/github.go +++ b/plugins/inputs/github/github.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/gnmi/gnmi.go b/plugins/inputs/gnmi/gnmi.go index 272678134..c26e02526 100644 --- a/plugins/inputs/gnmi/gnmi.go +++ b/plugins/inputs/gnmi/gnmi.go @@ -32,6 +32,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -481,7 +482,7 @@ func handlePath(gnmiPath *gnmiLib.Path, tags map[string]string, aliases map[stri return builder.String(), aliasPath, nil } -//ParsePath from XPath-like string to gNMI path structure +// ParsePath from XPath-like string to gNMI path structure func parsePath(origin string, pathToParse string, target string) (*gnmiLib.Path, error) { gnmiPath, err := xpath.ToGNMIPath(pathToParse) if err != nil { diff --git a/plugins/inputs/graylog/graylog.go b/plugins/inputs/graylog/graylog.go index dfe29bd38..7832e2960 100644 --- a/plugins/inputs/graylog/graylog.go +++ b/plugins/inputs/graylog/graylog.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -121,12 +122,14 @@ func (h *GrayLog) Gather(acc telegraf.Accumulator) error { // Gathers data from a particular server // Parameters: -// acc : The telegraf Accumulator to use -// serverURL: endpoint to send request to -// service : the service being queried +// +// acc : The telegraf Accumulator to use +// serverURL: endpoint to send request to +// service : the service being queried // // Returns: -// error: Any error that may have occurred +// +// error: Any error that may have occurred func (h *GrayLog) gatherServer( acc telegraf.Accumulator, serverURL string, @@ -161,11 +164,14 @@ func (h *GrayLog) gatherServer( // Flatten JSON hierarchy to produce field name and field value // Parameters: -// item: Item map to flatten -// fields: Map to store generated fields. -// id: Prefix for top level metric (empty string "") +// +// item: Item map to flatten +// fields: Map to store generated fields. +// id: Prefix for top level metric (empty string "") +// // Returns: -// void +// +// void func (h *GrayLog) flatten(item map[string]interface{}, fields map[string]interface{}, id string) { if id != "" { id = id + "_" @@ -185,11 +191,13 @@ func (h *GrayLog) flatten(item map[string]interface{}, fields map[string]interfa // Sends an HTTP request to the server using the GrayLog object's HTTPClient. // Parameters: -// serverURL: endpoint to send request to +// +// serverURL: endpoint to send request to // // Returns: -// string: body of the response -// error : Any error that may have occurred +// +// string: body of the response +// error : Any error that may have occurred func (h *GrayLog) sendRequest(serverURL string) (string, float64, error) { headers := map[string]string{ "Content-Type": "application/json", diff --git a/plugins/inputs/graylog/graylog_test.go b/plugins/inputs/graylog/graylog_test.go index 108d3bc28..04337ed9c 100644 --- a/plugins/inputs/graylog/graylog_test.go +++ b/plugins/inputs/graylog/graylog_test.go @@ -128,11 +128,13 @@ func (c *mockHTTPClient) HTTPClient() *http.Client { // Generates a pointer to an HttpJson object that uses a mock HTTP client. // Parameters: -// response : Body of the response that the mock HTTP client should return -// statusCode: HTTP status code the mock HTTP client should return +// +// response : Body of the response that the mock HTTP client should return +// statusCode: HTTP status code the mock HTTP client should return // // Returns: -// *HttpJson: Pointer to an HttpJson object that uses the generated mock HTTP client +// +// *HttpJson: Pointer to an HttpJson object that uses the generated mock HTTP client func genMockGrayLog(response string, statusCode int) []*GrayLog { return []*GrayLog{ { diff --git a/plugins/inputs/haproxy/haproxy.go b/plugins/inputs/haproxy/haproxy.go index bcf21349d..3daa854bd 100644 --- a/plugins/inputs/haproxy/haproxy.go +++ b/plugins/inputs/haproxy/haproxy.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/haproxy/haproxy_test.go b/plugins/inputs/haproxy/haproxy_test.go index 21a1b09c1..804b28a04 100644 --- a/plugins/inputs/haproxy/haproxy_test.go +++ b/plugins/inputs/haproxy/haproxy_test.go @@ -170,8 +170,8 @@ func TestHaproxyGeneratesMetricsUsingSocket(t *testing.T) { require.NotEmpty(t, acc.Errors) } -//When not passing server config, we default to localhost -//We just want to make sure we did request stat from localhost +// When not passing server config, we default to localhost +// We just want to make sure we did request stat from localhost func TestHaproxyDefaultGetFromLocalhost(t *testing.T) { r := &haproxy{} diff --git a/plugins/inputs/hddtemp/hddtemp.go b/plugins/inputs/hddtemp/hddtemp.go index c7f8b5947..f7e137445 100644 --- a/plugins/inputs/hddtemp/hddtemp.go +++ b/plugins/inputs/hddtemp/hddtemp.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/http/http.go b/plugins/inputs/http/http.go index c290ecf70..dcb9fadf7 100644 --- a/plugins/inputs/http/http.go +++ b/plugins/inputs/http/http.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -94,11 +95,13 @@ func (h *HTTP) SetParserFunc(fn telegraf.ParserFunc) { // Gathers data from a particular URL // Parameters: -// acc : The telegraf Accumulator to use -// url : endpoint to send request to +// +// acc : The telegraf Accumulator to use +// url : endpoint to send request to // // Returns: -// error: Any error that may have occurred +// +// error: Any error that may have occurred func (h *HTTP) gatherURL( acc telegraf.Accumulator, url string, diff --git a/plugins/inputs/http_listener_v2/http_listener_v2.go b/plugins/inputs/http_listener_v2/http_listener_v2.go index ed5dda252..9ef6a2690 100644 --- a/plugins/inputs/http_listener_v2/http_listener_v2.go +++ b/plugins/inputs/http_listener_v2/http_listener_v2.go @@ -26,6 +26,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/http_response/http_response.go b/plugins/inputs/http_response/http_response.go index cec346852..6c351f774 100644 --- a/plugins/inputs/http_response/http_response.go +++ b/plugins/inputs/http_response/http_response.go @@ -23,6 +23,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/httpjson/httpjson.go b/plugins/inputs/httpjson/httpjson.go index f6d8f2413..6500cc3ab 100644 --- a/plugins/inputs/httpjson/httpjson.go +++ b/plugins/inputs/httpjson/httpjson.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -111,12 +112,14 @@ func (h *HTTPJSON) Gather(acc telegraf.Accumulator) error { // Gathers data from a particular server // Parameters: -// acc : The telegraf Accumulator to use -// serverURL: endpoint to send request to -// service : the service being queried +// +// acc : The telegraf Accumulator to use +// serverURL: endpoint to send request to +// service : the service being queried // // Returns: -// error: Any error that may have occurred +// +// error: Any error that may have occurred func (h *HTTPJSON) gatherServer( acc telegraf.Accumulator, serverURL string, @@ -164,11 +167,13 @@ func (h *HTTPJSON) gatherServer( // Sends an HTTP request to the server using the HTTPJSON object's HTTPClient. // This request can be either a GET or a POST. // Parameters: -// serverURL: endpoint to send request to +// +// serverURL: endpoint to send request to // // Returns: -// string: body of the response -// error : Any error that may have occurred +// +// string: body of the response +// error : Any error that may have occurred func (h *HTTPJSON) sendRequest(serverURL string) (string, float64, error) { // Prepare URL requestURL, err := url.Parse(serverURL) diff --git a/plugins/inputs/httpjson/httpjson_test.go b/plugins/inputs/httpjson/httpjson_test.go index c522ebe99..8769fad9c 100644 --- a/plugins/inputs/httpjson/httpjson_test.go +++ b/plugins/inputs/httpjson/httpjson_test.go @@ -156,11 +156,13 @@ func (c *mockHTTPClient) HTTPClient() *http.Client { // Generates a pointer to an HTTPJSON object that uses a mock HTTP client. // Parameters: -// response : Body of the response that the mock HTTP client should return -// statusCode: HTTP status code the mock HTTP client should return +// +// response : Body of the response that the mock HTTP client should return +// statusCode: HTTP status code the mock HTTP client should return // // Returns: -// *HTTPJSON: Pointer to an HTTPJSON object that uses the generated mock HTTP client +// +// *HTTPJSON: Pointer to an HTTPJSON object that uses the generated mock HTTP client func genMockHTTPJSON(response string, statusCode int) []*HTTPJSON { return []*HTTPJSON{ { diff --git a/plugins/inputs/hugepages/hugepages.go b/plugins/inputs/hugepages/hugepages.go index 8929c422e..96eaba4b9 100644 --- a/plugins/inputs/hugepages/hugepages.go +++ b/plugins/inputs/hugepages/hugepages.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/icinga2/icinga2.go b/plugins/inputs/icinga2/icinga2.go index 408aed560..e31c1585f 100644 --- a/plugins/inputs/icinga2/icinga2.go +++ b/plugins/inputs/icinga2/icinga2.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/infiniband/infiniband.go b/plugins/inputs/infiniband/infiniband.go index a33a05db1..da50036c6 100644 --- a/plugins/inputs/infiniband/infiniband.go +++ b/plugins/inputs/infiniband/infiniband.go @@ -9,6 +9,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/influxdb_listener/influxdb_listener.go b/plugins/inputs/influxdb_listener/influxdb_listener.go index f2cfdf6fe..dc73b3c1f 100644 --- a/plugins/inputs/influxdb_listener/influxdb_listener.go +++ b/plugins/inputs/influxdb_listener/influxdb_listener.go @@ -23,6 +23,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/influxdb_v2_listener/influxdb_v2_listener.go b/plugins/inputs/influxdb_v2_listener/influxdb_v2_listener.go index fc8abf0df..8feec8d3c 100644 --- a/plugins/inputs/influxdb_v2_listener/influxdb_v2_listener.go +++ b/plugins/inputs/influxdb_v2_listener/influxdb_v2_listener.go @@ -25,6 +25,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/intel_pmu/intel_pmu.go b/plugins/inputs/intel_pmu/intel_pmu.go index 6728a7c94..e8a60cf67 100644 --- a/plugins/inputs/intel_pmu/intel_pmu.go +++ b/plugins/inputs/intel_pmu/intel_pmu.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/intel_powerstat/intel_powerstat.go b/plugins/inputs/intel_powerstat/intel_powerstat.go index 386835669..2abc70588 100644 --- a/plugins/inputs/intel_powerstat/intel_powerstat.go +++ b/plugins/inputs/intel_powerstat/intel_powerstat.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/intel_rdt/intel_rdt.go b/plugins/inputs/intel_rdt/intel_rdt.go index aeb39b8ef..3dcdfe15c 100644 --- a/plugins/inputs/intel_rdt/intel_rdt.go +++ b/plugins/inputs/intel_rdt/intel_rdt.go @@ -27,6 +27,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/internet_speed/internet_speed.go b/plugins/inputs/internet_speed/internet_speed.go index 600d72d4a..d880fb8c5 100644 --- a/plugins/inputs/internet_speed/internet_speed.go +++ b/plugins/inputs/internet_speed/internet_speed.go @@ -13,6 +13,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/interrupts/interrupts.go b/plugins/inputs/interrupts/interrupts.go index a51e57061..424b5797a 100644 --- a/plugins/inputs/interrupts/interrupts.go +++ b/plugins/inputs/interrupts/interrupts.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ipmi_sensor/ipmi_sensor.go b/plugins/inputs/ipmi_sensor/ipmi_sensor.go index ade0a7f19..78756cddc 100644 --- a/plugins/inputs/ipmi_sensor/ipmi_sensor.go +++ b/plugins/inputs/ipmi_sensor/ipmi_sensor.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ipset/ipset.go b/plugins/inputs/ipset/ipset.go index bbcbf1f4e..91b19031a 100644 --- a/plugins/inputs/ipset/ipset.go +++ b/plugins/inputs/ipset/ipset.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/iptables/iptables.go b/plugins/inputs/iptables/iptables.go index eb29c5107..bc29fbbcd 100644 --- a/plugins/inputs/iptables/iptables.go +++ b/plugins/inputs/iptables/iptables.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ipvs/ipvs.go b/plugins/inputs/ipvs/ipvs.go index 9d737dc46..2754d7f15 100644 --- a/plugins/inputs/ipvs/ipvs.go +++ b/plugins/inputs/ipvs/ipvs.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/jenkins/jenkins.go b/plugins/inputs/jenkins/jenkins.go index b30359585..476b3da61 100644 --- a/plugins/inputs/jenkins/jenkins.go +++ b/plugins/inputs/jenkins/jenkins.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/jolokia/jolokia.go b/plugins/inputs/jolokia/jolokia.go index 625bfb55c..faed59323 100644 --- a/plugins/inputs/jolokia/jolokia.go +++ b/plugins/inputs/jolokia/jolokia.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/jolokia/jolokia_test.go b/plugins/inputs/jolokia/jolokia_test.go index 084a84577..48a76963f 100644 --- a/plugins/inputs/jolokia/jolokia_test.go +++ b/plugins/inputs/jolokia/jolokia_test.go @@ -122,11 +122,13 @@ func (c jolokiaClientStub) MakeRequest(_ *http.Request) (*http.Response, error) // Generates a pointer to an HttpJson object that uses a mock HTTP client. // Parameters: -// response : Body of the response that the mock HTTP client should return -// statusCode: HTTP status code the mock HTTP client should return +// +// response : Body of the response that the mock HTTP client should return +// statusCode: HTTP status code the mock HTTP client should return // // Returns: -// *HttpJson: Pointer to an HttpJson object that uses the generated mock HTTP client +// +// *HttpJson: Pointer to an HttpJson object that uses the generated mock HTTP client func genJolokiaClientStub(response string, statusCode int, servers []Server, metrics []Metric) *Jolokia { return &Jolokia{ jClient: jolokiaClientStub{responseBody: response, statusCode: statusCode}, diff --git a/plugins/inputs/jolokia2/common/client.go b/plugins/inputs/jolokia2/common/client.go index 6f9872075..7228c5dfb 100644 --- a/plugins/inputs/jolokia2/common/client.go +++ b/plugins/inputs/jolokia2/common/client.go @@ -55,14 +55,14 @@ type ReadResponse struct { RequestTarget string } -// Jolokia JSON request object. Example: { -// "type": "read", -// "mbean: "java.lang:type="Runtime", -// "attribute": "Uptime", -// "target": { -// "url: "service:jmx:rmi:///jndi/rmi://target:9010/jmxrmi" -// } -// } +// Jolokia JSON request object. Example: { +// "type": "read", +// "mbean: "java.lang:type="Runtime", +// "attribute": "Uptime", +// "target": { +// "url: "service:jmx:rmi:///jndi/rmi://target:9010/jmxrmi" +// } +// } type jolokiaRequest struct { Type string `json:"type"` Mbean string `json:"mbean"` @@ -77,19 +77,19 @@ type jolokiaTarget struct { Password string `json:"password,omitempty"` } -// Jolokia JSON response object. Example: { -// "request": { -// "type": "read" -// "mbean": "java.lang:type=Runtime", -// "attribute": "Uptime", -// "target": { -// "url": "service:jmx:rmi:///jndi/rmi://target:9010/jmxrmi" -// } -// }, -// "value": 1214083, -// "timestamp": 1488059309, -// "status": 200 -// } +// Jolokia JSON response object. Example: { +// "request": { +// "type": "read" +// "mbean": "java.lang:type=Runtime", +// "attribute": "Uptime", +// "target": { +// "url": "service:jmx:rmi:///jndi/rmi://target:9010/jmxrmi" +// } +// }, +// "value": 1214083, +// "timestamp": 1488059309, +// "status": 200 +// } type jolokiaResponse struct { Request jolokiaRequest `json:"request"` Value interface{} `json:"value"` diff --git a/plugins/inputs/jti_openconfig_telemetry/auth/authentication_service.pb.go b/plugins/inputs/jti_openconfig_telemetry/auth/authentication_service.pb.go index 134275888..54d990103 100644 --- a/plugins/inputs/jti_openconfig_telemetry/auth/authentication_service.pb.go +++ b/plugins/inputs/jti_openconfig_telemetry/auth/authentication_service.pb.go @@ -84,7 +84,6 @@ func (x *LoginRequest) GetClientId() string { return "" } -// // The response message containing the result of login attempt. // result value of true indicates success and false indicates // failure diff --git a/plugins/inputs/jti_openconfig_telemetry/jti_openconfig_telemetry.go b/plugins/inputs/jti_openconfig_telemetry/jti_openconfig_telemetry.go index e907e04a9..86f8bf8d8 100644 --- a/plugins/inputs/jti_openconfig_telemetry/jti_openconfig_telemetry.go +++ b/plugins/inputs/jti_openconfig_telemetry/jti_openconfig_telemetry.go @@ -26,6 +26,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/jti_openconfig_telemetry/oc/oc.pb.go b/plugins/inputs/jti_openconfig_telemetry/oc/oc.pb.go index 19d16dccc..9e07a21c5 100644 --- a/plugins/inputs/jti_openconfig_telemetry/oc/oc.pb.go +++ b/plugins/inputs/jti_openconfig_telemetry/oc/oc.pb.go @@ -640,8 +640,8 @@ func (x *SubscriptionResponse) GetSubscriptionId() uint32 { return 0 } -// 2. Telemetry data send back on the same connection as the -// subscription request. +// 2. Telemetry data send back on the same connection as the +// subscription request. type OpenConfigData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/plugins/inputs/kafka_consumer/kafka_consumer.go b/plugins/inputs/kafka_consumer/kafka_consumer.go index 3c716f0c3..04f812bad 100644 --- a/plugins/inputs/kafka_consumer/kafka_consumer.go +++ b/plugins/inputs/kafka_consumer/kafka_consumer.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy.go b/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy.go index 6a4abc8eb..920a01b05 100644 --- a/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy.go +++ b/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy_integration_test.go b/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy_integration_test.go index 1a74b2e8b..3dbb4be64 100644 --- a/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy_integration_test.go +++ b/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy_integration_test.go @@ -78,8 +78,9 @@ func TestReadsMetricsFromKafkaIntegration(t *testing.T) { } } -//nolint:unused // Used in skipped tests // Waits for the metric that was sent to the kafka broker to arrive at the kafka consumer +// +//nolint:unused // Used in skipped tests func waitForPoint(acc *testutil.Accumulator, t *testing.T) { // Give the kafka container up to 2 seconds to get the point to the consumer ticker := time.NewTicker(5 * time.Millisecond) diff --git a/plugins/inputs/kapacitor/kapacitor.go b/plugins/inputs/kapacitor/kapacitor.go index f18870ccd..c27d713e3 100644 --- a/plugins/inputs/kapacitor/kapacitor.go +++ b/plugins/inputs/kapacitor/kapacitor.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -126,11 +127,13 @@ type stats struct { // Gathers data from a particular URL // Parameters: -// acc : The telegraf Accumulator to use -// url : endpoint to send request to +// +// acc : The telegraf Accumulator to use +// url : endpoint to send request to // // Returns: -// error: Any error that may have occurred +// +// error: Any error that may have occurred func (k *Kapacitor) gatherURL( acc telegraf.Accumulator, url string, diff --git a/plugins/inputs/kernel/kernel.go b/plugins/inputs/kernel/kernel.go index 2b60d6338..e2c843acc 100644 --- a/plugins/inputs/kernel/kernel.go +++ b/plugins/inputs/kernel/kernel.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/kernel_vmstat/kernel_vmstat.go b/plugins/inputs/kernel_vmstat/kernel_vmstat.go index 0c3f44695..3c8d1701f 100644 --- a/plugins/inputs/kernel_vmstat/kernel_vmstat.go +++ b/plugins/inputs/kernel_vmstat/kernel_vmstat.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/kibana/kibana.go b/plugins/inputs/kibana/kibana.go index c859d0df4..ec59dac2c 100644 --- a/plugins/inputs/kibana/kibana.go +++ b/plugins/inputs/kibana/kibana.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/knx_listener/knx_listener.go b/plugins/inputs/knx_listener/knx_listener.go index e03a072b3..7139aa4ff 100644 --- a/plugins/inputs/knx_listener/knx_listener.go +++ b/plugins/inputs/knx_listener/knx_listener.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/kube_inventory/kube_inventory.go b/plugins/inputs/kube_inventory/kube_inventory.go index 963c7deee..cd7f72442 100644 --- a/plugins/inputs/kube_inventory/kube_inventory.go +++ b/plugins/inputs/kube_inventory/kube_inventory.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/kubernetes/kubernetes.go b/plugins/inputs/kubernetes/kubernetes.go index 4d28cc1da..7823d0b60 100644 --- a/plugins/inputs/kubernetes/kubernetes.go +++ b/plugins/inputs/kubernetes/kubernetes.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -74,7 +75,7 @@ func (k *Kubernetes) Init() error { return nil } -//Gather collects kubernetes metrics from a given URL +// Gather collects kubernetes metrics from a given URL func (k *Kubernetes) Gather(acc telegraf.Accumulator) error { acc.AddError(k.gatherSummary(k.URL, acc)) return nil diff --git a/plugins/inputs/lanz/lanz.go b/plugins/inputs/lanz/lanz.go index af0d53045..4d6ee21f7 100644 --- a/plugins/inputs/lanz/lanz.go +++ b/plugins/inputs/lanz/lanz.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/leofs/leofs.go b/plugins/inputs/leofs/leofs.go index fea0f99af..2d3aae0cc 100644 --- a/plugins/inputs/leofs/leofs.go +++ b/plugins/inputs/leofs/leofs.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/leofs/leofs_test.go b/plugins/inputs/leofs/leofs_test.go index b0825b7e4..9098e39b7 100644 --- a/plugins/inputs/leofs/leofs_test.go +++ b/plugins/inputs/leofs/leofs_test.go @@ -137,9 +137,12 @@ func testMain(t *testing.T, code string, endpoint string, serverType ServerType) require.NoError(t, exec.Command("go", "build", "-o", executable, src).Run()) defer os.Remove("./" + executable) + currentWorkingDirectory, err := os.Getwd() + require.NoError(t, err) + envPathOrigin := os.Getenv("PATH") // Refer to the fake snmpwalk - require.NoError(t, os.Setenv("PATH", ".")) + require.NoError(t, os.Setenv("PATH", currentWorkingDirectory)) defer os.Setenv("PATH", envPathOrigin) l := &LeoFS{ @@ -149,7 +152,7 @@ func testMain(t *testing.T, code string, endpoint string, serverType ServerType) var acc testutil.Accumulator acc.SetDebug(true) - err := acc.GatherError(l.Gather) + err = acc.GatherError(l.Gather) require.NoError(t, err) floatMetrics := KeyMapping[serverType] diff --git a/plugins/inputs/linux_sysctl_fs/linux_sysctl_fs.go b/plugins/inputs/linux_sysctl_fs/linux_sysctl_fs.go index 6050dae8b..34b636f51 100644 --- a/plugins/inputs/linux_sysctl_fs/linux_sysctl_fs.go +++ b/plugins/inputs/linux_sysctl_fs/linux_sysctl_fs.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/logparser/logparser.go b/plugins/inputs/logparser/logparser.go index d297393a9..42b9e8f42 100644 --- a/plugins/inputs/logparser/logparser.go +++ b/plugins/inputs/logparser/logparser.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/logstash/logstash.go b/plugins/inputs/logstash/logstash.go index 8d58c62b4..b2159bbd6 100644 --- a/plugins/inputs/logstash/logstash.go +++ b/plugins/inputs/logstash/logstash.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/lustre2/lustre2.go b/plugins/inputs/lustre2/lustre2.go index 7f7645c13..58f456c76 100644 --- a/plugins/inputs/lustre2/lustre2.go +++ b/plugins/inputs/lustre2/lustre2.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -38,9 +39,12 @@ type Lustre2 struct { allFields map[tags]map[string]interface{} } -/* The wanted fields would be a []string if not for the +/* + The wanted fields would be a []string if not for the + lines that start with read_bytes/write_bytes and contain - both the byte count and the function call count + + both the byte count and the function call count */ type mapping struct { inProc string // What to look for at the start of a line in /proc/fs/lustre/* diff --git a/plugins/inputs/lvm/lvm.go b/plugins/inputs/lvm/lvm.go index e77dab460..0026a4dd3 100644 --- a/plugins/inputs/lvm/lvm.go +++ b/plugins/inputs/lvm/lvm.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mailchimp/mailchimp.go b/plugins/inputs/mailchimp/mailchimp.go index 65b286b7e..83b6e8bbc 100644 --- a/plugins/inputs/mailchimp/mailchimp.go +++ b/plugins/inputs/mailchimp/mailchimp.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/marklogic/marklogic.go b/plugins/inputs/marklogic/marklogic.go index cbf09f1d1..e03423bf0 100644 --- a/plugins/inputs/marklogic/marklogic.go +++ b/plugins/inputs/marklogic/marklogic.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mcrouter/mcrouter.go b/plugins/inputs/mcrouter/mcrouter.go index 956230ae7..830772d13 100644 --- a/plugins/inputs/mcrouter/mcrouter.go +++ b/plugins/inputs/mcrouter/mcrouter.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mdstat/mdstat.go b/plugins/inputs/mdstat/mdstat.go index 0d1eb9409..0cdc59f94 100644 --- a/plugins/inputs/mdstat/mdstat.go +++ b/plugins/inputs/mdstat/mdstat.go @@ -33,6 +33,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mem/mem.go b/plugins/inputs/mem/mem.go index 961a02ed1..b8b3c65ef 100644 --- a/plugins/inputs/mem/mem.go +++ b/plugins/inputs/mem/mem.go @@ -12,6 +12,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/memcached/memcached.go b/plugins/inputs/memcached/memcached.go index b52d5e7b4..237abf234 100644 --- a/plugins/inputs/memcached/memcached.go +++ b/plugins/inputs/memcached/memcached.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mesos/mesos.go b/plugins/inputs/mesos/mesos.go index f0f0f102d..ebfefd52d 100644 --- a/plugins/inputs/mesos/mesos.go +++ b/plugins/inputs/mesos/mesos.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/minecraft/minecraft.go b/plugins/inputs/minecraft/minecraft.go index 490bf188f..1fb878421 100644 --- a/plugins/inputs/minecraft/minecraft.go +++ b/plugins/inputs/minecraft/minecraft.go @@ -9,6 +9,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mock/mock.go b/plugins/inputs/mock/mock.go index 3861a18c7..b194c1555 100644 --- a/plugins/inputs/mock/mock.go +++ b/plugins/inputs/mock/mock.go @@ -12,6 +12,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/modbus/configuration_register.go b/plugins/inputs/modbus/configuration_register.go index 87275675a..fe753a628 100644 --- a/plugins/inputs/modbus/configuration_register.go +++ b/plugins/inputs/modbus/configuration_register.go @@ -6,6 +6,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample_register.conf var sampleConfigPartPerRegister string diff --git a/plugins/inputs/modbus/configuration_request.go b/plugins/inputs/modbus/configuration_request.go index eed4e8556..c98624285 100644 --- a/plugins/inputs/modbus/configuration_request.go +++ b/plugins/inputs/modbus/configuration_request.go @@ -8,6 +8,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample_request.conf var sampleConfigPartPerRequest string diff --git a/plugins/inputs/modbus/modbus.go b/plugins/inputs/modbus/modbus.go index bf2537d4e..cba03406c 100644 --- a/plugins/inputs/modbus/modbus.go +++ b/plugins/inputs/modbus/modbus.go @@ -18,10 +18,12 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample_general_begin.conf var sampleConfigStart string // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample_general_end.conf var sampleConfigEnd string diff --git a/plugins/inputs/mongodb/mongodb.go b/plugins/inputs/mongodb/mongodb.go index c131fe0ac..7b3fa33f8 100644 --- a/plugins/inputs/mongodb/mongodb.go +++ b/plugins/inputs/mongodb/mongodb.go @@ -23,6 +23,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/monit/monit.go b/plugins/inputs/monit/monit.go index 3c78bf84e..e6f3fa445 100644 --- a/plugins/inputs/monit/monit.go +++ b/plugins/inputs/monit/monit.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mqtt_consumer/mqtt_consumer.go b/plugins/inputs/mqtt_consumer/mqtt_consumer.go index adc6ff029..b8aa22172 100644 --- a/plugins/inputs/mqtt_consumer/mqtt_consumer.go +++ b/plugins/inputs/mqtt_consumer/mqtt_consumer.go @@ -23,6 +23,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/multifile/multifile.go b/plugins/inputs/multifile/multifile.go index 159e103c9..ed8454bfe 100644 --- a/plugins/inputs/multifile/multifile.go +++ b/plugins/inputs/multifile/multifile.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mysql/mysql.go b/plugins/inputs/mysql/mysql.go index f5dc343ce..5b39691a9 100644 --- a/plugins/inputs/mysql/mysql.go +++ b/plugins/inputs/mysql/mysql.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nats/nats.go b/plugins/inputs/nats/nats.go index 1a92f2ea0..b5966fafa 100644 --- a/plugins/inputs/nats/nats.go +++ b/plugins/inputs/nats/nats.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nats_consumer/nats_consumer.go b/plugins/inputs/nats_consumer/nats_consumer.go index 8105ff9b2..3643252aa 100644 --- a/plugins/inputs/nats_consumer/nats_consumer.go +++ b/plugins/inputs/nats_consumer/nats_consumer.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/neptune_apex/neptune_apex.go b/plugins/inputs/neptune_apex/neptune_apex.go index 1dde25741..3295bb691 100644 --- a/plugins/inputs/neptune_apex/neptune_apex.go +++ b/plugins/inputs/neptune_apex/neptune_apex.go @@ -1,6 +1,7 @@ -//go:generate ../../../tools/readme_config_includer/generator // Package neptune_apex implements an input plugin for the Neptune Apex // aquarium controller. +// +//go:generate ../../../tools/readme_config_includer/generator package neptune_apex import ( @@ -21,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -89,7 +91,7 @@ func (n *NeptuneApex) gatherServer( } // parseXML is strict on the input and does not do best-effort parsing. -//This is because of the life-support nature of the Neptune Apex. +// This is because of the life-support nature of the Neptune Apex. func (n *NeptuneApex) parseXML(acc telegraf.Accumulator, data []byte) error { r := xmlReply{} err := xml.Unmarshal(data, &r) diff --git a/plugins/inputs/net/net.go b/plugins/inputs/net/net.go index d3e1cae22..346420331 100644 --- a/plugins/inputs/net/net.go +++ b/plugins/inputs/net/net.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/net_response/net_response.go b/plugins/inputs/net_response/net_response.go index a3cb1467b..7cd2609f3 100644 --- a/plugins/inputs/net_response/net_response.go +++ b/plugins/inputs/net_response/net_response.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/netstat/netstat.go b/plugins/inputs/netstat/netstat.go index 8727b1333..932f84390 100644 --- a/plugins/inputs/netstat/netstat.go +++ b/plugins/inputs/netstat/netstat.go @@ -12,6 +12,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nfsclient/nfsclient.go b/plugins/inputs/nfsclient/nfsclient.go index 07060a603..394840ddb 100644 --- a/plugins/inputs/nfsclient/nfsclient.go +++ b/plugins/inputs/nfsclient/nfsclient.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nginx/nginx.go b/plugins/inputs/nginx/nginx.go index cfa378f0f..a55f1b1dc 100644 --- a/plugins/inputs/nginx/nginx.go +++ b/plugins/inputs/nginx/nginx.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nginx_plus/nginx_plus.go b/plugins/inputs/nginx_plus/nginx_plus.go index dd073590d..dac7eaa60 100644 --- a/plugins/inputs/nginx_plus/nginx_plus.go +++ b/plugins/inputs/nginx_plus/nginx_plus.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nginx_plus_api/nginx_plus_api.go b/plugins/inputs/nginx_plus_api/nginx_plus_api.go index b50ef5cf3..f14278023 100644 --- a/plugins/inputs/nginx_plus_api/nginx_plus_api.go +++ b/plugins/inputs/nginx_plus_api/nginx_plus_api.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nginx_sts/nginx_sts.go b/plugins/inputs/nginx_sts/nginx_sts.go index 7a6ff25bf..de52cf7bf 100644 --- a/plugins/inputs/nginx_sts/nginx_sts.go +++ b/plugins/inputs/nginx_sts/nginx_sts.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nginx_upstream_check/nginx_upstream_check.go b/plugins/inputs/nginx_upstream_check/nginx_upstream_check.go index 457487cd0..b7fbb3710 100644 --- a/plugins/inputs/nginx_upstream_check/nginx_upstream_check.go +++ b/plugins/inputs/nginx_upstream_check/nginx_upstream_check.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nginx_vts/nginx_vts.go b/plugins/inputs/nginx_vts/nginx_vts.go index 62fe23b2b..55fc19841 100644 --- a/plugins/inputs/nginx_vts/nginx_vts.go +++ b/plugins/inputs/nginx_vts/nginx_vts.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nomad/nomad.go b/plugins/inputs/nomad/nomad.go index 8e8b446c0..fc1f43783 100644 --- a/plugins/inputs/nomad/nomad.go +++ b/plugins/inputs/nomad/nomad.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nsd/nsd.go b/plugins/inputs/nsd/nsd.go index 3f8832ae3..c5e36554c 100644 --- a/plugins/inputs/nsd/nsd.go +++ b/plugins/inputs/nsd/nsd.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nsq/nsq.go b/plugins/inputs/nsq/nsq.go index f14cb4bd2..c447bdb52 100644 --- a/plugins/inputs/nsq/nsq.go +++ b/plugins/inputs/nsq/nsq.go @@ -40,6 +40,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nsq_consumer/nsq_consumer.go b/plugins/inputs/nsq_consumer/nsq_consumer.go index 5967e7a21..d0a7b00b1 100644 --- a/plugins/inputs/nsq_consumer/nsq_consumer.go +++ b/plugins/inputs/nsq_consumer/nsq_consumer.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -34,7 +35,7 @@ func (l *logger) Output(_ int, s string) error { return nil } -//NSQConsumer represents the configuration of the plugin +// NSQConsumer represents the configuration of the plugin type NSQConsumer struct { Server string `toml:"server" deprecated:"1.5.0;use 'nsqd' instead"` Nsqd []string `toml:"nsqd"` diff --git a/plugins/inputs/nstat/nstat.go b/plugins/inputs/nstat/nstat.go index 867fa2ae6..432a99448 100644 --- a/plugins/inputs/nstat/nstat.go +++ b/plugins/inputs/nstat/nstat.go @@ -12,6 +12,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nvidia_smi/nvidia_smi.go b/plugins/inputs/nvidia_smi/nvidia_smi.go index d44d1ad82..d0d5ebc2e 100644 --- a/plugins/inputs/nvidia_smi/nvidia_smi.go +++ b/plugins/inputs/nvidia_smi/nvidia_smi.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/openldap/openldap.go b/plugins/inputs/openldap/openldap.go index f08d3b8f5..8764ab9c9 100644 --- a/plugins/inputs/openldap/openldap.go +++ b/plugins/inputs/openldap/openldap.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/openntpd/openntpd.go b/plugins/inputs/openntpd/openntpd.go index d95422134..e56847c74 100644 --- a/plugins/inputs/openntpd/openntpd.go +++ b/plugins/inputs/openntpd/openntpd.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/opensmtpd/opensmtpd.go b/plugins/inputs/opensmtpd/opensmtpd.go index c9e5ffe52..e4ca79ee9 100644 --- a/plugins/inputs/opensmtpd/opensmtpd.go +++ b/plugins/inputs/opensmtpd/opensmtpd.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -59,7 +60,6 @@ func opensmtpdRunner(cmdName string, timeout config.Duration, useSudo bool) (*by // Gather collects the configured stats from smtpctl and adds them to the // Accumulator -// func (*Opensmtpd) SampleConfig() string { return sampleConfig } diff --git a/plugins/inputs/openstack/openstack.go b/plugins/inputs/openstack/openstack.go index 9aee9e224..c98f08d16 100644 --- a/plugins/inputs/openstack/openstack.go +++ b/plugins/inputs/openstack/openstack.go @@ -1,4 +1,3 @@ -//go:generate ../../../tools/readme_config_includer/generator // Package openstack implements an OpenStack input plugin for Telegraf // // The OpenStack input plug is a simple two phase metric collector. In the first @@ -7,6 +6,8 @@ // // No aggregation is performed by the input plugin, instead queries to InfluxDB should // be used to gather global totals of things such as tag frequency. +// +//go:generate ../../../tools/readme_config_includer/generator package openstack import ( @@ -45,6 +46,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/opentelemetry/opentelemetry.go b/plugins/inputs/opentelemetry/opentelemetry.go index 11c0d3092..a1b3899f6 100644 --- a/plugins/inputs/opentelemetry/opentelemetry.go +++ b/plugins/inputs/opentelemetry/opentelemetry.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/openweathermap/openweathermap.go b/plugins/inputs/openweathermap/openweathermap.go index ed22bde6b..0b18e0053 100644 --- a/plugins/inputs/openweathermap/openweathermap.go +++ b/plugins/inputs/openweathermap/openweathermap.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/passenger/passenger.go b/plugins/inputs/passenger/passenger.go index 170a33255..072c682c7 100644 --- a/plugins/inputs/passenger/passenger.go +++ b/plugins/inputs/passenger/passenger.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/pf/pf.go b/plugins/inputs/pf/pf.go index b510842b3..0f77e7116 100644 --- a/plugins/inputs/pf/pf.go +++ b/plugins/inputs/pf/pf.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/pgbouncer/pgbouncer.go b/plugins/inputs/pgbouncer/pgbouncer.go index 5f68eddce..a6e8e172f 100644 --- a/plugins/inputs/pgbouncer/pgbouncer.go +++ b/plugins/inputs/pgbouncer/pgbouncer.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/phpfpm/phpfpm.go b/plugins/inputs/phpfpm/phpfpm.go index bba87a793..c6338e6dd 100644 --- a/plugins/inputs/phpfpm/phpfpm.go +++ b/plugins/inputs/phpfpm/phpfpm.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/phpfpm/phpfpm_test.go b/plugins/inputs/phpfpm/phpfpm_test.go index 14d03dd3f..680ba9d30 100644 --- a/plugins/inputs/phpfpm/phpfpm_test.go +++ b/plugins/inputs/phpfpm/phpfpm_test.go @@ -272,8 +272,8 @@ func TestPhpFpmGeneratesMetrics_From_Socket_Custom_Status_Path(t *testing.T) { acc.AssertContainsTaggedFields(t, "phpfpm", fields, tags) } -//When not passing server config, we default to localhost -//We just want to make sure we did request stat from localhost +// When not passing server config, we default to localhost +// We just want to make sure we did request stat from localhost func TestPhpFpmDefaultGetFromLocalhost(t *testing.T) { r := &phpfpm{Urls: []string{"http://bad.localhost:62001/status"}} diff --git a/plugins/inputs/ping/ping.go b/plugins/inputs/ping/ping.go index 42a7cbbef..1498e05fb 100644 --- a/plugins/inputs/ping/ping.go +++ b/plugins/inputs/ping/ping.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ping/ping_notwindows.go b/plugins/inputs/ping/ping_notwindows.go index c09c4a3fc..3d5644950 100644 --- a/plugins/inputs/ping/ping_notwindows.go +++ b/plugins/inputs/ping/ping_notwindows.go @@ -156,13 +156,13 @@ func (p *Ping) args(url string, system string) []string { // processPingOutput takes in a string output from the ping command, like: // -// ping www.google.com (173.194.115.84): 56 data bytes -// 64 bytes from 173.194.115.84: icmp_seq=0 ttl=54 time=52.172 ms -// 64 bytes from 173.194.115.84: icmp_seq=1 ttl=54 time=34.843 ms +// ping www.google.com (173.194.115.84): 56 data bytes +// 64 bytes from 173.194.115.84: icmp_seq=0 ttl=54 time=52.172 ms +// 64 bytes from 173.194.115.84: icmp_seq=1 ttl=54 time=34.843 ms // -// --- www.google.com ping statistics --- -// 2 packets transmitted, 2 packets received, 0.0% packet loss -// round-trip min/avg/max/stddev = 34.843/43.508/52.172/8.664 ms +// --- www.google.com ping statistics --- +// 2 packets transmitted, 2 packets received, 0.0% packet loss +// round-trip min/avg/max/stddev = 34.843/43.508/52.172/8.664 ms // // It returns (, , ) func processPingOutput(out string) (stats, error) { diff --git a/plugins/inputs/postfix/postfix.go b/plugins/inputs/postfix/postfix.go index fd6c149b2..6b569ebfe 100644 --- a/plugins/inputs/postfix/postfix.go +++ b/plugins/inputs/postfix/postfix.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/postgresql/postgresql.go b/plugins/inputs/postgresql/postgresql.go index e9a2fd815..8e397c84e 100644 --- a/plugins/inputs/postgresql/postgresql.go +++ b/plugins/inputs/postgresql/postgresql.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/postgresql_extensible/postgresql_extensible.go b/plugins/inputs/postgresql_extensible/postgresql_extensible.go index 3109f1d6a..a3925e736 100644 --- a/plugins/inputs/postgresql_extensible/postgresql_extensible.go +++ b/plugins/inputs/postgresql_extensible/postgresql_extensible.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/powerdns/powerdns.go b/plugins/inputs/powerdns/powerdns.go index 2a5abce09..e2c93e5e0 100644 --- a/plugins/inputs/powerdns/powerdns.go +++ b/plugins/inputs/powerdns/powerdns.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/powerdns_recursor/powerdns_recursor.go b/plugins/inputs/powerdns_recursor/powerdns_recursor.go index 61637bd46..77a2688d0 100644 --- a/plugins/inputs/powerdns_recursor/powerdns_recursor.go +++ b/plugins/inputs/powerdns_recursor/powerdns_recursor.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/processes/processes.go b/plugins/inputs/processes/processes.go index 2f5551e11..061af1221 100644 --- a/plugins/inputs/processes/processes.go +++ b/plugins/inputs/processes/processes.go @@ -3,6 +3,7 @@ package processes import _ "embed" // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/processes/processes_test.go b/plugins/inputs/processes/processes_test.go index 7fc0a76da..fd4bfeb79 100644 --- a/plugins/inputs/processes/processes_test.go +++ b/plugins/inputs/processes/processes_test.go @@ -18,8 +18,8 @@ import ( func TestProcesses(t *testing.T) { tester := tester{} processes := &Processes{ - Log: testutil.Logger{}, - execPS: testExecPS("STAT\n Ss \n S \n Z \n R \n S< \n SNs \n Ss+ \n \n \n"), + Log: testutil.Logger{}, + execPS: testExecPS("STAT\n Ss \n S \n Z \n R \n S< \n SNs \n Ss+ \n \n \n"), readProcFile: tester.testProcFile, } var acc testutil.Accumulator diff --git a/plugins/inputs/procstat/native_finder.go b/plugins/inputs/procstat/native_finder.go index 041e2cae9..7307197ae 100644 --- a/plugins/inputs/procstat/native_finder.go +++ b/plugins/inputs/procstat/native_finder.go @@ -10,16 +10,16 @@ import ( "github.com/shirou/gopsutil/v3/process" ) -//NativeFinder uses gopsutil to find processes +// NativeFinder uses gopsutil to find processes type NativeFinder struct { } -//NewNativeFinder ... +// NewNativeFinder ... func NewNativeFinder() (PIDFinder, error) { return &NativeFinder{}, nil } -//Uid will return all pids for the given user +// Uid will return all pids for the given user func (pg *NativeFinder) UID(user string) ([]PID, error) { var dst []PID procs, err := process.Processes() @@ -40,7 +40,7 @@ func (pg *NativeFinder) UID(user string) ([]PID, error) { return dst, nil } -//PidFile returns the pid from the pid file given. +// PidFile returns the pid from the pid file given. func (pg *NativeFinder) PidFile(path string) ([]PID, error) { var pids []PID pidString, err := os.ReadFile(path) @@ -56,7 +56,7 @@ func (pg *NativeFinder) PidFile(path string) ([]PID, error) { return pids, nil } -//FullPattern matches on the command line when the process was executed +// FullPattern matches on the command line when the process was executed func (pg *NativeFinder) FullPattern(pattern string) ([]PID, error) { var pids []PID regxPattern, err := regexp.Compile(pattern) diff --git a/plugins/inputs/procstat/native_finder_notwindows.go b/plugins/inputs/procstat/native_finder_notwindows.go index 528b083ae..89af58799 100644 --- a/plugins/inputs/procstat/native_finder_notwindows.go +++ b/plugins/inputs/procstat/native_finder_notwindows.go @@ -7,7 +7,7 @@ import ( "regexp" ) -//Pattern matches on the process name +// Pattern matches on the process name func (pg *NativeFinder) Pattern(pattern string) ([]PID, error) { var pids []PID regxPattern, err := regexp.Compile(pattern) diff --git a/plugins/inputs/procstat/procstat.go b/plugins/inputs/procstat/procstat.go index 79047cfa8..04d9c669d 100644 --- a/plugins/inputs/procstat/procstat.go +++ b/plugins/inputs/procstat/procstat.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/prometheus/prometheus.go b/plugins/inputs/prometheus/prometheus.go index ed9a46e0d..9185d9736 100644 --- a/plugins/inputs/prometheus/prometheus.go +++ b/plugins/inputs/prometheus/prometheus.go @@ -27,6 +27,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/proxmox/proxmox.go b/plugins/inputs/proxmox/proxmox.go index 369d9d1f8..3383c6f2d 100644 --- a/plugins/inputs/proxmox/proxmox.go +++ b/plugins/inputs/proxmox/proxmox.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/puppetagent/puppetagent.go b/plugins/inputs/puppetagent/puppetagent.go index 61a03298a..a1fdb18ab 100644 --- a/plugins/inputs/puppetagent/puppetagent.go +++ b/plugins/inputs/puppetagent/puppetagent.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/rabbitmq/rabbitmq.go b/plugins/inputs/rabbitmq/rabbitmq.go index 5fdf1b51c..1863abaab 100644 --- a/plugins/inputs/rabbitmq/rabbitmq.go +++ b/plugins/inputs/rabbitmq/rabbitmq.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/raindrops/raindrops.go b/plugins/inputs/raindrops/raindrops.go index 6f6a95eb2..1a8d12bee 100644 --- a/plugins/inputs/raindrops/raindrops.go +++ b/plugins/inputs/raindrops/raindrops.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ras/ras.go b/plugins/inputs/ras/ras.go index b8812fbc5..2fbf2d445 100644 --- a/plugins/inputs/ras/ras.go +++ b/plugins/inputs/ras/ras.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ravendb/ravendb.go b/plugins/inputs/ravendb/ravendb.go index e96c336d4..3006345be 100644 --- a/plugins/inputs/ravendb/ravendb.go +++ b/plugins/inputs/ravendb/ravendb.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/redfish/redfish.go b/plugins/inputs/redfish/redfish.go index 55dea5e17..bd35b8b90 100644 --- a/plugins/inputs/redfish/redfish.go +++ b/plugins/inputs/redfish/redfish.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/redis/redis.go b/plugins/inputs/redis/redis.go index 70f815f31..6aab3c8b6 100644 --- a/plugins/inputs/redis/redis.go +++ b/plugins/inputs/redis/redis.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -476,7 +477,9 @@ func gatherInfoOutput( // Parse the special Keyspace line at end of redis stats // This is a special line that looks something like: -// db0:keys=2,expires=0,avg_ttl=0 +// +// db0:keys=2,expires=0,avg_ttl=0 +// // And there is one for each db on the redis instance func gatherKeyspaceLine( name string, @@ -505,7 +508,9 @@ func gatherKeyspaceLine( // Parse the special cmdstat lines. // Example: -// cmdstat_publish:calls=33791,usec=208789,usec_per_call=6.18 +// +// cmdstat_publish:calls=33791,usec=208789,usec_per_call=6.18 +// // Tag: cmdstat=publish; Fields: calls=33791i,usec=208789i,usec_per_call=6.18 func gatherCommandstateLine( name string, @@ -550,7 +555,9 @@ func gatherCommandstateLine( // Parse the special Replication line // Example: -// slave0:ip=127.0.0.1,port=7379,state=online,offset=4556468,lag=0 +// +// slave0:ip=127.0.0.1,port=7379,state=online,offset=4556468,lag=0 +// // This line will only be visible when a node has a replica attached. func gatherReplicationLine( name string, @@ -714,7 +721,7 @@ func (r *Redis) Start(telegraf.Accumulator) error { return nil } -//Stop close the client through ServiceInput interface Start/Stop methods impl. +// Stop close the client through ServiceInput interface Start/Stop methods impl. func (r *Redis) Stop() { for _, c := range r.clients { err := c.Close() diff --git a/plugins/inputs/redis_sentinel/redis_sentinel.go b/plugins/inputs/redis_sentinel/redis_sentinel.go index 25c624b69..04ae1b178 100644 --- a/plugins/inputs/redis_sentinel/redis_sentinel.go +++ b/plugins/inputs/redis_sentinel/redis_sentinel.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/rethinkdb/rethinkdb.go b/plugins/inputs/rethinkdb/rethinkdb.go index 6c881f99c..a7a70948a 100644 --- a/plugins/inputs/rethinkdb/rethinkdb.go +++ b/plugins/inputs/rethinkdb/rethinkdb.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/riak/riak.go b/plugins/inputs/riak/riak.go index 8d9552057..f06fd4f90 100644 --- a/plugins/inputs/riak/riak.go +++ b/plugins/inputs/riak/riak.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/riemann_listener/riemann_listener.go b/plugins/inputs/riemann_listener/riemann_listener.go index f99e0976f..35f0924e1 100644 --- a/plugins/inputs/riemann_listener/riemann_listener.go +++ b/plugins/inputs/riemann_listener/riemann_listener.go @@ -28,6 +28,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/salesforce/salesforce.go b/plugins/inputs/salesforce/salesforce.go index ec3d82c32..e78a140e7 100644 --- a/plugins/inputs/salesforce/salesforce.go +++ b/plugins/inputs/salesforce/salesforce.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/sensors/sensors.go b/plugins/inputs/sensors/sensors.go index aeddecaa0..bfda986bd 100644 --- a/plugins/inputs/sensors/sensors.go +++ b/plugins/inputs/sensors/sensors.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -69,7 +70,9 @@ func (s *Sensors) Gather(acc telegraf.Accumulator) error { } // parse forks the command: -// sensors -u -A +// +// sensors -u -A +// // and parses the output to add it to the telegraf.Accumulator. func (s *Sensors) parse(acc telegraf.Accumulator) error { tags := map[string]string{} diff --git a/plugins/inputs/sflow/sflow.go b/plugins/inputs/sflow/sflow.go index 52043a139..adcb2c295 100644 --- a/plugins/inputs/sflow/sflow.go +++ b/plugins/inputs/sflow/sflow.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/slab/slab.go b/plugins/inputs/slab/slab.go index c895c3b84..cc2d840b2 100644 --- a/plugins/inputs/slab/slab.go +++ b/plugins/inputs/slab/slab.go @@ -23,6 +23,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/smart/smart.go b/plugins/inputs/smart/smart.go index b0c755a20..4b275b291 100644 --- a/plugins/inputs/smart/smart.go +++ b/plugins/inputs/smart/smart.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/snmp/gosmi.go b/plugins/inputs/snmp/gosmi.go index f2de844ce..4de0977e2 100644 --- a/plugins/inputs/snmp/gosmi.go +++ b/plugins/inputs/snmp/gosmi.go @@ -82,6 +82,7 @@ var gosmiSnmpTableCachesLock sync.Mutex // snmpTable resolves the given OID as a table, providing information about the // table and fields within. +// //nolint:revive //Too many return variable but necessary func (g *gosmiTranslator) SnmpTable(oid string) ( mibName string, oidNum string, oidText string, diff --git a/plugins/inputs/snmp/gosmi_test.go b/plugins/inputs/snmp/gosmi_test.go index bca48ffa1..c5f4b8a4b 100644 --- a/plugins/inputs/snmp/gosmi_test.go +++ b/plugins/inputs/snmp/gosmi_test.go @@ -31,8 +31,8 @@ func TestGosmiTranslator(t *testing.T) { require.NotNil(t, tr) } -//gosmi uses the same connection struct as netsnmp but has a few -//different test cases, so it has its own copy +// gosmi uses the same connection struct as netsnmp but has a few +// different test cases, so it has its own copy var gosmiTsc = &testSNMPConnection{ host: "tsc", values: map[string]interface{}{ @@ -222,11 +222,11 @@ func TestSnmpInit_noTranslateGosmi(t *testing.T) { assert.Equal(t, false, s.Tables[0].Fields[2].IsTag) } -//TestTableBuild_walk in snmp_test.go is split into two tests here, -//noTranslate and Translate. +// TestTableBuild_walk in snmp_test.go is split into two tests here, +// noTranslate and Translate. // -//This is only running with gosmi translator but should be valid with -//netsnmp too. +// This is only running with gosmi translator but should be valid with +// netsnmp too. func TestTableBuild_walk_noTranslate(t *testing.T) { tbl := Table{ Name: "mytable", diff --git a/plugins/inputs/snmp/netsnmp.go b/plugins/inputs/snmp/netsnmp.go index 96339956f..09f56ed4a 100644 --- a/plugins/inputs/snmp/netsnmp.go +++ b/plugins/inputs/snmp/netsnmp.go @@ -12,8 +12,8 @@ import ( "github.com/influxdata/wlog" ) -//struct that implements the translator interface. This calls existing -//code to exec netsnmp's snmptranslate program +// struct that implements the translator interface. This calls existing +// code to exec netsnmp's snmptranslate program type netsnmpTranslator struct { } @@ -58,6 +58,7 @@ var snmpTableCachesLock sync.Mutex // snmpTable resolves the given OID as a table, providing information about the // table and fields within. +// //nolint:revive func (n *netsnmpTranslator) SnmpTable(oid string) ( mibName string, oidNum string, oidText string, @@ -154,6 +155,7 @@ var snmpTranslateCachesLock sync.Mutex var snmpTranslateCaches map[string]snmpTranslateCache // snmpTranslate resolves the given OID. +// //nolint:revive func (n *netsnmpTranslator) SnmpTranslate(oid string) ( mibName string, oidNum string, oidText string, diff --git a/plugins/inputs/snmp/snmp.go b/plugins/inputs/snmp/snmp.go index 5fda56fe2..d9dbf5c51 100644 --- a/plugins/inputs/snmp/snmp.go +++ b/plugins/inputs/snmp/snmp.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/snmp_legacy/snmp_legacy.go b/plugins/inputs/snmp_legacy/snmp_legacy.go index fc2f5af3a..f9bf70bc0 100644 --- a/plugins/inputs/snmp_legacy/snmp_legacy.go +++ b/plugins/inputs/snmp_legacy/snmp_legacy.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/snmp_trap/snmp_trap.go b/plugins/inputs/snmp_trap/snmp_trap.go index e7b9d413f..37e33bdd7 100644 --- a/plugins/inputs/snmp_trap/snmp_trap.go +++ b/plugins/inputs/snmp_trap/snmp_trap.go @@ -20,6 +20,7 @@ import ( var defaultTimeout = config.Duration(time.Second * 5) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/socket_listener/socket_listener.go b/plugins/inputs/socket_listener/socket_listener.go index 382326343..93cc59c3c 100644 --- a/plugins/inputs/socket_listener/socket_listener.go +++ b/plugins/inputs/socket_listener/socket_listener.go @@ -23,6 +23,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/socketstat/socketstat.go b/plugins/inputs/socketstat/socketstat.go index 3f9058822..4ab30f932 100644 --- a/plugins/inputs/socketstat/socketstat.go +++ b/plugins/inputs/socketstat/socketstat.go @@ -24,6 +24,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/solr/solr.go b/plugins/inputs/solr/solr.go index 7b4e74658..bf8eec2e4 100644 --- a/plugins/inputs/solr/solr.go +++ b/plugins/inputs/solr/solr.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/sql/sql.go b/plugins/inputs/sql/sql.go index aa4a7e9f4..454911b17 100644 --- a/plugins/inputs/sql/sql.go +++ b/plugins/inputs/sql/sql.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/sqlserver/azuresqldbqueries.go b/plugins/inputs/sqlserver/azuresqldbqueries.go index 91f9180b7..a78dad6b3 100644 --- a/plugins/inputs/sqlserver/azuresqldbqueries.go +++ b/plugins/inputs/sqlserver/azuresqldbqueries.go @@ -4,9 +4,9 @@ import ( _ "github.com/denisenkom/go-mssqldb" // go-mssqldb initialization ) -//------------------------------------------------------------------------------------------------ -//------------------ Azure SQL Database ---------------------------------------------------------- -//------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------ Azure SQL Database ---------------------------------------------------------- +// ------------------------------------------------------------------------------------------------ // Only executed if AzureDB flag is set const sqlAzureDBResourceStats string = ` IF SERVERPROPERTY('EngineEdition') <> 5 BEGIN /*not Azure SQL DB*/ diff --git a/plugins/inputs/sqlserver/azuresqlmanagedqueries.go b/plugins/inputs/sqlserver/azuresqlmanagedqueries.go index 90523e5e2..a5ebd6ea5 100644 --- a/plugins/inputs/sqlserver/azuresqlmanagedqueries.go +++ b/plugins/inputs/sqlserver/azuresqlmanagedqueries.go @@ -4,9 +4,9 @@ import ( _ "github.com/denisenkom/go-mssqldb" // go-mssqldb initialization ) -//------------------------------------------------------------------------------------------------ -//------------------ Azure Managed Instance ------------------------------------------------------ -//------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------ Azure Managed Instance ------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ const sqlAzureMIProperties = ` IF SERVERPROPERTY('EngineEdition') <> 8 BEGIN /*not Azure Managed Instance*/ DECLARE @ErrorMessage AS nvarchar(500) = 'Telegraf - Connection string Server:'+ @@SERVERNAME + ',Database:' + DB_NAME() +' is not an Azure Managed Instance. Check the database_type parameter in the telegraf configuration.'; diff --git a/plugins/inputs/sqlserver/azuresqlpoolqueries.go b/plugins/inputs/sqlserver/azuresqlpoolqueries.go index 36fe087fc..c9ffb4dfd 100644 --- a/plugins/inputs/sqlserver/azuresqlpoolqueries.go +++ b/plugins/inputs/sqlserver/azuresqlpoolqueries.go @@ -4,9 +4,9 @@ import ( _ "github.com/denisenkom/go-mssqldb" // go-mssqldb initialization ) -//------------------------------------------------------------------------------------------------ -//------------------ Azure Sql Elastic Pool ------------------------------------------------------ -//------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------ Azure Sql Elastic Pool ------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ const sqlAzurePoolResourceStats = ` IF SERVERPROPERTY('EngineEdition') <> 5 OR NOT EXISTS (SELECT 1 FROM sys.database_service_objectives WHERE database_id = DB_ID() AND elastic_pool_name IS NOT NULL) BEGIN diff --git a/plugins/inputs/sqlserver/sqlqueriesV2.go b/plugins/inputs/sqlserver/sqlqueriesV2.go index 7eefcc089..2a344e1a9 100644 --- a/plugins/inputs/sqlserver/sqlqueriesV2.go +++ b/plugins/inputs/sqlserver/sqlqueriesV2.go @@ -347,7 +347,7 @@ BEGIN ` -//Recommend disabling this by default, but is useful to detect single CPU spikes/bottlenecks +// Recommend disabling this by default, but is useful to detect single CPU spikes/bottlenecks const sqlServerSchedulersV2 string = ` SET DEADLOCK_PRIORITY - 10; @@ -388,8 +388,11 @@ EXEC sp_executesql @SqlStatement /* This string defines a SQL statements to retrieve Performance Counters as documented here - + SQL Server Performance Objects - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/use-sql-server-objects?view=sql-server-ver15#SQLServerPOs + Some of the specific objects used are - + MSSQL$*:Access Methods - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-access-methods-object?view=sql-server-ver15 MSSQL$*:Buffer Manager - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-buffer-manager-object?view=sql-server-ver15 MSSQL$*:Databases - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-databases-object?view=sql-server-ver15 diff --git a/plugins/inputs/sqlserver/sqlserver.go b/plugins/inputs/sqlserver/sqlserver.go index 5987e06a8..b2c8775f6 100644 --- a/plugins/inputs/sqlserver/sqlserver.go +++ b/plugins/inputs/sqlserver/sqlserver.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/sqlserver/sqlserverqueries.go b/plugins/inputs/sqlserver/sqlserverqueries.go index ab0e249be..8d7808139 100644 --- a/plugins/inputs/sqlserver/sqlserverqueries.go +++ b/plugins/inputs/sqlserver/sqlserverqueries.go @@ -287,8 +287,11 @@ EXEC sp_executesql @SqlStatement /* This string defines a SQL statements to retrieve Performance Counters as documented here - + SQL Server Performance Objects - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/use-sql-server-objects?view=sql-server-ver15#SQLServerPOs + Some of the specific objects used are - + MSSQL$*:Access Methods - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-access-methods-object?view=sql-server-ver15 MSSQL$*:Buffer Manager - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-buffer-manager-object?view=sql-server-ver15 MSSQL$*:Databases - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-databases-object?view=sql-server-ver15 diff --git a/plugins/inputs/stackdriver/stackdriver.go b/plugins/inputs/stackdriver/stackdriver.go index 25cf4c430..c89f9a31e 100644 --- a/plugins/inputs/stackdriver/stackdriver.go +++ b/plugins/inputs/stackdriver/stackdriver.go @@ -29,6 +29,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/statsd/running_stats.go b/plugins/inputs/statsd/running_stats.go index 08f24fe88..1883406c4 100644 --- a/plugins/inputs/statsd/running_stats.go +++ b/plugins/inputs/statsd/running_stats.go @@ -12,7 +12,8 @@ const defaultMedianLimit = 1000 // RunningStats calculates a running mean, variance, standard deviation, // lower bound, upper bound, count, and can calculate estimated percentiles. // It is based on the incremental algorithm described here: -// https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance +// +// https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance type RunningStats struct { k float64 n int64 diff --git a/plugins/inputs/statsd/statsd.go b/plugins/inputs/statsd/statsd.go index da3a0b015..a4e0431f3 100644 --- a/plugins/inputs/statsd/statsd.go +++ b/plugins/inputs/statsd/statsd.go @@ -25,6 +25,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/supervisor/supervisor.go b/plugins/inputs/supervisor/supervisor.go index 6f0cf41e0..83a315bf4 100644 --- a/plugins/inputs/supervisor/supervisor.go +++ b/plugins/inputs/supervisor/supervisor.go @@ -46,6 +46,7 @@ type supervisorInfo struct { } // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/suricata/suricata.go b/plugins/inputs/suricata/suricata.go index bbe246fe3..89f0ce58e 100644 --- a/plugins/inputs/suricata/suricata.go +++ b/plugins/inputs/suricata/suricata.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/swap/swap.go b/plugins/inputs/swap/swap.go index 4e0460666..6a122c2b8 100644 --- a/plugins/inputs/swap/swap.go +++ b/plugins/inputs/swap/swap.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/synproxy/synproxy.go b/plugins/inputs/synproxy/synproxy.go index 3950f727f..453bd42fa 100644 --- a/plugins/inputs/synproxy/synproxy.go +++ b/plugins/inputs/synproxy/synproxy.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/syslog/syslog.go b/plugins/inputs/syslog/syslog.go index 528a7029e..72de8c020 100644 --- a/plugins/inputs/syslog/syslog.go +++ b/plugins/inputs/syslog/syslog.go @@ -29,6 +29,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/sysstat/sysstat.go b/plugins/inputs/sysstat/sysstat.go index d171b6a13..032df38f3 100644 --- a/plugins/inputs/sysstat/sysstat.go +++ b/plugins/inputs/sysstat/sysstat.go @@ -24,6 +24,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -138,7 +139,9 @@ func (s *Sysstat) Gather(acc telegraf.Accumulator) error { // collect collects sysstat data with the collector utility sadc. // It runs the following command: -// Sadc -S -S ... 2 tmpFile +// +// Sadc -S -S ... 2 tmpFile +// // The above command collects system metrics during and // saves it in binary form to tmpFile. func (s *Sysstat) collect(tempfile string) error { @@ -190,7 +193,9 @@ func withCLocale(cmd *exec.Cmd) *exec.Cmd { } // parse runs Sadf on the previously saved tmpFile: -// Sadf -p -- -p