Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/amir/raidman

Go Riemann client
https://github.com/amir/raidman

go riemann-client

Last synced: 4 days ago
JSON representation

Go Riemann client

Awesome Lists containing this project

README

        

Raidman
=======

Go Riemann client

```go
package main

import (
"github.com/amir/raidman"
)

func main() {
c, err := raidman.Dial("tcp", "localhost:5555")
if err != nil {
panic(err)
}

var event = &raidman.Event{
State: "success",
Host: "raidman",
Service: "raidman-sample",
Metric: 100,
Ttl: 10,
}

// send one event
err = c.Send(event)
if err != nil {
panic(err)
}

// send multiple events at once
err = c.SendMulti([]*raidman.Event{
&raidman.Event{
State: "success",
Host: "raidman",
Service: "raidman-sample",
Metric: 100,
Ttl: 10,
},
&raidman.Event{
State: "failure",
Host: "raidman",
Service: "raidman-sample",
Metric: 100,
Ttl: 10,
},
&raidman.Event{
State: "success",
Host: "raidman",
Service: "raidman-sample",
Metric: 100,
Ttl: 10,
},
})
if err != nil {
panic(err)
}

events, err := c.Query("host = \"raidman\"")
if err != nil {
panic(err)
}

if len(events) < 1 {
panic("Submitted event not found")
}

c.Close()
}

```