apache plugin: added to all.go
This commit is contained in:
parent
5793fc1e65
commit
68ca16c0cc
|
@ -19,4 +19,5 @@ import (
|
|||
_ "github.com/influxdb/telegraf/plugins/redis"
|
||||
_ "github.com/influxdb/telegraf/plugins/rethinkdb"
|
||||
_ "github.com/influxdb/telegraf/plugins/system"
|
||||
_ "github.com/influxdb/telegraf/plugins/apache"
|
||||
)
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/influxdb/telegraf/plugins"
|
||||
)
|
||||
|
||||
type ApacheConf struct {
|
||||
type Apache struct {
|
||||
Urls []string
|
||||
}
|
||||
|
||||
|
@ -22,15 +22,15 @@ var sampleConfig = `
|
|||
# An array of Apache status URI to gather stats.
|
||||
urls = ["http://localhost/server-status?auto"]`
|
||||
|
||||
func (n *ApacheConf) SampleConfig() string {
|
||||
func (n *Apache) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
func (n *ApacheConf) Description() string {
|
||||
func (n *Apache) Description() string {
|
||||
return "Read Apache status information (mod_status)"
|
||||
}
|
||||
|
||||
func (n *ApacheConf) Gather(acc plugins.Accumulator) error {
|
||||
func (n *Apache) Gather(acc plugins.Accumulator) error {
|
||||
var wg sync.WaitGroup
|
||||
var outerr error
|
||||
|
||||
|
@ -58,7 +58,7 @@ var tr = &http.Transport{
|
|||
|
||||
var client = &http.Client{Transport: tr}
|
||||
|
||||
func (n *ApacheConf) gatherUrl(addr *url.URL, acc plugins.Accumulator) error {
|
||||
func (n *Apache) gatherUrl(addr *url.URL, acc plugins.Accumulator) error {
|
||||
resp, err := client.Get(addr.String())
|
||||
if err != nil {
|
||||
return fmt.Errorf("error making HTTP request to %s: %s", addr.String(), err)
|
||||
|
@ -144,6 +144,6 @@ func getTags(addr *url.URL) map[string]string {
|
|||
|
||||
func init() {
|
||||
plugins.Add("apache", func() plugins.Plugin {
|
||||
return &ApacheConf{}
|
||||
return &Apache{}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue