sensu / sensu-influxdb-handler

Sensu Go InfluxDB Metrics Handler
https://sensu.io
MIT License
14 stars 16 forks source link

Influx 2.0 Support #38

Closed BrianInAz closed 2 years ago

BrianInAz commented 4 years ago

Hello - I was hoping to connect Sensu to my InfluxDB 2.0 installation. Are there any plans to update this handler?

InfluxDB 2.0 Go client

Thanks

sensu-discourse commented 4 years ago

This issue has been mentioned on Sensu Community. There might be relevant details there:

https://discourse.sensu.io/t/influxdb-handler-issue/1970/2

asachs01 commented 3 years ago

👋 Howdy frands, I just started rolling out Influxdb 2.0 and was curious aout @BrianInAz 's question as well.

kmf commented 3 years ago

bump!

ahoiroman commented 3 years ago

Hello everybody,

I am happy to see influxdb2-support, too :-)

DJM0 commented 2 years ago

Any update on this?

jspaleta commented 2 years ago

Work around for now is to add a retention policy mapping for your influxdbv2 bucket https://docs.influxdata.com/influxdb/v2.0/tools/grafana/?t=InfluxQL#view-and-create-influxdb-dbrp-mappings

jspaleta commented 2 years ago

We have to make a decision about whether we want to roll in influxdbv2 support into this plugin or do we want to create a new plugin specifically for v2.

It appears its possible to support both influxdbv1 and influxdbv2 with the same client library, but doing so will introduce a breaking change and a major version bump.

Here's the proposed breaking change: remove influxdbv1 specific cli arguments: user,password,dbName,address replace with influxdbv2 arguments: url,bucket,token

influxdbv1 support is maintained by the using the documented database/retention-policy as specially formatted bucket name and user:pass as specially formatted token value understood by the influx golang client.

asachs01 commented 2 years ago

FWIW, the workaround for the handler in the meantime can be found here: https://github.com/unpoller/unpoller/issues/407#issue-1193065803

Once your InfluxDB 2.0 bucket is created (using CLI or 8086 web UI) :

# influx bucket list
ID                      Name                    Retention       Organization ID
f2763f172b50dea3        _monitoring             168h0m0s        143f24876e1ec5d2
74e9f584fccacedc        _tasks                  72h0m0s         143f24876e1ec5d2
7112dfae5d1aa164        sensu_events                   8760h0m0s       143f24876e1ec5d2

# influx v1 dbrp create --db sensu_events --rp sensu-rp --bucket-id  7112dfae5d1aa164 --default
ID                      Database        Bucket ID               Retention Policy        Default Organization ID
075053f3abe50000        sensu_events       7112dfae5d1aa164        unifi-rp                true    143f24876e1ec5d2

# influx v1 auth create  --read-bucket 7112dfae5d1aa164 --write-bucket 7112dfae5d1aa164 --username sensu
Please type your password: 

Please type your password again:

You then just have to fill up.conf :

[influxdb]
  disable = false
  url  = "http://influxdb:8086"
  user = "sensu"
  pass = "asupersecretpassword"
  db = "sensu_events"

Contextualizing this example for your Sensu deployment will allow handlers to ship metrics to an InfluxDB 2.0 instance until 2.0 support is either rolled into this plugin or there's a new handler for InfluxDB 2.0.

jspaleta commented 2 years ago

New branch up that is being prepped for a PR to add influx 2 support. branch name: js/refactor-support-v2 This branch uses https://github.com/influxdata/influxdb-client-go and is intended to be backwards compatible with influxdb v1.8.x Details: https://github.com/influxdata/influxdb-client-go#influxdb-18-api-compatibility

jspaleta commented 2 years ago

Closing, newly tagged release 4.0.0 has native support for influxDB v2 using upstream provided golang client.

Note release provides backwards compatibility for influxDB v1.8+, as per guidance in upstream SDK. Support for influxDB v1.7 and lower has been dropped.