-
-
Save CMGS/e8e8f2c8e37fa9b2b231 to your computer and use it in GitHub Desktop.
falcon test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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