Go client for CiscoZeus.io. it allows a user to send and receive data to and from Zeus.
- Send logs and metrics to Zeus
- Query both logs and metrics.
go get github.com/CiscoZeus/go-zeusclient
At first, generate a Zeus client object:
zeus := &Zeus{ApiServ: "http://api.ciscozeus.io", Token: "{Your token}"}Then, you can call methods as
zeus.bucket("{Your organization's name}/{Your bucket's name}").SomeMethod()
// "bucket" method sets your bucket's information. It's necessaryAfter initialize 'zeus' as Usage,
- Send a log
logs := LogList{
Name: "syslog",
Logs: []Log{
Log{"foo": "bar", "tar": "woo"},
},
}
suc, err := zeus.bucket("org1/bucket1").PostLogs(logs)- Retrieve logs
total, logs, err := zeus.bucket("org1/bucket1").GetLogs("syslog", "", "", 0, 0, 0, 0)- Send a metric
metrics := MetricList{
Name: "sample",
Columns: []string{"col1", "col2", "col3"},
Metrics: []Metric{
Metric{
Timestamp: float64(time.Now().Unix()),
Point: []float64{1.0, 2.0, 3.0},
},
},
}
suc, err := zeus.bucket("org1/bucket1").PostMetrics(metrics)- Query metric name
name, err := zeus.bucket("org1/bucket1").GetMetricNames("sample*", 0, 0)- Query metric values
timestamp := 1430355869.123
rMetrics, err := zeus.bucket("org1/bucket1").GetMetricValues("sample", "", "", "", timestamp-10.0, timestamp, "col2>1", 0, 1024)For more examples, please refer to sample/sample.go
- Fork it ( https://github.com/CiscoZeus/go-zeusclient/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
