Add request for sample queries (#1608)
This commit is contained in:
parent
d3bb1e7010
commit
22c293de62
|
@ -11,6 +11,7 @@ Output plugins READMEs are less structured,
|
||||||
but any information you can provide on how the data will look is appreciated.
|
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)
|
See the [OpenTSDB output](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/opentsdb)
|
||||||
for a good example.
|
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. **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
|
## GoDoc
|
||||||
|
|
|
@ -27,6 +27,14 @@ The example plugin gathers metrics about example things
|
||||||
- tag2
|
- tag2
|
||||||
- measurement2 has the following tags:
|
- measurement2 has the following tags:
|
||||||
- tag3
|
- tag3
|
||||||
|
|
||||||
|
### Sample Queries:
|
||||||
|
|
||||||
|
These are some useful queries (to generate dashboards or other) to run against data from this plugin:
|
||||||
|
|
||||||
|
```
|
||||||
|
SELECT max(field1), mean(field1), min(field1) FROM measurement1 WHERE tag1=bar AND time > now() - 1h GROUP BY tag
|
||||||
|
```
|
||||||
|
|
||||||
### Example Output:
|
### Example Output:
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,22 @@ import (
|
||||||
"github.com/stretchr/testify/mock"
|
"github.com/stretchr/testify/mock"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// MockPlugin struct should be named the same as the Plugin
|
||||||
type MockPlugin struct {
|
type MockPlugin struct {
|
||||||
mock.Mock
|
mock.Mock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Description will appear directly above the plugin definition in the config file
|
||||||
|
func (m *MockPlugin) Description() string {
|
||||||
|
return `This is an example plugin`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SampleConfig will populate the sample configuration portion of the plugin's configuration
|
||||||
|
func (m *MockPlugin) SampleConfig() string {
|
||||||
|
return ` sampleVar = 'foo'`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gather defines what data the plugin will gather.
|
||||||
func (m *MockPlugin) Gather(_a0 telegraf.Accumulator) error {
|
func (m *MockPlugin) Gather(_a0 telegraf.Accumulator) error {
|
||||||
ret := m.Called(_a0)
|
ret := m.Called(_a0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue