move plugin interfaces into separate package

This commit is contained in:
David Norton
2016-12-23 10:18:27 -05:00
parent 3e6c4a53a4
commit 81caa56859
182 changed files with 817 additions and 817 deletions

View File

@@ -12,7 +12,7 @@ import (
"strings"
"sync"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins"
"github.com/influxdata/telegraf/plugins/inputs"
)
@@ -73,7 +73,7 @@ func (r *phpfpm) Description() string {
// Reads stats from all configured servers accumulates stats.
// Returns one of the errors encountered while gather stats (if any).
func (g *phpfpm) Gather(acc telegraf.Accumulator) error {
func (g *phpfpm) Gather(acc plugins.Accumulator) error {
if len(g.Urls) == 0 {
return g.gatherServer("http://127.0.0.1/status", acc)
}
@@ -96,7 +96,7 @@ func (g *phpfpm) Gather(acc telegraf.Accumulator) error {
}
// Request status page to get stat raw data and import it
func (g *phpfpm) gatherServer(addr string, acc telegraf.Accumulator) error {
func (g *phpfpm) gatherServer(addr string, acc plugins.Accumulator) error {
if g.client == nil {
client := &http.Client{}
g.client = client
@@ -154,7 +154,7 @@ func (g *phpfpm) gatherServer(addr string, acc telegraf.Accumulator) error {
}
// Gather stat using fcgi protocol
func (g *phpfpm) gatherFcgi(fcgi *conn, statusPath string, acc telegraf.Accumulator) error {
func (g *phpfpm) gatherFcgi(fcgi *conn, statusPath string, acc plugins.Accumulator) error {
fpmOutput, fpmErr, err := fcgi.Request(map[string]string{
"SCRIPT_NAME": "/" + statusPath,
"SCRIPT_FILENAME": statusPath,
@@ -174,7 +174,7 @@ func (g *phpfpm) gatherFcgi(fcgi *conn, statusPath string, acc telegraf.Accumula
}
// Gather stat using http protocol
func (g *phpfpm) gatherHttp(addr string, acc telegraf.Accumulator) error {
func (g *phpfpm) gatherHttp(addr string, acc plugins.Accumulator) error {
u, err := url.Parse(addr)
if err != nil {
return fmt.Errorf("Unable parse server address '%s': %s", addr, err)
@@ -199,7 +199,7 @@ func (g *phpfpm) gatherHttp(addr string, acc telegraf.Accumulator) error {
}
// Import stat data into Telegraf system
func importMetric(r io.Reader, acc telegraf.Accumulator) (poolStat, error) {
func importMetric(r io.Reader, acc plugins.Accumulator) (poolStat, error) {
stats := make(poolStat)
var currentPool string
@@ -254,7 +254,7 @@ func importMetric(r io.Reader, acc telegraf.Accumulator) (poolStat, error) {
}
func init() {
inputs.Add("phpfpm", func() telegraf.Input {
inputs.Add("phpfpm", func() plugins.Input {
return &phpfpm{}
})
}