update readme

This commit is contained in:
Cody Lee 2020-10-11 11:45:20 -05:00
parent 51916c19e7
commit 057faf9de9
2 changed files with 92 additions and 1 deletions

View File

@ -1,3 +1,83 @@
# datadogunifi # datadogunifi
UniFi Poller Output Plugin for DataDog UniFi Poller Output Plugin for DataDog
## Configuration
```yaml
datadog:
# How often to poll UniFi and report to Datadog.
interval: "2m"
# To disable this output plugin
disable: false
# Datadog Custom Options
# address to talk to the datadog agent, by default this uses the local statsd UDP interface
# address: "..."
# namespace to prepend to all data
# namespace: ""
# tags to append to all data
# tags:
# - foo
# max_bytes_per_payload is the maximum number of bytes a single payload will contain.
# The magic value 0 will set the option to the optimal size for the transport
# protocol used when creating the client: 1432 for UDP and 8192 for UDS.
# max_bytes_per_payload: 0
# max_messages_per_payload is the maximum number of metrics, events and/or service checks a single payload will contain.
# This option can be set to `1` to create an unbuffered client.
# max_messages_per_payload: 0
# BufferPoolSize is the size of the pool of buffers in number of buffers.
# The magic value 0 will set the option to the optimal size for the transport
# protocol used when creating the client: 2048 for UDP and 512 for UDS.
# buffer_pool_size: 0
# buffer_flush_interval is the interval after which the current buffer will get flushed.
# buffer_flush_interval: 0
# buffer_shard_count is the number of buffer "shards" that will be used.
# Those shards allows the use of multiple buffers at the same time to reduce
# lock contention.
# buffer_shard_count: 0
# sender_queue_size is the size of the sender queue in number of buffers.
# The magic value 0 will set the option to the optimal size for the transport
# protocol used when creating the client: 2048 for UDP and 512 for UDS.
# sender_queue_size: 0
# write_timeout_uds is the timeout after which a UDS packet is dropped.
# write_timeout_uds: 5000
# receive_mode determines the behavior of the client when receiving to many
# metrics. The client will either drop the metrics if its buffers are
# full (ChannelMode mode) or block the caller until the metric can be
# handled (MutexMode mode). By default the client will MutexMode. This
# option should be set to ChannelMode only when use under very high
# load.
#
# MutexMode uses a mutex internally which is much faster than
# channel but causes some lock contention when used with a high number
# of threads. Mutex are sharded based on the metrics name which
# limit mutex contention when goroutines send different metrics.
#
# ChannelMode: uses channel (of ChannelModeBufferSize size) to send
# metrics and drop metrics if the channel is full. Sending metrics in
# this mode is slower that MutexMode (because of the channel), but
# will not block the application. This mode is made for application
# using many goroutines, sending the same metrics at a very high
# volume. The goal is to not slow down the application at the cost of
# dropping metrics and having a lower max throughput.
# receive_mode: 0
# channel_mode_buffer_size is the size of the channel holding incoming metrics
# channel_mode_buffer_size: 0
# aggregation_flush_interval is the interval for the aggregator to flush metrics
# aggregation_flush_interval: 0
```

View File

@ -34,32 +34,41 @@ type Config struct {
// Namespace to prepend to all metrics, events and service checks name. // Namespace to prepend to all metrics, events and service checks name.
Namespace *string `json:"namespace" toml:"namespace" xml:"namespace,attr" yaml:"namespace"` Namespace *string `json:"namespace" toml:"namespace" xml:"namespace,attr" yaml:"namespace"`
// Tags are global tags to be applied to every metrics, events and service checks. // Tags are global tags to be applied to every metrics, events and service checks.
Tags []string `json:"tags" toml:"tags" xml:"tags,attr" yaml:"tags"` Tags []string `json:"tags" toml:"tags" xml:"tags,attr" yaml:"tags"`
// MaxBytesPerPayload is the maximum number of bytes a single payload will contain. // MaxBytesPerPayload is the maximum number of bytes a single payload will contain.
// The magic value 0 will set the option to the optimal size for the transport // The magic value 0 will set the option to the optimal size for the transport
// protocol used when creating the client: 1432 for UDP and 8192 for UDS. // protocol used when creating the client: 1432 for UDP and 8192 for UDS.
MaxBytesPerPayload *int `json:"max_bytes_per_payload" toml:"max_bytes_per_payload" xml:"max_bytes_per_payload,attr" yaml:"max_bytes_per_payload"` MaxBytesPerPayload *int `json:"max_bytes_per_payload" toml:"max_bytes_per_payload" xml:"max_bytes_per_payload,attr" yaml:"max_bytes_per_payload"`
// MaxMessagesPerPayload is the maximum number of metrics, events and/or service checks a single payload will contain. // MaxMessagesPerPayload is the maximum number of metrics, events and/or service checks a single payload will contain.
// This option can be set to `1` to create an unbuffered client. // This option can be set to `1` to create an unbuffered client.
MaxMessagesPerPayload *int `json:"max_messages_per_payload" toml:"max_messages_per_payload" xml:"max_messages_per_payload,attr" yaml:"max_messages_per_payload"` MaxMessagesPerPayload *int `json:"max_messages_per_payload" toml:"max_messages_per_payload" xml:"max_messages_per_payload,attr" yaml:"max_messages_per_payload"`
// BufferPoolSize is the size of the pool of buffers in number of buffers. // BufferPoolSize is the size of the pool of buffers in number of buffers.
// The magic value 0 will set the option to the optimal size for the transport // The magic value 0 will set the option to the optimal size for the transport
// protocol used when creating the client: 2048 for UDP and 512 for UDS. // protocol used when creating the client: 2048 for UDP and 512 for UDS.
BufferPoolSize *int `json:"buffer_pool_size" toml:"buffer_pool_size" xml:"buffer_pool_size,attr" yaml:"buffer_pool_size"` BufferPoolSize *int `json:"buffer_pool_size" toml:"buffer_pool_size" xml:"buffer_pool_size,attr" yaml:"buffer_pool_size"`
// BufferFlushInterval is the interval after which the current buffer will get flushed. // BufferFlushInterval is the interval after which the current buffer will get flushed.
BufferFlushInterval *cnfg.Duration `json:"buffer_flush_interval" toml:"buffer_flush_interval" xml:"buffer_flush_interval,attr" yaml:"buffer_flush_interval"` BufferFlushInterval *cnfg.Duration `json:"buffer_flush_interval" toml:"buffer_flush_interval" xml:"buffer_flush_interval,attr" yaml:"buffer_flush_interval"`
// BufferShardCount is the number of buffer "shards" that will be used. // BufferShardCount is the number of buffer "shards" that will be used.
// Those shards allows the use of multiple buffers at the same time to reduce // Those shards allows the use of multiple buffers at the same time to reduce
// lock contention. // lock contention.
BufferShardCount *int `json:"buffer_shard_count" toml:"buffer_shard_count" xml:"buffer_shard_count,attr" yaml:"buffer_shard_count"` BufferShardCount *int `json:"buffer_shard_count" toml:"buffer_shard_count" xml:"buffer_shard_count,attr" yaml:"buffer_shard_count"`
// SenderQueueSize is the size of the sender queue in number of buffers. // SenderQueueSize is the size of the sender queue in number of buffers.
// The magic value 0 will set the option to the optimal size for the transport // The magic value 0 will set the option to the optimal size for the transport
// protocol used when creating the client: 2048 for UDP and 512 for UDS. // protocol used when creating the client: 2048 for UDP and 512 for UDS.
SenderQueueSize *int `json:"sender_queue_size" toml:"sender_queue_size" xml:"sender_queue_size,attr" yaml:"sender_queue_size"` SenderQueueSize *int `json:"sender_queue_size" toml:"sender_queue_size" xml:"sender_queue_size,attr" yaml:"sender_queue_size"`
// WriteTimeoutUDS is the timeout after which a UDS packet is dropped. // WriteTimeoutUDS is the timeout after which a UDS packet is dropped.
WriteTimeoutUDS *cnfg.Duration `json:"write_timeout_uds" toml:"write_timeout_uds" xml:"write_timeout_uds,attr" yaml:"write_timeout_uds"` WriteTimeoutUDS *cnfg.Duration `json:"write_timeout_uds" toml:"write_timeout_uds" xml:"write_timeout_uds,attr" yaml:"write_timeout_uds"`
// ReceiveMode determins the behavior of the client when receiving to many
// ReceiveMode determines the behavior of the client when receiving to many
// metrics. The client will either drop the metrics if its buffers are // metrics. The client will either drop the metrics if its buffers are
// full (ChannelMode mode) or block the caller until the metric can be // full (ChannelMode mode) or block the caller until the metric can be
// handled (MutexMode mode). By default the client will MutexMode. This // handled (MutexMode mode). By default the client will MutexMode. This
@ -79,8 +88,10 @@ type Config struct {
// volume. The goal is to not slow down the application at the cost of // volume. The goal is to not slow down the application at the cost of
// dropping metrics and having a lower max throughput. // dropping metrics and having a lower max throughput.
ReceiveMode *statsd.ReceivingMode `json:"receive_mode" toml:"receive_mode" xml:"receive_mode,attr" yaml:"receive_mode"` ReceiveMode *statsd.ReceivingMode `json:"receive_mode" toml:"receive_mode" xml:"receive_mode,attr" yaml:"receive_mode"`
// ChannelModeBufferSize is the size of the channel holding incoming metrics // ChannelModeBufferSize is the size of the channel holding incoming metrics
ChannelModeBufferSize *int `json:"channel_mode_buffer_size" toml:"channel_mode_buffer_size" xml:"channel_mode_buffer_size,attr" yaml:"channel_mode_buffer_size"` ChannelModeBufferSize *int `json:"channel_mode_buffer_size" toml:"channel_mode_buffer_size" xml:"channel_mode_buffer_size,attr" yaml:"channel_mode_buffer_size"`
// AggregationFlushInterval is the interval for the aggregator to flush metrics // AggregationFlushInterval is the interval for the aggregator to flush metrics
AggregationFlushInterval *time.Duration `json:"aggregation_flush_interval" toml:"aggregation_flush_interval" xml:"aggregation_flush_interval,attr" yaml:"aggregation_flush_interval"` AggregationFlushInterval *time.Duration `json:"aggregation_flush_interval" toml:"aggregation_flush_interval" xml:"aggregation_flush_interval,attr" yaml:"aggregation_flush_interval"`
} }