matthewcummings516
matthewcummings516

Reputation: 687

Can I use Kapacitor to process data before sending it to InfluxDB?

I'm bootstrapping a brand new TICK stack and really loving the whole system overall. . . however, there's one bit about Kapacitor which is puzzling me.

If you look at the diagram here: https://www.influxdata.com/time-series-platform/kapacitor/, there's one arrow connecting Telegraf to Kapacitor. Telegraf can send metric data directly to Influx which makes me wonder what the use case is for forwarding through Kapacitor to Influx.

The only use case which comes to mind is that you can move processing logic out of agent plugins into Kapacitor and thereby minimize the agent's footprint.

Long story short, am I missing something here, is that the use case implied by the arrow from Kapacitor to Influx?

Upvotes: 3

Views: 1244

Answers (1)

sebito91
sebito91

Reputation: 524

Kapacitor gives you the ability to process data streams (or read from an existing influxdb instance) and write out to influxdb. The beauty of this is having a separate process altogether handling your data processing from the primary backend.

A classic example is downsampling. If you wanted to do this in influxdb directly you'd need to handle a continuous query to do that for you...but they're somewhat of a pain to manage. Kapacitor can help make this easier as follows:

stream
|from()
    .database('telegraf')
    .measurement('cpu')
    .groupBy(*)
|window()
    .period(5m)
    .every(5m)
    .align()
|mean('usage_idle')
    .as('usage_idle')
|influxDBOut()
    .database('telegraf')
    .retentionPolicy('autogen')
    .measurement('mean_cpu_idle')
    .precision('s')

Hope that helps!

Upvotes: 5

Related Questions