Kapacitor: [alerta] token header prefix

Created on 2 Feb 2017  路  12Comments  路  Source: influxdata/kapacitor

Back in December I merged a pull request that changed the alerta Authorization prefix from Bearer to Key because of an issue experienced by @emirozer https://github.com/influxdata/kapacitor/issues/1076.

I was running a custom version of alerta at the time so I assumed that I had changed Bearer to Key myself. On further inspection I realized that alerta officialy started using the Bearer prefix a year ago. https://github.com/guardian/alerta/commit/46e52094013f0c19a664f3aeb7ebdf1bfcbf64f4 which means @emirozer was using an older version of alerta.

I have been running a custom version of kapacitor for myself that uses Bearer so I haven't had any issues, but going forward there is a chance that someone will run into this again. I am proposing that the prefix be configurable. The default value would be Bearer.

I will work on a pull request in the coming days that addresses this. I will be sure to alert @emirozer if the pull request gets accepted.

pextensibility

Most helpful comment

This is confusing, I'm a long time alerta and kapacitor user and I had to change my config to something like that to make it work: (doing that for all those lovely web search engine users)

kapacitor.conf

[alerta]
  enabled = true
  url = "http://alerta:8080/api"
  token = "myToken"
  token-prefix ="Key"
  environment = "Development"
  origin = "kapacitor"

All 12 comments

@allen13 Thanks for being proactive on this. I'll keep an eye out for the PR.

@emirozer Once this commit goes through if you are still on the older version of alerta you can add this to your config:
[alerta]
token-prefix = "Key"

Thanks getting this merged in so quickly @nathanielc!

Sorry, speaking about new and old alerta... I actually managed to get kapacitor+alerta running only after I used token-prefix ="Key". before that it was Alerta: Token is invalid error all the time.

And alerta version is 5.0.4 which is the latest and Kapacitor 1.3.3.

It doesn't work with token-prefix = "Bearer" or token-prefix = ""

I agree with @v-zhuravlev. Systems integrating with Alerta should use "Key \alerta command-line tool. I suggest you change the default token-prefix back to "Key".

Whatever the latest default for alerta is should probably be the default here. This is more of an issue with the alerta project changing back and forth.

@allen13 Just for the record, the Alerta authorization header has never changed. It was always "Key" for API keys and "Bearer" for the web UI.

Hey, I've made PR because I spend some time why proper tokens are not working with Alerta on latest version of kapacitor (upgrade from 1.2 to 1.4).

Alerta doesn't work with Bearer, so it shouldn't be a default value.

Thanks for notifying me in this thread, much appreciated.

Ping @pommi

Any update of this or reason it was not merged yet ? Still Alerta's default prefix is Bearer which is wrong and without change of kapacitord's config Alerta integration is broken.

I was going to prepare a PR cause I fell into the same trap. Can we get :eyes: on https://github.com/influxdata/kapacitor/pull/1753 and merge it cause the current default in kapacitor.conf is confusing.

This is confusing, I'm a long time alerta and kapacitor user and I had to change my config to something like that to make it work: (doing that for all those lovely web search engine users)

kapacitor.conf

[alerta]
  enabled = true
  url = "http://alerta:8080/api"
  token = "myToken"
  token-prefix ="Key"
  environment = "Development"
  origin = "kapacitor"
Was this page helpful?
0 / 5 - 0 ratings