Skip to content

Commit

Permalink
fix: Convert slab plugin to new sample.conf. (#11181)
Browse files Browse the repository at this point in the history
  • Loading branch information
srebhan authored May 24, 2022
1 parent 59a7f76 commit 15fd113
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
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.

0 comments on commit 15fd113

Please sign in to comment.