From 67483c85a513671334a14e1cf9e2803fb24279f1 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Wed, 7 Sep 2016 14:54:24 +0100 Subject: [PATCH] Create experimental directory for inputs & outputs --- CONTRIBUTING.md | 25 ++++++++++--------- Makefile | 4 +++ cmd/telegraf/telegraf.go | 8 ++++-- plugins/experimental/inputs/all/all.go | 5 ++++ .../inputs/all/all_notexperimental.go | 3 +++ plugins/experimental/outputs/all/all.go | 5 ++++ .../outputs/all/all_notexperimental.go | 3 +++ plugins/inputs/EXAMPLE_README.md | 4 ++- plugins/outputs/opentsdb/README.md | 24 ++++++++++++++++++ 9 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 plugins/experimental/inputs/all/all.go create mode 100644 plugins/experimental/inputs/all/all_notexperimental.go create mode 100644 plugins/experimental/outputs/all/all.go create mode 100644 plugins/experimental/outputs/all/all_notexperimental.go diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec7a35363..8e7cff0b7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,18 +1,19 @@ ## Steps for Contributing: 1. [Sign the CLA](http://influxdb.com/community/cla.html) -1. Make changes or write plugin (see below for details) -1. Add your plugin to `plugins/inputs/all/all.go` or `plugins/outputs/all/all.go` -1. If your plugin requires a new Go package, -[add it](https://github.com/influxdata/telegraf/blob/master/CONTRIBUTING.md#adding-a-dependency) -1. Write a README for your plugin, if it's an input plugin, it should be structured -like the [input example here](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/EXAMPLE_README.md). -Output plugins READMEs are less structured, -but any information you can provide on how the data will look is appreciated. -See the [OpenTSDB output](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/opentsdb) -for a good example. -1. **Optional:** Help users of your plugin by including example queries for populating dashboards. Include these sample queries in the `README.md` for the plugin. -1. **Optional:** Write a [tickscript](https://docs.influxdata.com/kapacitor/v1.0/tick/syntax/) for your plugin and add it to [Kapacitor](https://github.com/influxdata/kapacitor/tree/master/examples/telegraf). Or mention @jackzampolin in a PR comment with some common queries that you would want to alert on and he will write one for you. +1. If you are adding a new plugin: + 1. All new plugins must go into the `experimental` directory: `plugins/experimental/inputs/` or `plugins/experimental/outputs/` + 1. Add your plugin to `plugins/experimental/inputs/all/all.go` or `plugins/experimental/outputs/all/all.go` + 1. If your plugin requires a new Go package, [add it](https://github.com/influxdata/telegraf/blob/master/CONTRIBUTING.md#adding-a-dependency) + 1. Write a README for your plugin, if it's an input plugin, it should be structured + like the [input example here](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/EXAMPLE_README.md). + Output plugins READMEs are less structured, + but any information you can provide on how the data will look is appreciated. + See the [OpenTSDB output](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/opentsdb) + for a good example. All plugin READMEs must include links to relevant + documentation. + 1. **Optional:** Help users of your plugin by including example queries for populating dashboards. Include these sample queries in the `README.md` for the plugin. + 1. **Optional:** Write a [tickscript](https://docs.influxdata.com/kapacitor/v1.0/tick/syntax/) for your plugin and add it to [Kapacitor](https://github.com/influxdata/kapacitor/tree/master/examples/telegraf). Or mention @jackzampolin in a PR comment with some common queries that you would want to alert on and he will write one for you. ## GoDoc diff --git a/Makefile b/Makefile index 0a3be166b..03740ecbe 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,10 @@ windows: prepare-windows build-windows build: go install -ldflags "-X main.version=$(VERSION)" ./... +# Only run the build (no dependency grabbing) +experimental: + go install -tags experimental -ldflags "-X main.version=experimental-$(VERSION)" ./... + build-windows: GOOS=windows GOARCH=amd64 go build -o telegraf.exe -ldflags \ "-X main.version=$(VERSION)" \ diff --git a/cmd/telegraf/telegraf.go b/cmd/telegraf/telegraf.go index f19b127a8..fda0882e4 100644 --- a/cmd/telegraf/telegraf.go +++ b/cmd/telegraf/telegraf.go @@ -13,10 +13,14 @@ import ( "github.com/influxdata/telegraf/agent" "github.com/influxdata/telegraf/internal/config" "github.com/influxdata/telegraf/plugins/inputs" - _ "github.com/influxdata/telegraf/plugins/inputs/all" "github.com/influxdata/telegraf/plugins/outputs" - _ "github.com/influxdata/telegraf/plugins/outputs/all" "github.com/kardianos/service" + + _ "github.com/influxdata/telegraf/plugins/experimental/inputs/all" + _ "github.com/influxdata/telegraf/plugins/experimental/outputs/all" + + _ "github.com/influxdata/telegraf/plugins/inputs/all" + _ "github.com/influxdata/telegraf/plugins/outputs/all" ) var fDebug = flag.Bool("debug", false, diff --git a/plugins/experimental/inputs/all/all.go b/plugins/experimental/inputs/all/all.go new file mode 100644 index 000000000..be12e979e --- /dev/null +++ b/plugins/experimental/inputs/all/all.go @@ -0,0 +1,5 @@ +// +build experimental + +package all + +import () diff --git a/plugins/experimental/inputs/all/all_notexperimental.go b/plugins/experimental/inputs/all/all_notexperimental.go new file mode 100644 index 000000000..671de7042 --- /dev/null +++ b/plugins/experimental/inputs/all/all_notexperimental.go @@ -0,0 +1,3 @@ +// +build !experimental + +package all diff --git a/plugins/experimental/outputs/all/all.go b/plugins/experimental/outputs/all/all.go new file mode 100644 index 000000000..be12e979e --- /dev/null +++ b/plugins/experimental/outputs/all/all.go @@ -0,0 +1,5 @@ +// +build experimental + +package all + +import () diff --git a/plugins/experimental/outputs/all/all_notexperimental.go b/plugins/experimental/outputs/all/all_notexperimental.go new file mode 100644 index 000000000..671de7042 --- /dev/null +++ b/plugins/experimental/outputs/all/all_notexperimental.go @@ -0,0 +1,3 @@ +// +build !experimental + +package all diff --git a/plugins/inputs/EXAMPLE_README.md b/plugins/inputs/EXAMPLE_README.md index d6fcfdb91..74d5edf5b 100644 --- a/plugins/inputs/EXAMPLE_README.md +++ b/plugins/inputs/EXAMPLE_README.md @@ -2,6 +2,8 @@ The example plugin gathers metrics about example things +You can read more information about this thing [here](https://google.com). + ### Configuration: ```toml @@ -27,7 +29,7 @@ The example plugin gathers metrics about example things - tag2 - measurement2 has the following tags: - tag3 - + ### Sample Queries: These are some useful queries (to generate dashboards or other) to run against data from this plugin: diff --git a/plugins/outputs/opentsdb/README.md b/plugins/outputs/opentsdb/README.md index 2fd0bd2d8..f3c826b76 100644 --- a/plugins/outputs/opentsdb/README.md +++ b/plugins/outputs/opentsdb/README.md @@ -8,6 +8,30 @@ metrics is sent in each http request by setting batchSize in config. See http://opentsdb.net/docs/build/html/api_http/put.html for details. +## Configuration + +```toml +# Configuration for OpenTSDB server to send metrics to +[[outputs.opentsdb]] + ## prefix for metrics keys + prefix = "my.specific.prefix." + + ## DNS name of the OpenTSDB server + ## Using "opentsdb.example.com" or "tcp://opentsdb.example.com" will use the + ## telnet API. "http://opentsdb.example.com" will use the Http API. + host = "opentsdb.example.com" + + ## Port of the OpenTSDB server + port = 4242 + + ## Number of data points to send to OpenTSDB in Http requests. + ## Not used with telnet API. + httpBatchSize = 50 + + ## Debug true - Prints OpenTSDB communication + debug = false +``` + ## Transfer "Protocol" in the telnet mode The expected input from OpenTSDB is specified in the following way: