'discard' output plugin

This commit is contained in:
Cameron Sparr 2016-11-23 12:21:17 +00:00
parent 2b0cd2037b
commit 9db30250c3
5 changed files with 33 additions and 0 deletions

View File

@ -6,6 +6,7 @@
- [#1564](https://github.com/influxdata/telegraf/issues/1564): Use RFC3339 timestamps in log output.
- [#1997](https://github.com/influxdata/telegraf/issues/1997): Non-default HTTP timeouts for RabbitMQ plugin.
- [#2074](https://github.com/influxdata/telegraf/pull/2074): "discard" output plugin added, primarily for testing purposes.
### Bugfixes

View File

@ -245,6 +245,7 @@ Telegraf can also collect metrics via the following service plugins:
* [aws kinesis](./plugins/outputs/kinesis)
* [aws cloudwatch](./plugins/outputs/cloudwatch)
* [datadog](./plugins/outputs/datadog)
* [discard](./plugins/outputs/discard)
* [file](./plugins/outputs/file)
* [graphite](./plugins/outputs/graphite)
* [graylog](./plugins/outputs/graylog)

View File

@ -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"

View File

@ -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
```

View File

@ -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{} })
}