Documentation ¶
Overview ¶
Package livestatus provides a binding to MK Livestatus sockets.
Index ¶
- Variables
- type Command
- type CommandOpFunc
- type Livestatus
- type Query
- func (q *Query) And(n int) *Query
- func (q *Query) Columns(names ...string) *Query
- func (q *Query) Exec() (*Response, error)
- func (q *Query) Filter(rule string) *Query
- func (q *Query) KeepAlive() *Query
- func (q *Query) KeepAliveOff() *Query
- func (q *Query) Limit(n int) *Query
- func (q *Query) Negate() *Query
- func (q *Query) Or(n int) *Query
- func (q *Query) WaitCondition(rule string) *Query
- func (q *Query) WaitConditionAnd(n int) *Query
- func (q *Query) WaitConditionNegate() *Query
- func (q *Query) WaitConditionOr(n int) *Query
- func (q *Query) WaitObject(obj string) *Query
- func (q *Query) WaitTimeout(t time.Duration) *Query
- func (q *Query) WaitTrigger(event string) *Query
- type Record
- func (r Record) Columns() []string
- func (r Record) Get(name string) (interface{}, error)
- func (r Record) GetBool(name string) (bool, error)
- func (r Record) GetFloat(name string) (float64, error)
- func (r Record) GetInt(name string) (int64, error)
- func (r Record) GetSlice(name string) ([]interface{}, error)
- func (r Record) GetString(name string) (string, error)
- func (r Record) GetTime(name string) (time.Time, error)
- func (r Record) Len() int
- type Response
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnknownColumn = errors.New("unknown record column") ErrInvalidValue = errors.New("invalid record value") )
Record retrieval errors
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command is a binding command instance.
func (*Command) Op ¶
func (c *Command) Op(op CommandOpFunc)
type CommandOpFunc ¶
type CommandOpFunc func(*Command)
type Livestatus ¶
type Livestatus struct {
// contains filtered or unexported fields
}
Livestatus is a binding instance.
func NewLivestatus ¶
func NewLivestatus(network, address string) *Livestatus
NewLivestatus creates a new binding instance.
func NewLivestatusWithDialer ¶
func NewLivestatusWithDialer(dialer func() (net.Conn, error)) *Livestatus
NewLivestatusWithDialer creates a new binding that uses the net.Conn returned by the provided dialer function.
func (*Livestatus) Close ¶
func (l *Livestatus) Close() error
Close any open connection from a KeepAlive
func (*Livestatus) Command ¶
func (l *Livestatus) Command() *Command
Command creates a new command instanc.
func (*Livestatus) Query ¶
func (l *Livestatus) Query(table string) *Query
Query creates a new query instance on a spacific table.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query is a binding query instance.
func (*Query) KeepAliveOff ¶
KeepAliveOff disables the default keepalive from Command
func (*Query) WaitCondition ¶
WaitCondition sets a new wait condition to apply to the query.
func (*Query) WaitConditionAnd ¶
WaitConditionAnd combines the n last wait conditions into a new wait condition using a `And` operation.
func (*Query) WaitConditionNegate ¶
WaitConditionNegate negates the most recent wait condition.
func (*Query) WaitConditionOr ¶
WaitConditionOr combines the n last wait condition into a new wait condition using a `Or` operation.
func (*Query) WaitObject ¶
WaitObject sets the object within the queried table to wait on. For the table hosts, hostgroups, servicegroups, contacts and contactgroups this is simply the name of the object. For the table services it is the hostname followed by a space followed by the service description
func (*Query) WaitTimeout ¶
WaitTimeout set a timeout for the wait condition.
func (*Query) WaitTrigger ¶
WaitTrigger sets the nagios event that will trigger a check of the wait condition.
type Record ¶
type Record map[string]interface{}
Record is query response entry.
func (Record) Get ¶
Get returns an interface value for a specific column
Returns an error if the column is unknown.
func (Record) GetBool ¶
GetBool returns a boolean value for a specific column.
Returns an error if the column is unknown or if the value can't be represented as a boolean.
func (Record) GetFloat ¶
GetFloat returns a float value for a specific column.
Returns an error if the column is unknown or if the value can't be represented as a float.
func (Record) GetInt ¶
GetInt returns an integer value for a specific column.
Returns an error if the column is unknown or if the value can't be represented as an integer.
func (Record) GetSlice ¶
GetSlice returns a slice of interfaces for a specific column.
Returns an error if the column is unknown or if the value can't be represented as a slice.
func (Record) GetString ¶
GetString returns a string value for a specific column.
Returns an error if the column is unknown or if the value can't be represented as a string.