Identation and description

This commit is contained in:
Alexander Oleinik 2015-09-10 19:09:29 +00:00
parent 07c4f51157
commit 956cb528c2
1 changed files with 22 additions and 22 deletions

View File

@ -1,17 +1,17 @@
package webservercodes package webservercodes
import ( import (
"net/http" "net/http"
"strconv" "strconv"
"sync" "sync"
"time" "time"
"os" "os"
"io" "io"
"regexp" "regexp"
"errors" "errors"
"github.com/rogpeppe/rog-go/reverse" "github.com/rogpeppe/rog-go/reverse"
"github.com/influxdb/telegraf/plugins" "github.com/influxdb/telegraf/plugins"
) )
type Vhost struct { type Vhost struct {
@ -22,7 +22,7 @@ type Vhost struct {
} }
type Webservercodes struct { type Webservercodes struct {
Vhosts []*Vhost Vhosts []*Vhost
} }
type HttpStats struct { type HttpStats struct {
@ -48,15 +48,15 @@ interval = "10s"
` `
func (n *Webservercodes) SampleConfig() string { func (n *Webservercodes) SampleConfig() string {
return sampleConfig return sampleConfig
} }
func (n *Webservercodes) Description() string { func (n *Webservercodes) Description() string {
return "Read webserver access log files and collects http return codes stats" return "Read webserver access log files and count http return codes found"
} }
func (n *Webservercodes) Gather(acc plugins.Accumulator) error { func (n *Webservercodes) Gather(acc plugins.Accumulator) error {
var wg sync.WaitGroup var wg sync.WaitGroup
hostStats := map[string]HttpStats{} hostStats := map[string]HttpStats{}
errChan := make(chan error) errChan := make(chan error)
@ -97,7 +97,7 @@ func (n *Webservercodes) Gather(acc plugins.Accumulator) error {
n.gatherCodes(vhost, stats, acc) n.gatherCodes(vhost, stats, acc)
} }
return nil return nil
} }
func SearchStringInSlice(a string, list []string) bool { func SearchStringInSlice(a string, list []string) bool {
@ -249,7 +249,7 @@ func (n *Webservercodes) gatherCodes(vhost string, stats HttpStats, acc plugins.
} }
func init() { func init() {
plugins.Add("webservercodes", func() plugins.Plugin { plugins.Add("webservercodes", func() plugins.Plugin {
return &Webservercodes{} return &Webservercodes{}
}) })
} }