Documentation
¶
Overview ¶
Package zabbix implements the sender protocol to send values to zabbix Taken from github.com/blacked/go-zabbix (discontinued)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metric ¶
type Metric struct { Host string `json:"host"` Key string `json:"key"` Value string `json:"value"` Clock int64 `json:"clock,omitempty"` NS int `json:"ns,omitempty"` Active bool `json:"-"` }
Metric class.
type Packet ¶
type Packet struct { Request string `json:"request"` Data []*Metric `json:"data,omitempty"` Clock int64 `json:"clock,omitempty"` NS int `json:"ns,omitempty"` Host string `json:"host,omitempty"` HostMetadata string `json:"host_metadata,omitempty"` }
Packet class.
type Response ¶
Reponse is a response for autoregister method
func (*Response) GetInfo ¶
func (r *Response) GetInfo() (*ResponseInfo, error)
type ResponseInfo ¶
type Sender ¶
type Sender struct { Host string ConnectTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration }
Sender class
func NewSenderTimeout ¶
func NewSenderTimeout( host string, connectTimeout time.Duration, readTimeout time.Duration, writeTimeout time.Duration, ) *Sender
NewSenderTimeout return a sender object to send metrics defining values for timeouts
func (*Sender) RegisterHost ¶
RegisterHost provides a register a Zabbix's host with Autoregister method.
func (*Sender) Send ¶
Send connects to Zabbix, send the data, return the response and close the connection
func (*Sender) SendMetrics ¶
func (s *Sender) SendMetrics(metrics []*Metric) (resActive Response, errActive error, resTrapper Response, errTrapper error)
SendMetrics send an array of metrics, making different packets for trapper and active items. The response for trapper metrics is in the first element of the res array and err array Response for active metrics is in the second element of the res array and error array