fix: Convert slab plugin to new sample.conf. (#11181)
This commit is contained in:
parent
59a7f76117
commit
15fd1133c7
|
|
@ -13,7 +13,7 @@ If the HOST_PROC environment variable is set, Telegraf will use its value instea
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
```toml
|
```toml @sample.conf
|
||||||
# Get slab statistics from procfs
|
# Get slab statistics from procfs
|
||||||
[[inputs.slab]]
|
[[inputs.slab]]
|
||||||
# no configuration - please see the plugin's README for steps to configure
|
# no configuration - please see the plugin's README for steps to configure
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Get slab statistics from procfs
|
||||||
|
[[inputs.slab]]
|
||||||
|
# no configuration - please see the plugin's README for steps to configure
|
||||||
|
# sudo properly
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:generate ../../../tools/readme_config_includer/generator
|
||||||
//go:build linux
|
//go:build linux
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
|
|
@ -6,6 +7,7 @@ package slab
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
_ "embed"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -20,6 +22,10 @@ import (
|
||||||
"github.com/influxdata/telegraf/plugins/inputs"
|
"github.com/influxdata/telegraf/plugins/inputs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
|
||||||
|
//go:embed sample.conf
|
||||||
|
var sampleConfig string
|
||||||
|
|
||||||
type SlabStats struct {
|
type SlabStats struct {
|
||||||
Log telegraf.Logger `toml:"-"`
|
Log telegraf.Logger `toml:"-"`
|
||||||
|
|
||||||
|
|
@ -27,6 +33,10 @@ type SlabStats struct {
|
||||||
useSudo bool
|
useSudo bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*SlabStats) SampleConfig() string {
|
||||||
|
return sampleConfig
|
||||||
|
}
|
||||||
|
|
||||||
func (ss *SlabStats) Init() error {
|
func (ss *SlabStats) Init() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
//go:build linux
|
|
||||||
// +build linux
|
|
||||||
|
|
||||||
//go:generate go run ../../../tools/generate_plugindata/main.go
|
|
||||||
//go:generate go run ../../../tools/generate_plugindata/main.go --clean
|
|
||||||
// DON'T EDIT; This file is used as a template by tools/generate_plugindata
|
|
||||||
package slab
|
|
||||||
|
|
||||||
func (ss *SlabStats) SampleConfig() string {
|
|
||||||
return `{{ .SampleConfig }}`
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue