Multiple InfluxdbWriter and choice the correct writer based on a specifical host

Hi everyone,

I have differents host with different parameters and I want collect the perfdata and save them in Influxdb. I have my InfluxdbWriter but i want create an other writer for the host who are different. The problem is : How I can specify which writer choose ?

I don’t know if i was clear, thanks for your answers

Hi Jordan,

I’m not sure if you could do this in icinga2 via the configuration but a way to achieve what you describe is to use Kapacitor. It provides a HTTP listener that accepts the influx protocol and allows you to create tasks in tick files.

So you could have a stream task which reads the data and uses InfluxDBOut to write to cluster-01 for hostx and cluster-02 for example for the remaining hosts.

The overhead of kapacitor is low and the configuration is pretty straight forward.

Just an idea if this can’t be achieved by icinga2 configuration. :slight_smile:

3 Likes

Thanks for your reply,

I have look Kapacitor, if i understand, Kapacitor interact with Influxdb not Icinga2, Kapacitor read and write data come from Influxdb with the tasks who we have defined ?

Hi,

yes, that’s one way how Kapacitor works. In this case kapacitor subscribes to an influxdb instance and reads the data stream or reads the data from the database in batches and processes the data.

But this shouldn’t be needed in your case. Kapacitor provides a HTTP API as well and this one accepts write requests in the InfluxDB Line Protocol. See: https://docs.influxdata.com/kapacitor/v1.5/working/api/#writing-data

So, in theory ( I didn’t test it in combination with Icinga2 but I guess it works) it should work if you just configure the icinga influx module to write to the kapacitor instance.

1 Like