Pushing check results to influxdb?


I can’t seem to figure out how to push sensu go check results into influxdb. I’m not referring to metrics collection (which works fine for me), but a basic service check that returns OK, WARNING, CRITICAL results. I want to keep long term data for certain checks in influxdb and all the examples and documentation I find seems to refer only to metrics collection. I’ve tried mixing some of the example metrics collection config parameters into regular checks without joy. I’m sure it’s easy and I am doing something silly, but can anyone provide a basic service check example that push result to influxdb?




I think the best way forward for you is to add a mutator into your event pipeline and mutator the event definition and convert the check status into a metric of your choice. You should be able to do this with jq in a bash script for now, I’m going to work on a more general golang mutator asset that should work in the more general case and get back to you.

Thanks Jef, that would be super helpful if you could provide a generic example!

@paulp actually the latest version of the Influxdb handler has a command line option --check-status-metric that should do that for you.

However, along the lines of what Jef had mentioned, I’ve created a mutator that does similar and should work with any TSDB. It’s on Bonsai here.

1 Like

Thanks so much @todd! I will look into these solutions…

@todd @jspaleta thank you both for your help. I have confirmed the latest version of InfluxDB handler 3.2.0 (which for some reason hasn’t been pushed to Bonsai) does indeed help me push check status into influxdb by utilizing the newly added parameter “–check-status-metric”.

Thanks for letting us know it wasn’t updated on Bonsai. That has been fixed now as well.

Awesome I just enabled --check-status-metric and added the handler parameters to the related checks. Works like a charm :+1:

1 Like