sensu

package
v0.22.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2016 License: MIT Imports: 8 Imported by: 2

Documentation

Overview

The Sensu API provides access to the data that Sensu servers collect, such as client information & current events. The API can be used to resolve events and request check executions, among other things.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Host     string
	Port     int
	User     string
	Password string
}
var DefaultAPI *API = &API{
	Host: "localhost",
	Port: 4567,
}

func (API) DeleteAggregatesCheck

func (api API) DeleteAggregatesCheck(check string) error

Deletes all aggregates for a check.

func (API) DeleteClientsClient

func (api API) DeleteClientsClient(name string) error

Removes a client, resolving its current events.

func (API) DeleteEventsClientCheck

func (api API) DeleteEventsClientCheck(client string, check string) error

Resolves an event for a given check on a given client.

func (API) DeleteStashesPath

func (api API) DeleteStashesPath(path string) error

Delete a stash.

func (API) GetAggregates

func (api API) GetAggregates(limit int, offset int) ([]IssueStruct, error)

Returns the list of aggregates.

limit:  The number of aggregates to return.
offset: The number of aggregates to offset before returning items.

func (API) GetAggregatesCheck

func (api API) GetAggregatesCheck(check string, age int) ([]int64, error)

Returns the list of aggregates for a given check.

age: The number of seconds old an aggregate must be to be listed.

func (API) GetAggregatesCheckIssued

func (api API) GetAggregatesCheckIssued(check string, issued int64, summarize string, results bool) (*AggregateStruct, error)

Returns an aggregate.

summarize: Summarizes the output field in the event data. (summarize=output)
result:    Return the raw result data.

func (API) GetChecks

func (api API) GetChecks() ([]CheckStruct, error)

Returns the list of checks.

func (API) GetChecksCheck

func (api API) GetChecksCheck(name string) (*CheckStruct, error)

Returns a check.

func (API) GetClients

func (api API) GetClients(limit int, offset int) ([]ClientStruct, error)

Returns a list of clients.

limit:  The number of clients to return.
offset: The number of clients to offset before returning items.

func (API) GetClientsClient

func (api API) GetClientsClient(name string) (*ClientStruct, error)

Returns a client.

func (API) GetClientsHistory

func (api API) GetClientsHistory(client string) ([]historyStruct, error)

Returns the history for a client.

func (API) GetEvents

func (api API) GetEvents() ([]EventStruct, error)

Returns the list of current events.

func (API) GetEventsClient

func (api API) GetEventsClient(client string) ([]EventStruct, error)

Returns the list of current events for a given client.

func (API) GetEventsClientCheck

func (api API) GetEventsClientCheck(client string, check string) (*EventStruct, error)

Returns an event for a given client & check name.

func (API) GetHealth

func (api API) GetHealth(consumers int, messages int) error

Returns health information on transport & Redis connections.

consumers: The minimum number of transport consumers to be considered healthy.
messages:  The maximum ammount of transport queued messages to be considered healthy.

func (API) GetInfo

func (api API) GetInfo() (*InfoStruct, error)

Returns information on the API.

func (API) GetResults

func (api API) GetResults() ([]ResultStruct, error)

Returns a list of current check results for all clients.

func (API) GetResultsClient

func (api API) GetResultsClient(client string) ([]ResultStruct, error)

Returns a list of current check results for a given client.

func (API) GetResultsClientCheck

func (api API) GetResultsClientCheck(client string, check string) (*ResultStruct, error)

Returns a check result for a given client & check name.

func (API) GetStashes

func (api API) GetStashes(stashes interface{}, limit int, offset int) error

Returns a list of stashes.

limit:  The number of stashes to return.
offset: The number of stashes to offset before returning items.

func (API) GetStashesPath

func (api API) GetStashesPath(path string, content interface{}) error

Get a stash.

func (API) PostClients

func (api API) PostClients(name string, address string, subscriptions []string) error

Create or update client data (e.g. Sensu JIT clients).

func (API) PostRequest

func (api API) PostRequest(check string, subscribers []string) error

Issues a check execution request.

func (API) PostResolve

func (api API) PostResolve(client string, check string) error

Resolves an event.

func (API) PostStashes

func (api API) PostStashes(stash interface{}) error

Create a stash.

func (API) PostStashesPath

func (api API) PostStashesPath(path string, content interface{}) error

Create a stash.

type AggregateStruct

type AggregateStruct struct {
	Ok       int            `json:"ok"`
	Warning  int            `json:"warning"`
	Critical int            `json:"critical"`
	Unknown  int            `json:"unknown"`
	Total    int            `json:"total"`
	Outputs  map[string]int `json:"outputs"`
	Results  []struct {
		Client string `json:"client"`
		Output string `json:"output"`
		Status int    `json:"status"`
	} `json:"results"`
}

type CheckStruct

type CheckStruct struct {
	Name        string   `json:"name"`
	Command     string   `json:"command"`
	Subscribers []string `json:"subscribers"`
	Interval    int      `json:"interval"`
	Handlers    []string `json:"handlers"`
	Aggregate   bool     `json:"aggregate"`
	Issued      int64    `json:"issued"`
	Executed    int64    `json:"executed"`
	Output      string   `json:"output"`
	Status      int      `json:"status"`
	Duration    float64  `json:"duration"`
	History     []string `json:"history"`
}

type ClientStruct

type ClientStruct struct {
	Name          string   `json:"name"`
	Address       string   `json:"address"`
	Subscriptions []string `json:"subscriptions"`
	Timestamp     int64    `json:"timestamp"`
	Version       string   `json:"version"`
}

type EventStruct

type EventStruct struct {
	ID          string       `json:"id"`
	Client      ClientStruct `json:"client"`
	Check       CheckStruct  `json:"check"`
	Occurrences int          `json:"occurrences"`
	Action      string       `json:"action"`
}

type InfoStruct

type InfoStruct struct {
	Sensu struct {
		Version string `json:"version"`
	} `json:"sensu"`
	Transport struct {
		Keepalives struct {
			Messages  int `json:"messages"`
			Consumers int `json:"consumers"`
		} `json:"keepalives"`
		Results struct {
			Messages  int `json:"messages"`
			Consumers int `json:"consumers"`
		} `json:"results"`
		Connected bool `json:"connected"`
	}
	Redis struct {
		Connected bool `json:"connected"`
	} `json:"redis"`
}

type IssueStruct added in v0.22.1

type IssueStruct struct {
	Check  string  `json:"check"`
	Issued []int64 `json:"issued"`
}

type RequestStruct

type RequestStruct struct {
	Check       string   `json:"check"`
	Subscribers []string `json:"subscribers"`
}

type ResolveStruct

type ResolveStruct struct {
	Client string `json:"client"`
	Check  string `json:"check"`
}

type Response added in v0.22.1

type Response struct {
	Body       string
	StatusCode int
}

type ResultStruct

type ResultStruct struct {
	Client string      `json:"client"`
	Check  CheckStruct `json:"check"`
}

type StashStruct

type StashStruct struct {
	Expire int64  `json:"expire"`
	Path   string `json:"path"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL