Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to set Basic Auth credentials for the default prometheus input plugin #118

Open
magoogli opened this issue Apr 25, 2023 · 0 comments

Comments

@magoogli
Copy link

At the moment I can't figure out a way to set the username and password for basic authentication for the default prometheus input plugin.

Having a look at:
https://github.com/influxdata/telegraf/tree/master/plugins/inputs/prometheus

It seems that this is possible by setting username and password, however this does not seem currently possible via pod annotations.

To work around this I currently redefine the entire prometheus input via the annotations as follows:

podAnnotations:  
  telegraf.influxdata.com/class: "default"    
  telegraf.influxdata.com/inputs: |+
    [[inputs.prometheus]]
      urls = ["http://127.0.0.1:8080/metrics"]
      username = "MyUsername"
      password = "MyPassword"

However this results in two prometheus inputs in the /etc/telegraf/telegraf.conf file as below.

[[inputs.prometheus]]
  urls = ["http://127.0.0.1:8080/metrics"]

[[inputs.prometheus]]
  urls = ["http://127.0.0.1:8080/metrics"]
  username = "MyUsername"
  password = "MyPassword"
...

Of course the first / default one that I cannot disable or set basic auth credentials on spews out 401 errors.

So either the username and password should be settable via annotations, or just being able to disable the default generated input would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant