Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Convert slab plugin to new sample.conf. #11181

Merged
merged 1 commit into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/inputs/slab/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If the HOST_PROC environment variable is set, Telegraf will use its value instea

## Configuration

```toml
```toml @sample.conf
# Get slab statistics from procfs
[[inputs.slab]]
# no configuration - please see the plugin's README for steps to configure
Expand Down
4 changes: 4 additions & 0 deletions plugins/inputs/slab/sample.conf
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions plugins/inputs/slab/slab.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:generate ../../../tools/readme_config_includer/generator
//go:build linux
// +build linux

Expand All @@ -6,6 +7,7 @@ package slab
import (
"bufio"
"bytes"
_ "embed"
"errors"
"fmt"
"os"
Expand All @@ -20,13 +22,21 @@ import (
"github.com/influxdata/telegraf/plugins/inputs"
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embedd the sampleConfig data.
//go:embed sample.conf
var sampleConfig string

type SlabStats struct {
Log telegraf.Logger `toml:"-"`

statFile string
useSudo bool
}

func (*SlabStats) SampleConfig() string {
return sampleConfig
}

func (ss *SlabStats) Init() error {
return nil
}
Expand Down
11 changes: 0 additions & 11 deletions plugins/inputs/slab/slab_sample_config.go

This file was deleted.