From 902afcd32e0493de3fac7fd6e1453d33b447514c Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Mon, 17 Jan 2022 15:09:27 -0600 Subject: [PATCH 1/7] enable datadog collector as an option --- go.mod | 1 + go.sum | 19 +++++++++++++++++++ main.go | 1 + 3 files changed, 21 insertions(+) diff --git a/go.mod b/go.mod index 00f209fa..87aa5acd 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/unpoller/unpoller go 1.16 require ( + github.com/unpoller/datadogunifi v0.0.0-20220117210709-255cee8eaa3b github.com/unpoller/influxunifi v0.0.0-20210623102357-4b2dc7fa818c github.com/unpoller/inputunifi v0.0.0-20210623102218-06574d44cc6b github.com/unpoller/lokiunifi v0.0.0-20210623102057-0902524b6a8a diff --git a/go.sum b/go.sum index e73ffe13..7655df53 100644 --- a/go.sum +++ b/go.sum @@ -34,6 +34,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DataDog/datadog-go v4.0.0+incompatible h1:Dq8Dr+4sV1gBO1sHDWdW+4G+PdsA+YSJOK925MxrrCY= +github.com/DataDog/datadog-go v4.0.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= @@ -53,6 +55,8 @@ github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6l github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -77,6 +81,7 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -150,6 +155,7 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -220,8 +226,10 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= @@ -278,6 +286,7 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -331,12 +340,18 @@ github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3 github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/unpoller/datadogunifi v0.0.0-20220117210709-255cee8eaa3b h1:3CmL9glNl4xIXXiscUeV9Hf6mHqwPmyHZ7TK8GuAvno= +github.com/unpoller/datadogunifi v0.0.0-20220117210709-255cee8eaa3b/go.mod h1:FvOpw3mdjBpgbmjFl4D3lD0wkV21tv5AWogE+5uuoh0= github.com/unpoller/influxunifi v0.0.0-20210623102357-4b2dc7fa818c h1:T+T+jWgL3+4Bgy3VuTLNJLoShvmrfPuH7DxaYeB0gho= github.com/unpoller/influxunifi v0.0.0-20210623102357-4b2dc7fa818c/go.mod h1:GHqTS6Ry8fcVDPoPuIhI6e7HPVH6tSOZIJsQ5h2zmJo= github.com/unpoller/inputunifi v0.0.0-20210623102218-06574d44cc6b h1:dHFTRAxwm064wPA4SOijcMfOqayrywn5foKqz7iU2BQ= @@ -349,6 +364,7 @@ github.com/unpoller/poller v0.0.0-20210623104748-50161c195d5e h1:tNBIBCmtc7whuhk github.com/unpoller/poller v0.0.0-20210623104748-50161c195d5e/go.mod h1:AbDp60t5WlLSRELAliMJ0RFQpm/0yXpyolVSZqNtero= github.com/unpoller/promunifi v0.0.0-20210623101918-b986e661ac99 h1:6x0qUKxU/A5UOUSoUGLbDuaGrXlRkOvdiWDGLnNC8BA= github.com/unpoller/promunifi v0.0.0-20210623101918-b986e661ac99/go.mod h1:xZQ+DIFUlI6XJqLHLEXxujWQwSzbESNtHtC0+njvOGA= +github.com/unpoller/unifi v0.0.0-20210914213836-fd3c38c905a3/go.mod h1:K9QFFGfZws4gzB+Popix19S/rBKqrtqI+tyPORyg3F0= github.com/unpoller/unifi v0.0.9-0.20210623100314-3dccfdbc4c80 h1:XjHGfJhMwnB63DYHgtWGJgDxLhxVcAOtf+cfuvpGoyo= github.com/unpoller/unifi v0.0.9-0.20210623100314-3dccfdbc4c80/go.mod h1:K9QFFGfZws4gzB+Popix19S/rBKqrtqI+tyPORyg3F0= github.com/unpoller/webserver v0.0.0-20210623101543-90d89bb0acdf h1:HhXi3qca3kyFEFPh0mqdr0bpQs94hJvMbUJztwPtf2A= @@ -469,6 +485,7 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -577,6 +594,7 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golift.io/cnfg v0.0.7 h1:qkNpP5Bq+5Gtoc6HcI8kapMD5zFOVan6qguxqBQF3OY= golift.io/cnfg v0.0.7/go.mod h1:AsB0DJe7nv0bizKaoy3e3MjjOF7upTpMOMvsfv4CNNk= @@ -669,6 +687,7 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= diff --git a/main.go b/main.go index 40994657..5e3eba4c 100644 --- a/main.go +++ b/main.go @@ -10,6 +10,7 @@ import ( // Load input plugins! _ "github.com/unpoller/inputunifi" // Load output plugins! + _ "github.com/unpoller/datadogunifi" _ "github.com/unpoller/influxunifi" _ "github.com/unpoller/lokiunifi" _ "github.com/unpoller/promunifi" From 6c6ae18b7c13f67f8f6f7adfebe1fe846c1b8524 Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Mon, 17 Jan 2022 15:15:32 -0600 Subject: [PATCH 2/7] mirror default config settings --- examples/up.conf.example | 76 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/examples/up.conf.example b/examples/up.conf.example index 800d6023..f7c59223 100644 --- a/examples/up.conf.example +++ b/examples/up.conf.example @@ -65,6 +65,82 @@ interval = "2m" timeout = "10s" +[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 + # Unpoller has an optional web server. To turn it on, set enable to true. If you # wish to use SSL, provide SSL cert and key paths. This interface is currently # read-only; it just displays information, like logs, devices and clients. From 7d27b8bd52b086bcbe06fcdec86fbda5e0636127 Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Tue, 18 Jan 2022 09:50:23 -0600 Subject: [PATCH 3/7] address pr comment switch to toml, not yaml in a toml :facepalm: default disable update examples --- examples/up.conf.example | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/examples/up.conf.example b/examples/up.conf.example index f7c59223..c068caf1 100644 --- a/examples/up.conf.example +++ b/examples/up.conf.example @@ -67,52 +67,51 @@ [datadog] # How often to poll UniFi and report to Datadog. - interval: "2m" + interval = "2m" # To disable this output plugin - disable: false + disable = true # Datadog Custom Options # address to talk to the datadog agent, by default this uses the local statsd UDP interface - # address: "..." + # address = "localhost:8125" - # namespace to prepend to all data - # namespace: "" + # namespace to prepend to all data, default is no additional prefix. + # namespace = "" # tags to append to all data - # tags: - # - foo + # tags = [ "customer:abc_corp" ] # 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_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 + # 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_pool_size = 0 # buffer_flush_interval is the interval after which the current buffer will get flushed. - # buffer_flush_interval: 0 + # 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 + # 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 + # sender_queue_size = 0 # write_timeout_uds is the timeout after which a UDS packet is dropped. - # write_timeout_uds: 5000 + # 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 @@ -133,13 +132,13 @@ # 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 + # receive_mode = 0 # channel_mode_buffer_size is the size of the channel holding incoming metrics - # channel_mode_buffer_size: 0 + # channel_mode_buffer_size = 0 # aggregation_flush_interval is the interval for the aggregator to flush metrics - # aggregation_flush_interval: 0 + # aggregation_flush_interval = 0 # Unpoller has an optional web server. To turn it on, set enable to true. If you # wish to use SSL, provide SSL cert and key paths. This interface is currently From 89587ae8d271ec44a744eadacc67ab8768f11175 Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Tue, 18 Jan 2022 09:53:08 -0600 Subject: [PATCH 4/7] update default comments --- examples/up.conf.example | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/up.conf.example b/examples/up.conf.example index c068caf1..d8a89d21 100644 --- a/examples/up.conf.example +++ b/examples/up.conf.example @@ -89,7 +89,8 @@ # 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. + # This option can be set to `1` to create an unbuffered client. Default is 0 to use the default datadog statsd + # client max messages. # max_messages_per_payload = 0 # BufferPoolSize is the size of the pool of buffers in number of buffers. @@ -98,19 +99,23 @@ # buffer_pool_size = 0 # buffer_flush_interval is the interval after which the current buffer will get flushed. + # Default is 0 to use the default datadog statsd setting. # 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. + # Default is 0 to use the default datadog statsd setting. # 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. + # Default is 0 to use the default datadog statsd setting. # sender_queue_size = 0 - # write_timeout_uds is the timeout after which a UDS packet is dropped. + # write_timeout_uds is the timeout after which a UDS packet is dropped. This is only useful when in UDS mode. + # Default is 5000 to use the default datadog statsd setting. # write_timeout_uds = 5000 # receive_mode determines the behavior of the client when receiving to many @@ -132,12 +137,15 @@ # 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. + # Default 0 is mutex mode, 1 is channel mode. # receive_mode = 0 # channel_mode_buffer_size is the size of the channel holding incoming metrics + # Default is 0 to use the default datadog statsd setting. # channel_mode_buffer_size = 0 # aggregation_flush_interval is the interval for the aggregator to flush metrics + # Default is 0 to use the default datadog statsd setting. # aggregation_flush_interval = 0 # Unpoller has an optional web server. To turn it on, set enable to true. If you From 273ff7c90f28b20c49bb2b47c271b57baad6a342 Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Tue, 18 Jan 2022 09:55:32 -0600 Subject: [PATCH 5/7] drop advanced defaults for datadog plugin, leave these documented upstream in the datadogunifi README --- examples/up.conf.example | 64 ---------------------------------------- 1 file changed, 64 deletions(-) diff --git a/examples/up.conf.example b/examples/up.conf.example index d8a89d21..52c3be3a 100644 --- a/examples/up.conf.example +++ b/examples/up.conf.example @@ -83,70 +83,6 @@ # tags to append to all data # tags = [ "customer:abc_corp" ] - # 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. Default is 0 to use the default datadog statsd - # client max messages. - # 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. - # Default is 0 to use the default datadog statsd setting. - # 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. - # Default is 0 to use the default datadog statsd setting. - # 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. - # Default is 0 to use the default datadog statsd setting. - # sender_queue_size = 0 - - # write_timeout_uds is the timeout after which a UDS packet is dropped. This is only useful when in UDS mode. - # Default is 5000 to use the default datadog statsd setting. - # 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. - # Default 0 is mutex mode, 1 is channel mode. - # receive_mode = 0 - - # channel_mode_buffer_size is the size of the channel holding incoming metrics - # Default is 0 to use the default datadog statsd setting. - # channel_mode_buffer_size = 0 - - # aggregation_flush_interval is the interval for the aggregator to flush metrics - # Default is 0 to use the default datadog statsd setting. - # aggregation_flush_interval = 0 # Unpoller has an optional web server. To turn it on, set enable to true. If you # wish to use SSL, provide SSL cert and key paths. This interface is currently From eaecfcdbfde6eb087f212b65761f8572cd5f6b8e Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Tue, 18 Jan 2022 10:00:22 -0600 Subject: [PATCH 6/7] add helpful comment back link for advanced options --- examples/up.conf.example | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/up.conf.example b/examples/up.conf.example index 52c3be3a..c968b54a 100644 --- a/examples/up.conf.example +++ b/examples/up.conf.example @@ -83,6 +83,9 @@ # tags to append to all data # tags = [ "customer:abc_corp" ] + # For more advanced options for very large amount of data collected see the upstream + # github.com/unpoller/datadogunifi repository README. + # Unpoller has an optional web server. To turn it on, set enable to true. If you # wish to use SSL, provide SSL cert and key paths. This interface is currently From fbb28c15ab04024cf6b82256e1ce845ffc5f3318 Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Tue, 25 Jan 2022 15:47:21 -0600 Subject: [PATCH 7/7] deal with golint on `master` branch failing CI for `varnamelen` lint check --- main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 5e3eba4c..f8e0b81f 100644 --- a/main.go +++ b/main.go @@ -26,14 +26,14 @@ func main() { } } -func setTimeZone(tz string) { - if tz == "" { +func setTimeZone(timezone string) { + if timezone == "" { return } var err error - if time.Local, err = time.LoadLocation(tz); err != nil { - log.Printf("[ERROR] Loading TZ Location '%s': %v\n", tz, err) + if time.Local, err = time.LoadLocation(timezone); err != nil { + log.Printf("[ERROR] Loading TZ Location '%s': %v\n", timezone, err) } }