From 68ca16c0cc262ef3b41026e4d3ffa2d45b98952a Mon Sep 17 00:00:00 2001 From: Alexander Oleinik Date: Thu, 27 Aug 2015 14:02:35 +0000 Subject: [PATCH] apache plugin: added to all.go --- plugins/all/all.go | 1 + plugins/apache/apache.go | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/all/all.go b/plugins/all/all.go index 8670c3d8b..a66ea7f21 100644 --- a/plugins/all/all.go +++ b/plugins/all/all.go @@ -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" ) diff --git a/plugins/apache/apache.go b/plugins/apache/apache.go index 042b3a59d..18830e810 100644 --- a/plugins/apache/apache.go +++ b/plugins/apache/apache.go @@ -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{} }) }