Documentation ¶
Overview ¶
A fast package for sending metrics to collectd.
Index ¶
Constants ¶
const ( COUNTER = 0 GAUGE = 1 DERIVE = 2 ABSOLUTE = 3 )
const DefaultBufferSize = 1452
DefaultBufferSize is the default size of "Buffer". This is based on the maximum bytes that fit into an Ethernet frame without fragmentation:
<Ethernet frame> - (<IPv6 header> + <UDP header>) = 1500 - (40 + 8) = 1452
const MinimumBufferSize = 256
Variables ¶
var ErrPacketFull = errors.New("not enough space")
Functions ¶
This section is empty.
Types ¶
type AuthFile ¶
type AuthFile struct {
// contains filtered or unexported fields
}
AuthFile implements the collectd password file format.. The file has a very simple syntax with one username / password mapping per line, separated by a colon. For example:
alice: w0nderl4nd bob: bu1|der
func NewAuthFile ¶
NewAuthFile initializes and returns a new AuthFile. A valid (but empty) authfile is still returned even if there is an error.
type EncryptedPacket ¶
type EncryptedPacket struct { PlainTextPacket // contains filtered or unexported fields }
func NewEncryptedPacket ¶
func NewEncryptedPacket(username, password string) (*EncryptedPacket, error)
func NewEncryptedPacketSize ¶
func NewEncryptedPacketSize(username, password string, size int) (*EncryptedPacket, error)
func (*EncryptedPacket) Finalize ¶
func (b *EncryptedPacket) Finalize() []byte
type ExecFormatter ¶
type ExecFormatter struct { NoInterval bool // contains filtered or unexported fields }
func (*ExecFormatter) AddValueList ¶
func (ef *ExecFormatter) AddValueList(vl ValueList) error
func (*ExecFormatter) Finalize ¶
func (ef *ExecFormatter) Finalize() []byte
func (*ExecFormatter) Reset ¶
func (ef *ExecFormatter) Reset()
type Metric ¶
type MetricSink ¶
type Packet ¶
type Packet interface { MetricSink Finalize() []byte Reset() }
type PlainTextPacket ¶
type PlainTextPacket struct {
// contains filtered or unexported fields
}
func NewPlainTextPacket ¶
func NewPlainTextPacket() *PlainTextPacket
func NewPlainTextPacketSize ¶
func NewPlainTextPacketSize(size int) *PlainTextPacket
NewBuffer initializes a new metric buffer, panics if the size is smaller than MinimumBufferSize.
func (*PlainTextPacket) AddValueList ¶
func (b *PlainTextPacket) AddValueList(v ValueList) error
func (*PlainTextPacket) Finalize ¶
func (b *PlainTextPacket) Finalize() []byte
func (*PlainTextPacket) Reset ¶
func (b *PlainTextPacket) Reset()
type SignedPacket ¶
type SignedPacket struct { PlainTextPacket // contains filtered or unexported fields }
func NewSignedPacket ¶
func NewSignedPacket(username, password string) (*SignedPacket, error)
func NewSignedPacketSize ¶
func NewSignedPacketSize(username, password string, size int) (*SignedPacket, error)
func (*SignedPacket) Finalize ¶
func (b *SignedPacket) Finalize() []byte
type UDPClient ¶
type UDPClient struct {
// contains filtered or unexported fields
}
A udp client that buffers metrics to write complete udp packets. The client is safe to use from multiple goroutines concurrently.
func DialUDP ¶
func DialUDP(address string, opts UDPClientOptions) (*UDPClient, error)
Dial connects to the collectd server at address. "address" must be a network address accepted by net.Dial().
func (*UDPClient) AddValueList ¶
type UDPClientOptions ¶
type UDPClientOptions struct { // Mode determines whether data is signed, encrypted or sent // in plain text. When zero no encryption is used. Mode UDPMode // Username and password for the "Sign" and "Encrypt" modes. Username, Password string // Size of the send buffer. When zero, DefaultBufferSize is used. BufferSize int }