Skip to content

Instantly share code, notes, and snippets.

@CMGS
Last active August 29, 2015 14:21
Show Gist options
  • Save CMGS/e8e8f2c8e37fa9b2b231 to your computer and use it in GitHub Desktop.
Save CMGS/e8e8f2c8e37fa9b2b231 to your computer and use it in GitHub Desktop.
falcon test
package main
import (
"fmt"
"time"
"github.com/open-falcon/agent/g"
"github.com/open-falcon/common/model"
)
func main() {
t := g.SingleConnRpcClient{
RpcServer: "10.1.201.45:8433",
Timeout: 1000 * time.Millisecond,
}
var resp model.TransferResponse
c := time.Tick(30 * time.Second)
for now := range c {
metrics := []*model.MetricValue{
&model.MetricValue{
Endpoint: "test-Endpoint",
Metric: "cpu",
Value: 1001,
Step: 30,
Type: "GAUGE",
Tags: "test=a",
Timestamp: now.Unix(),
},
}
fmt.Println(metrics)
err := t.Call("Transfer.Update", metrics, &resp)
if err != nil {
fmt.Println("call Transfer.Update fail", err)
}
fmt.Println(&resp)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment