Mysqld_exporter getting error -> An error has occurred while serving metrics:

429 views
Skip to first unread message

Prashant Singh

unread,
Nov 25, 2022, 1:37:06 AM11/25/22
to Prometheus Users

hi All,

I am getting mysqld exporter error and find error detail .


An error has occurred while serving metrics:

12 error(s) occurred:
* [from Gatherer #2] collected metric "mysql_info_schema_auto_increment_column" { label:<name:"column" value:"id" > label:<name:"schema" value:"product_catalog" > label:<name:"table" value:"service_area_matrix_gvpn" > gauge:<value:1 > } was collected before with the same name and label values
* [from Gatherer #2] collected metric "mysql_info_schema_auto_increment_column_max" { label:<name:"column" value:"id" > label:<name:"schema" value:"product_catalog" > label:<name:"table" value:"service_area_matrix_gvpn" > gauge:<value:2.147483647e+09 > } was collected before with the same name and label values
* [from Gatherer #2] collected metric "mysql_info_schema_auto_increment_column" { label:<name:"column" value:"id" > label:<name:"schema" value:"product_catalog" > label:<name:"table" value:"service_area_matrix_GVPN" > gauge:<value:255 > } was collected before with the same name and label values


Thanks,
Prashant 

Brian Candler

unread,
Nov 25, 2022, 2:50:34 AM11/25/22
to Prometheus Users
The error is very clear: you are generating multiple metrics with the same label name and exact set of labels.  Therefore, you will need to add extra labels to your metrics to make them unique.

The first error, for example, shows that you have generated this metric twice:

mysql_info_schema_auto_increment_column{column="id" schema="product_catalog" table="service_area_matrix_gvpn"} XXX
mysql_info_schema_auto_increment_column{column="id" schema="product_catalog" table="service_area_matrix_gvpn"} 1

Therefore there's something wrong in your configuration, either of mysqld_exporter itself or the prometheus scrape job.

If you're talking to multiple databases then normally the "instance" label would distinguish them.  Check how your scrape config compares to the example given at https://github.com/prometheus/mysqld_exporter#multi-target-support

    - job_name: mysql # To get metrics about the mysql exporter’s targets
      params:
        # Not required. Will match value to child in config file. Default value is `client`.
        auth_module: client.servers
      static_configs:
        - targets:
          # All mysql hostnames to monitor.
          - server1:3306
          - server2:3306
      relabel_configs:
        - source_labels: [__address__]
          target_label: __param_target
        - source_labels: [__param_target]
          target_label: instance

        - target_label: __address__
          # The mysqld_exporter host:port
          replacement: localhost:9104

If you haven't set the 'instance' label (see the highlighted lines) then you'll get this problem, because both metrics will have instance="localhost:9104"
Reply all
Reply to author
Forward
0 new messages