parent
e167b72b16
commit
20fbfc7006
|
@ -15,6 +15,7 @@ changed to just run docker commands in the Makefile. See `make docker-run` and
|
|||
- [#338](https://github.com/influxdb/telegraf/pull/338): Restart Telegraf on package upgrade. Thanks @linsomniac!
|
||||
- [#337](https://github.com/influxdb/telegraf/pull/337): Jolokia plugin, thanks @saiello!
|
||||
- [#350](https://github.com/influxdb/telegraf/pull/350): Amon output.
|
||||
- [#365](https://github.com/influxdb/telegraf/pull/365): Twemproxy plugin by @codeb2cc
|
||||
- [#317](https://github.com/influxdb/telegraf/issues/317): ZFS plugin, thanks @cornerot!
|
||||
- [#364](https://github.com/influxdb/telegraf/pull/364): Support InfluxDB UDP output.
|
||||
|
||||
|
|
|
@ -190,6 +190,7 @@ Telegraf currently has support for collecting metrics from:
|
|||
* rabbitmq
|
||||
* redis
|
||||
* rethinkdb
|
||||
* twemproxy
|
||||
* zfs
|
||||
* zookeeper
|
||||
* system
|
||||
|
|
|
@ -17,16 +17,14 @@ type Twemproxy struct {
|
|||
}
|
||||
|
||||
type TwemproxyInstance struct {
|
||||
StatsAddr string
|
||||
Addr string
|
||||
Pools []string
|
||||
}
|
||||
|
||||
var sampleConfig = `
|
||||
# Twemproxy plugin config
|
||||
[twemproxy]
|
||||
[[twemproxy.instances]]
|
||||
# Twemproxy stats address and port(NO scheme!)
|
||||
statsAddr = "10.16.29.1:22222"
|
||||
# Twemproxy stats address and port (no scheme)
|
||||
addr = "localhost:22222"
|
||||
# Monitor pool name
|
||||
pools = ["redis_pool", "mc_pool"]
|
||||
`
|
||||
|
@ -69,7 +67,7 @@ func (t *Twemproxy) Gather(acc plugins.Accumulator) error {
|
|||
func (ti *TwemproxyInstance) Gather(
|
||||
acc plugins.Accumulator,
|
||||
) error {
|
||||
conn, err := net.DialTimeout("tcp", ti.StatsAddr, 1*time.Second)
|
||||
conn, err := net.DialTimeout("tcp", ti.Addr, 1*time.Second)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -84,7 +82,7 @@ func (ti *TwemproxyInstance) Gather(
|
|||
}
|
||||
|
||||
tags := make(map[string]string)
|
||||
tags["twemproxy"] = ti.StatsAddr
|
||||
tags["twemproxy"] = ti.Addr
|
||||
ti.processStat(acc, tags, stats)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package twemproxy
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net"
|
||||
"testing"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/influxdb/telegraf/testutil"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const sampleStatsAddr = "127.0.0.1:22222"
|
||||
const sampleAddr = "127.0.0.1:22222"
|
||||
|
||||
const sampleStats = `{
|
||||
"total_connections": 276448,
|
||||
|
@ -61,7 +61,7 @@ const sampleStats = `{
|
|||
}`
|
||||
|
||||
func mockTwemproxyServer() (net.Listener, error) {
|
||||
listener, err := net.Listen("tcp", sampleStatsAddr)
|
||||
listener, err := net.Listen("tcp", sampleAddr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ func TestGather(t *testing.T) {
|
|||
twemproxy := &Twemproxy{
|
||||
Instances: []TwemproxyInstance{
|
||||
TwemproxyInstance{
|
||||
StatsAddr: sampleStatsAddr,
|
||||
Addr: sampleAddr,
|
||||
Pools: []string{"demo"},
|
||||
},
|
||||
},
|
||||
|
@ -104,7 +104,7 @@ func TestGather(t *testing.T) {
|
|||
|
||||
metrics := []string{"total_connections", "curr_connections", "timestamp"}
|
||||
tags := map[string]string{
|
||||
"twemproxy": sampleStatsAddr,
|
||||
"twemproxy": sampleAddr,
|
||||
"source": sourceData["source"].(string),
|
||||
}
|
||||
for _, m := range metrics {
|
||||
|
|
Loading…
Reference in New Issue