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

Default /metrics route does not support specifying auth_module #815

Open
OscarVanL opened this issue Feb 14, 2024 · 5 comments
Open

Default /metrics route does not support specifying auth_module #815

OscarVanL opened this issue Feb 14, 2024 · 5 comments

Comments

@OscarVanL
Copy link
Contributor

mysqld_exporter version: output of mysqld_exporter --version

v0.15.1

MySQL server version

MySQL v5.7, v8.0, also MariaDB 10.7

mysqld_exporter command line flags

--config.my-cnf=/etc/mysql/conf.d/mysqld-exporter.cnf

What did you do that produced an error?

I have followed the docs to setup multi-target support.

The use-case is that I have lots of MySQL/MariaDB servers and do not want to reuse the same username/password across them all.

To achieve this, I have created multiple auth modules in the config file, then created multiple prometheus jobs each using a different auth_module for all the target(s) where those credentials apply.

However, it does not operate as the docs suggest and continues to only use the default client auth_module for all targets.

As a result, authentication fails to my instances.

What did you expect to see?

The specified auth_module should be utilised on the /metrics route for the target database instance.

What did you see instead?

There appears to be one of the following:

  • Incorrect documentation
  • A bug in the /metrics path that does not exist in the /probe path

Either the documentation does not mention that the the value metrics_path: /probe must be set on the prometheus config (overriding the default /metrics), or there is a bug that /metrics does not utilise the provided auth_module param.

@Sam-Sundar
Copy link

Hey @OscarVanL,

Can you share your scrape config ? I too have similar issue, where /probe is not being scrapped and instead /metrics is being scraped which is nothing but exporter's metrics and not the SQL's metrics.

@OscarVanL
Copy link
Contributor Author

@Sam-Sundar

I modified my prometheus scrape config to look like this:

  - job_name: mysqld-exporter
    metrics_path: /probe
    params:
      auth_module: [client.dev]
    static_configs:
      - targets:
          - 'my-db:3306'
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: localhost:9104

Specifically adding the metrics_path: /probe line made it scrape the correct path.

@Sam-Sundar
Copy link

Hey @OscarVanL ,

i tried this and still it didn't work. Attaching one more issue link below, please point me where i'm making the mistake ?

#812

@OscarVanL
Copy link
Contributor Author

I couldn't be sure @Sam-Sundar. I'm not an expert with this project, and your setup looks far more complicated than mine.

@Belgarioz
Copy link

Hello @OscarVanL ,
I am having the same problem: no matter the value in auth_module, it always take the default [client] section.
Have you found a solution?

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

3 participants