udp_listener

package
v0.0.0-...-72bdc65 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2016 License: MIT Imports: 7 Imported by: 0

README

UDP listener service input plugin

The UDP listener is a service input plugin that listens for messages on a UDP socket and adds those messages to InfluxDB. The plugin expects messages in the Telegraf Input Data Formats.

Configuration:

This is a sample configuration for the plugin.

[[inputs.udp_listener]]
  ## Address and port to host UDP listener on
  service_address = ":8092"

  ## Number of UDP messages allowed to queue up. Once filled, the
  ## UDP listener will start dropping packets.
  allowed_pending_messages = 10000

  ## UDP packet size for the server to listen for. This will depend
  ## on the size of the packets that the client is sending, which is
  ## usually 1500 bytes.
  udp_packet_size = 1500

  ## Data format to consume. This can be "json", "influx" or "graphite"
  ## Each data format has it's own unique set of configuration options, read
  ## more about them here:
  ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
  data_format = "influx"

A Note on UDP OS Buffer Sizes

Some OSes (most notably, Linux) place very restricive limits on the performance of UDP protocols. It is highly recommended that you increase these OS limits to at least 8MB before trying to run large amounts of UDP traffic to your instance. 8MB is just a recommendation, and can be adjusted higher.

Linux

Check the current UDP/IP receive buffer limit & default by typing the following commands:

sysctl net.core.rmem_max
sysctl net.core.rmem_default

If the values are less than 8388608 bytes you should add the following lines to the /etc/sysctl.conf file:

net.core.rmem_max=8388608
net.core.rmem_default=8388608

Changes to /etc/sysctl.conf do not take effect until reboot. To update the values immediately, type the following commands as root:

sysctl -w net.core.rmem_max=8388608
sysctl -w net.core.rmem_default=8388608
BSD/Darwin

On BSD/Darwin systems you need to add about a 15% padding to the kernel limit socket buffer. Meaning if you want an 8MB buffer (8388608 bytes) you need to set the kernel limit to 8388608*1.15 = 9646900. This is not documented anywhere but happens in the kernel here.

Check the current UDP/IP buffer limit by typing the following command:

sysctl kern.ipc.maxsockbuf

If the value is less than 9646900 bytes you should add the following lines to the /etc/sysctl.conf file (create it if necessary):

kern.ipc.maxsockbuf=9646900

Changes to /etc/sysctl.conf do not take effect until reboot. To update the values immediately, type the following commands as root:

sysctl -w kern.ipc.maxsockbuf=9646900

Documentation

Index

Constants

View Source
const UDP_PACKET_SIZE int = 1500

Variables

This section is empty.

Functions

This section is empty.

Types

type UdpListener

type UdpListener struct {
	ServiceAddress         string
	UDPPacketSize          int `toml:"udp_packet_size"`
	AllowedPendingMessages int

	sync.Mutex
	// contains filtered or unexported fields
}

func (*UdpListener) Description

func (u *UdpListener) Description() string

func (*UdpListener) Gather

func (u *UdpListener) Gather(_ telegraf.Accumulator) error

All the work is done in the Start() function, so this is just a dummy function.

func (*UdpListener) SampleConfig

func (u *UdpListener) SampleConfig() string

func (*UdpListener) SetParser

func (u *UdpListener) SetParser(parser parsers.Parser)

func (*UdpListener) Start

func (u *UdpListener) Start(acc telegraf.Accumulator) error

func (*UdpListener) Stop

func (u *UdpListener) Stop()

Jump to

Keyboard shortcuts

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