Skip to content

CiscoZeus/go-zeusclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zeus Go Client

Alt text

Build Status Coverage Status Godoc license

Go client for CiscoZeus.io. it allows a user to send and receive data to and from Zeus.

Features

  • Send logs and metrics to Zeus
  • Query both logs and metrics.

Get Code

go get github.com/CiscoZeus/go-zeusclient

Usage

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 necessary

Examples

After 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

Contributing

  1. Fork it ( https://github.com/CiscoZeus/go-zeusclient/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

Go client for Zeus

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages