An idiomatic Go client library for interacting with Arachnys' Cabot API.
Cabot is a self-hosted, easily-deployable monitoring, and alerts service - like a lightweight PagerDuty.
- Less boilerplate-y
- Tests (???)
- More examples
-
Download, and install
go-cabot/cabot
:go get github.com/mrsaints/go-cabot/cabot
-
Import the package into your code:
import "github.com/mrsaints/go-cabot/cabot"
-
Construct a Cabot API client:
auth := cabot.WithBasicAuth("username", "password") baseURL := cabot.WithBaseURL("https://your-base-cabot-url/") // Accepts a variable number of `Option` arguments client = cabot.NewClient(auth, baseURL)
-
Using the newly constructed client, call methods via its respective service:
// Returns a list of services client.Services.List() // Returns a specific instance using its ID client.Instances.Get(1) // Creates a new ICMP check with "Hello World!" as its name check := &cabot.ICMPCheck{cabot.StatusCheck{Name: "Hello World!"}} created, _ := client.ICMPChecks.Create(check) log.Println(created)