zabbix

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2014 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentDefaultPort  = 10050
	ServerDefaultPort = 10051
)
View Source
const (
	HeaderString     = "ZBXD"
	HeaderLength     = len(HeaderString)
	HeaderVersion    = uint8(1)
	DataLengthOffset = int64(HeaderLength + 1)
	DataLengthSize   = int64(8)
	DataOffset       = int64(DataLengthOffset + DataLengthSize)
	ErrorMessage     = "ZBX_NOTSUPPORTED"
)
View Source
const (
	TrapperResponseSuccess = "success"
	TrapperResponseInfoFmt = "processed: %d; failed: %d; total: %d; seconds spent: %f"
	TrapperRequestString   = "sender data"
)

Variables

View Source
var (
	ErrorMessageBytes = []byte(ErrorMessage)
	Terminator        = []byte("\n")
	HeaderBytes       = []byte(HeaderString)
)

Functions

func Data2Packet

func Data2Packet(data []byte) []byte

func Data2Stream added in v0.0.7

func Data2Stream(data []byte, conn io.Writer) (int, error)

func FillDefaultPort

func FillDefaultPort(addr string, port int) string

func Get

func Get(addr string, key string, timeout time.Duration) (value string, err error)

func Packet2Data

func Packet2Data(packet []byte) (data []byte, err error)

func RunAgent added in v0.0.6

func RunAgent(addr string, callback func(string) (string, error)) error

func RunTrapper added in v0.0.6

func RunTrapper(addr string, callback func(TrapperRequest) (TrapperResponse, error)) error

func Stream2Data

func Stream2Data(conn io.Reader) (rdata []byte, err error)

Types

type TrapperData added in v0.0.6

type TrapperData struct {
	Host  string `json:"host"`
	Key   string `json:"key"`
	Value string `json:"value"`
	Clock int64  `json:"clock"`
}

type TrapperRequest added in v0.0.6

type TrapperRequest struct {
	Request string        `json:"request"`
	Clock   int64         `json:"clock"`
	Data    []TrapperData `json:"data"`
}

func (TrapperRequest) ToPacket added in v0.0.6

func (r TrapperRequest) ToPacket() []byte

type TrapperResponse added in v0.0.6

type TrapperResponse struct {
	Response  string `json:"response"`
	Info      string `json:"info"`
	Proceeded int    `json:""`
	Failed    int    `json:""`
	Total     int    `json:""`
}

func Send added in v0.0.6

func Send(addr string, data TrapperData, timeout time.Duration) (TrapperResponse, error)

func SendBulk added in v0.0.6

func SendBulk(addr string, req TrapperRequest, timeout time.Duration) (res TrapperResponse, err error)

func (TrapperResponse) ToPacket added in v0.0.6

func (r TrapperResponse) ToPacket() []byte

Jump to

Keyboard shortcuts

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