Icinga / icinga2

The core of our monitoring platform with a powerful configuration language and REST API.
https://icinga.com/docs/icinga2/latest
GNU General Public License v2.0
2.01k stars 576 forks source link

Support for InfluxDB 2.x #8711

Closed mwaldmueller closed 3 years ago

mwaldmueller commented 3 years ago

InfluxdbWriter should fully support the changes of InfluxDB OSS 2.0 (see: https://docs.influxdata.com/influxdb/v2.0/write-data/)

In the meantime the compatibility API could help, untested from my side. (see: https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/)

julianbrost commented 3 years ago

The line protocol (i.e. the body of the HTTP request you send to InfluxDB) seems to be the same as in v1.x, so this is mostly about authorization and other metadata sent with the request.

So we need the following changes:

  1. Add a new config option for the authorization token (this can be specified as an alternative to username+password or basic_auth (#8314)). Use this do determine whether to use protocol version 1 or 2?
  2. Add config options for organization and bucket. Requires to make the existing database option optional as this is no longer supported in v2. Could also be used to determine which protocol version is used.
  3. Update the following to support both protocol versions: https://github.com/Icinga/icinga2/blob/8dc069dc2484a47c40ae7b579cea6bea87cc4313/lib/perfdata/influxdbwriter.cpp#L489-L519

In summary, if I haven't missed anything, this should be pretty straight-forward.

Unrelated (to API v2) note: I'm wondering why we use second precision even though both Icinga and InfluxDB support sub-second precision. We could change this to nanoseconds if we're touching the code anyways.