Skip to content

bytemine/go-icinga2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

icinga2 is a Go client package for the Icinga2-API. Currently only event streams are supported. Eventually other features of the Icinga2-API will be supported, PR are welcome of course!

Design

This package provides functionality to open an event stream. The returned io.Reader can be used directly in conjunction with a json.Decoder decoding into a matching type from the event package. This only works if you are requesting only one type of events. If multiple types are requested, the returned io.Reader can be passed on to an event.Mux which multiplexes the different event types into several readers.

Usage

Package name

The package name is just icinga2 while the import path is github.com/go-icinga2 to prevent confusion. While this is a bit ugly, I think this is common enough to be ok. In effect you'll use import "github.com/bytemine/go-icinga2" and after that icinga2.NewClient() etc.

Example

A usage example can be found in client_test.go, showing how multiple event streams can be consumed.