0.3.0 outputs: riemann
This commit is contained in:
parent
06a78510db
commit
9a5ced8b37
|
@ -55,9 +55,11 @@ func (r *Riemann) Write(points []*client.Point) error {
|
||||||
|
|
||||||
var events []*raidman.Event
|
var events []*raidman.Event
|
||||||
for _, p := range points {
|
for _, p := range points {
|
||||||
ev := buildEvent(p)
|
evs := buildEvents(p)
|
||||||
|
for _, ev := range evs {
|
||||||
events = append(events, ev)
|
events = append(events, ev)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var senderr = r.client.SendMulti(events)
|
var senderr = r.client.SendMulti(events)
|
||||||
if senderr != nil {
|
if senderr != nil {
|
||||||
|
@ -68,7 +70,9 @@ func (r *Riemann) Write(points []*client.Point) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildEvent(p *client.Point) *raidman.Event {
|
func buildEvents(p *client.Point) []*raidman.Event {
|
||||||
|
events := []*raidman.Event{}
|
||||||
|
for fieldName, value := range p.Fields() {
|
||||||
host, ok := p.Tags()["host"]
|
host, ok := p.Tags()["host"]
|
||||||
if !ok {
|
if !ok {
|
||||||
hostname, err := os.Hostname()
|
hostname, err := os.Hostname()
|
||||||
|
@ -79,13 +83,15 @@ func buildEvent(p *client.Point) *raidman.Event {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var event = &raidman.Event{
|
event := &raidman.Event{
|
||||||
Host: host,
|
Host: host,
|
||||||
Service: p.Name(),
|
Service: p.Name() + "_" + fieldName,
|
||||||
Metric: p.Fields()["value"],
|
Metric: value,
|
||||||
|
}
|
||||||
|
events = append(events, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
return event
|
return events
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
Loading…
Reference in New Issue