Metrics format influxdb_line not apply

Hi,

I working on migration Sensu-Classic to Sensu-go and i have a problem with Metrics Format.
I use Sensu-go OSS (i try to 6.3 and 6.4)

The Sensu Metrics Format doesn’t seem to work. (I just followed the docs)

Collect service metrics with Sensu checks - Sensu Docs
Populate metrics in InfluxDB with handlers - Sensu Docs

[sensu@alt-server ~]$ sensuctl check info collect-metrics
=== collect-metrics
Name:              collect-metrics
Interval:          60
Command:           metrics-disk-usage.rb
Cron:
Timeout:           0
TTL:               0
Subscriptions:     linux
Handlers:
Runtime Assets:    sensu-plugins/sensu-plugins-disk-checks, sensu-ruby-runtime
Hooks:
Publish?:          true
Stdin?:            false
Proxy Entity Name:
Namespace:         default
Metric Format:     influxdb_line
Metric Handlers:   influx-db
[sensu@alt-server ~]$ sensuctl handler info influx-db
=== influx-db
Name:                  influx-db
Type:                  pipe
Timeout:               0
Filters:               has_metrics
Mutator:
Execute:               RUN:  sensu-influxdb-handler -d sensu
Environment Variables: INFLUXDB_ADDR=http://127.0.0.1:8086
Runtime Assets:        influxdb-handler

The output format does not seem to convert to influx format :frowning:
Jul 1 21:15:39 data sensu-agent: {"check":"metrics-cpu","component":"agent","error":"unable to extract metric from check output","level":"error","line":36,"msg":"metric field set is invalid, must contain a key=value pair","namespace":"default","time":"2021-07-01T21:15:39+02:00"}

Thanks for your help :slight_smile:

Hey,

The check you are trying to use outputs in graphite plaintext format so you need.
output_metric_format: graphite_plaintext in the check definition

The README for the plugin repository has the correct check configuration example:
https://github.com/sensu-plugins/sensu-plugins-disk-checks#check-definition

1 Like

Thanks, I think that sensu integrate a mutator to convert into influx format. :yum:

Hey
I don’t really understand why there is a need for an influx format mutator. The existing sensu influx handler knows how to convert Sensu Metrics into a format that influxdb knows how to ingest. Maybe you are trying to use the old influx handler written for Classic that doesn’t know about Sensu Event Metrics. You should make sure you are using The Sensu Go influxdb handler

Though if you need a mutator for any reason, its possible to build what you need using the Sensu plugin SDK. If you are looking to create a mutator, I’d suggest using the sensu-plugin-tool to generate a mutator plugin using the mutator template repository and then add the specific mutator logic you need. You can even list your mutator in Bonsai as an asset. If you want to share it with other users.