Skip to content

Commit

Permalink
'discard' output plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sparrc committed Nov 23, 2016
1 parent 2b0cd20 commit 20c674b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/outputs/all/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
_ "github.com/influxdata/telegraf/plugins/outputs/amqp"
_ "github.com/influxdata/telegraf/plugins/outputs/cloudwatch"
_ "github.com/influxdata/telegraf/plugins/outputs/datadog"
_ "github.com/influxdata/telegraf/plugins/outputs/discard"
_ "github.com/influxdata/telegraf/plugins/outputs/file"
_ "github.com/influxdata/telegraf/plugins/outputs/graphite"
_ "github.com/influxdata/telegraf/plugins/outputs/graylog"
Expand Down
12 changes: 12 additions & 0 deletions plugins/outputs/discard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# discard Output Plugin

This output plugin simply drops all metrics that are sent to it. It is only
meant to be used for testing purposes.

### Configuration:

```toml
# Send metrics to nowhere at all
[[outputs.discard]]
# no configuration
```
18 changes: 18 additions & 0 deletions plugins/outputs/discard/discard.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package discard

import (
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/outputs"
)

type Discard struct{}

func (d *Discard) Connect() error { return nil }
func (d *Discard) Close() error { return nil }
func (d *Discard) SampleConfig() string { return "" }
func (d *Discard) Description() string { return "Send metrics to nowhere at all" }
func (d *Discard) Write(metrics []telegraf.Metric) error { return nil }

func init() {
outputs.Add("discard", func() telegraf.Output { return &Discard{} })
}

0 comments on commit 20c674b

Please sign in to comment.