Add request for sample queries (#1608)

This commit is contained in:
Jack Zampolin
2016-08-08 15:06:03 -07:00
committed by Cameron Sparr
parent d3bb1e7010
commit 22c293de62
3 changed files with 21 additions and 0 deletions

View File

@@ -27,6 +27,14 @@ 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:
```
SELECT max(field1), mean(field1), min(field1) FROM measurement1 WHERE tag1=bar AND time > now() - 1h GROUP BY tag
```
### Example Output:

View File

@@ -6,10 +6,22 @@ import (
"github.com/stretchr/testify/mock"
)
// MockPlugin struct should be named the same as the Plugin
type MockPlugin struct {
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 {
ret := m.Called(_a0)