I have set up influxdb metrics output handlers using the assets and commands provided in the docs. I replaced all the variables with all my stuff and have the influx database set up with the correct name. I have the sensu-backend and two agents running in docker containers and they are running the latest version of sensu. The issue I am having is that when the checks are run, and being piped to influx, instead of the output being a connection error or success, it returns the whole usage information for the sensu-influxdb-handler command from the sensu/sensu-influxdb-handler asset. I don’t know why its doing this. Here is how I set up the handler:
sensuctl handler create influx-db \
--type pipe \
--command "sensu-influxdb-handler -d sensu" \
--env-vars INFLUXDB_ADDR=http://127.0.0.1:8086,INFLUXDB_USER=something,INFLUXDB_PASS=something \
--runtime-assets sensu/sensu-influxdb-handler
And here is what I found in the logs, I included the check that is run, start of the check being piped to influx and the output, which has two errors, the usage information and connection refused issue:
{"check":"check-metrics-cpu","component":"eventd","entity":"pmgdevmbp","event_uuid":"7ad3044a-e334-4ac1-8c65-36f14e9d1f09","level":"info","metrics":true,"msg":"eventd received event","time":"2020-07-27T03:26:52Z"}
{"check_name":"check-metrics-cpu","check_namespace":"default","component":"pipelined","entity_name":"pmgdevmbp","entity_namespace":"default","handler":"influx-db","level":"info","metric_count":0,"msg":"sending event to handler","time":"2020-07-27T03:26:52Z","uuid":"7ad3044a-e334-4ac1-8c65-36f14e9d1f09"}
{"asset":"sensu/sensu-influxdb-handler","component":"asset-manager","entity":"0bee7ac97808","level":"info","msg":"asset includes builds, using builds instead of asset","time":"2020-07-27T03:26:52Z"}
{"assets":["sensu/sensu-influxdb-handler"],"check":"check-metrics-cpu","component":"pipelined","entity":"pmgdevmbp","event_uuid":"7ad3044a-e334-4ac1-8c65-36f14e9d1f09","handler":"influx-db","level":"info","msg":"event pipe handler executed","namespace":"default",
"output":"Usage:\n sensu-influxdb-handler [flags]\n sensu-influxdb-handler [command]\n\nAvailable Commands:\n help Help about any command\n version Print the version number of this plugin\n\nFlags:
\n -a, --addr string the address of the influxdb server, should be of the form 'http://host:port', defaults to 'http://localhost:8086' or value of INFLUXDB_ADDR env variable (default \"http://localhost:8086\")
\n -c, --check-status-metric if true, the check status result will be captured as a metric\n -d, --db-name string the influxdb to send metrics to\n
-h, --help help for sensu-influxdb-handler\n -i, --insecure-skip-verify if true, the influx client skips https certificate verification\n -p, --password string
the password for the given db, defaults to value of INFLUXDB_PASS env variable\n --precision string the precision value of the metric (default \"s\")\n -u, --username string
the username for the given db, defaults to value of INFLUXDB_USER env variable\n\nUse \"sensu-influxdb-handler [command] --help\" for more information about a command.\n
\nError executing sensu-influxdb-handler: error executing handler: Post http://localhost:8086/write?consistency=\u0026db=sensu\u0026precision=s\u0026rp=: dial tcp
127.0.0.1:8086: connect: connection refused\n","status":1,"time":"2020-07-27T03:26:52Z"}