Documentation
¶
Index ¶
Constants ¶
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 ¶
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 ¶
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