sensu

package
v0.0.0-...-2f2621b Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const (
	//QueueNameKeepAlives is the name of queue used by Sensu server for receiving keepalive messages
	QueueNameKeepAlives = "keepalives"
	//QueueNameResults is the name of queue used by Sensu server for receiving check result messages
	QueueNameResults = "results"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckRequest

type CheckRequest struct {
	Command  string   `json:"command"`
	Name     string   `json:"name"`
	Issued   int64    `json:"issued"`
	Handlers []string `json:"handlers,omitempty"`
	Handler  string   `json:"handler,omitempty"`
}

CheckRequest is the output of the connector's listening loop

type CheckResult

type CheckResult struct {
	Client string `json:"client"`
	Result Result `json:"check"`
}

CheckResult represents message structure for sending check results back to Sensu server

type Keepalive

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

Keepalive holds structure for Sensu KeepAlive messages

type Result

type Result struct {
	Command  string   `json:"command"`
	Name     string   `json:"name"`
	Issued   int64    `json:"issued"`
	Handlers []string `json:"handlers,omitempty"`
	Handler  string   `json:"handler,omitempty"`
	Executed int64    `json:"executed"`
	Duration float64  `json:"duration"`
	Output   string   `json:"output"`
	Status   int      `json:"status"`
}

Result contains data about check execution

type SensuConnector

type SensuConnector struct {
	Address           string
	Subscription      []string
	ClientName        string
	ClientAddress     string
	KeepaliveInterval int64
	// contains filtered or unexported fields
}

SensuConnector holds all data and functions required for communication with Sensu (1.x) server via RabbitMQ

func ConnectSensu

func ConnectSensu(cfg config.Config, logger *logging.Logger) (*SensuConnector, error)

ConnectSensu creates new Sensu connector from the given configuration file

func CreateSensuConnector

func CreateSensuConnector(logger *logging.Logger, address string, clientName string, clientAddress string, keepaliveInterval int64, subscriptions []string) (*SensuConnector, error)

CreateSensuConnector creates the connector and connects on given RabbitMQ service with Sensu server on appropriate channels

func (*SensuConnector) Connect

func (conn *SensuConnector) Connect() error

Connect connects to RabbitMQ server and

func (*SensuConnector) Disconnect

func (conn *SensuConnector) Disconnect()

Disconnect closes all connections

func (*SensuConnector) Reconnect

func (conn *SensuConnector) Reconnect() error

Reconnect tries to reconnect connector to RabbitMQ

func (*SensuConnector) Start

func (conn *SensuConnector) Start(outchan chan interface{}, inchan chan interface{})

Start starts all processing loops. Channel outchan will contain received CheckRequest messages from Sensu server and through inchan CheckResult messages are sent back to Sensu server

Jump to

Keyboard shortcuts

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