Code formatted, Readme updated based on example
This commit is contained in:
parent
dd086c7830
commit
d0ec1e5c11
|
@ -1,15 +1,49 @@
|
||||||
# Raindrops Input Plugin
|
# Raindrops Input Plugin
|
||||||
|
|
||||||
The [raindrops](http://raindrops.bogomips.org/) plugin reads from
|
The [raindrops](http://raindrops.bogomips.org/) plugin reads from
|
||||||
specified raindops middleware URI and adds stats to InfluxDB.
|
specified raindops [middleware](http://raindrops.bogomips.org/Raindrops/Middleware.html) URI and adds stats to InfluxDB.
|
||||||
|
|
||||||
### Configuration:
|
### Configuration:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# Read raindrops stats
|
# Read raindrops stats
|
||||||
[[inputs.raindrops]]
|
[[inputs.raindrops]]
|
||||||
urls = ["http://localhost/_raindrops"]
|
urls = ["http://localhost:8080/_raindrops"]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Measurements & Fields:
|
||||||
|
|
||||||
|
- raindrops
|
||||||
|
- calling (integer, count)
|
||||||
|
- writing (integer, count)
|
||||||
|
- raindrops_listen
|
||||||
|
- active (integer, bytes)
|
||||||
|
- queued (integer, bytes)
|
||||||
|
|
||||||
### Tags:
|
### Tags:
|
||||||
|
|
||||||
- Multiple listeners are tagged with IP:Port/Socket, ie `0.0.0.0:8080` or `/tmp/unicorn`
|
- Raindops calling/writing of all the workers:
|
||||||
|
- server
|
||||||
|
- port
|
||||||
|
|
||||||
|
- raindrops_listen (ip:port):
|
||||||
|
- ip
|
||||||
|
- port
|
||||||
|
|
||||||
|
- raindrops_listen (Unix Socket):
|
||||||
|
- socket
|
||||||
|
|
||||||
|
### Example Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./telegraf -config telegraf.conf -input-filter raindrops -test
|
||||||
|
* Plugin: raindrops, Collection 1
|
||||||
|
> raindrops,port=8080,server=localhost calling=0i,writing=0i 1455479896806238204
|
||||||
|
> raindrops_listen,ip=0.0.0.0,port=8080 active=0i,queued=0i 1455479896806561938
|
||||||
|
> raindrops_listen,ip=0.0.0.0,port=8081 active=1i,queued=0i 1455479896806605749
|
||||||
|
> raindrops_listen,ip=127.0.0.1,port=8082 active=0i,queued=0i 1455479896806646315
|
||||||
|
> raindrops_listen,ip=0.0.0.0,port=8083 active=0i,queued=0i 1455479896806683252
|
||||||
|
> raindrops_listen,ip=0.0.0.0,port=8084 active=0i,queued=0i 1455479896806712025
|
||||||
|
> raindrops_listen,ip=0.0.0.0,port=3000 active=0i,queued=0i 1455479896806779197
|
||||||
|
> raindrops_listen,socket=/tmp/listen.me active=0i,queued=0i 1455479896806813907
|
||||||
|
```
|
||||||
|
|
|
@ -22,7 +22,7 @@ type Raindrops struct {
|
||||||
|
|
||||||
var sampleConfig = `
|
var sampleConfig = `
|
||||||
### An array of raindrops middleware URI to gather stats.
|
### An array of raindrops middleware URI to gather stats.
|
||||||
urls = ["http://localhost/_raindrops"]
|
urls = ["http://localhost:8080/_raindrops"]
|
||||||
`
|
`
|
||||||
|
|
||||||
func (r *Raindrops) SampleConfig() string {
|
func (r *Raindrops) SampleConfig() string {
|
||||||
|
@ -119,7 +119,7 @@ func (r *Raindrops) gatherUrl(addr *url.URL, acc telegraf.Accumulator) error {
|
||||||
iterate = false
|
iterate = false
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if strings.Compare(active_line_str, "\n") == 0{
|
if strings.Compare(active_line_str, "\n") == 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
queued_line_str, queued_err = buf.ReadString('\n')
|
queued_line_str, queued_err = buf.ReadString('\n')
|
||||||
|
@ -153,8 +153,7 @@ func (r *Raindrops) gatherUrl(addr *url.URL, acc telegraf.Accumulator) error {
|
||||||
"socket": listen_name,
|
"socket": listen_name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Println("raindropssock", lis, tags)
|
acc.AddFields("raindrops_listen", lis, tags)
|
||||||
acc.AddFields("raindropssock", lis, tags)
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,10 +99,9 @@ func TestRaindropsGeneratesMetrics(t *testing.T) {
|
||||||
"port": "8081",
|
"port": "8081",
|
||||||
"ip": "0.0.0.0",
|
"ip": "0.0.0.0",
|
||||||
}
|
}
|
||||||
fields = map[string]interface {} {
|
fields = map[string]interface{}{
|
||||||
"active": uint64(3),
|
"active": uint64(3),
|
||||||
"queued": uint64(4),
|
"queued": uint64(4),
|
||||||
}
|
}
|
||||||
fmt.Println("raindropssock_test", fields, tags)
|
acc.AssertContainsTaggedFields(t, "raindrops_listen", fields, tags)
|
||||||
acc.AssertContainsTaggedFields(t, "raindropssock", fields, tags)
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue