This is a docker/docker-compose problem not a prometheus one, but I can see 
from the error that your container is trying to read
/home/.my.cnf
but you have mounted the file at
/root/.my.cnf

Apart from that, if you have any further problems with the 
prom/mysqld-exporter image, the best place to raise them would be with the 
maintainer of that image.

On Wednesday, 31 May 2023 at 11:38:59 UTC+1 Katharina Wolf wrote:

> I have an issue with multiple container from sql-exporter.
>
> My docker-compose.yml looks like this:
>
>   db1:
>     image: mariadb:10.6
>     restart: unless-stopped
>     expose:
>       - 3306
>     ports:
>       - 3306:3306
>     environment:
>       MYSQL_ROOT_PASSWORD: password1
>     command: --event_scheduler=ON --log-bin --userstat=ON
>     volumes:
>       - ./storage/db1:/var/lib/mysql
>
>   db2:
>     image: mariadb:10.6
>     restart: unless-stopped
>     command: --log-bin --userstat=ON    
>     ports:
>       - 3308:3306
>     expose:
>       - 3306
>     environment:
>       MYSQL_ROOT_PASSWORD: password2
>       MYSQL_DATABASE: db-schema2
>     volumes:
>       - ./storage/db2:/var/lib/mysql
>   
>   sql-exporter-db1:
>     image: prom/mysqld-exporter
>     expose: 
>       - 9104
>     ports:
>       - 9104:9104
>     links:
>       - db1
>     environment:
>       - DATA_SOURCE_NAME=root:password1@(db1:3306)/
>     command: 
>       --collect.global_status 
>       --collect.info_schema.innodb_metrics 
>       --collect.auto_increment.columns 
>       --collect.info_schema.processlist 
>       --collect.binlog_size 
>       --collect.info_schema.tablestats 
>       --collect.global_variables 
>       --collect.info_schema.query_response_time 
>       --collect.info_schema.userstats 
>       --collect.info_schema.tables 
>       --collect.perf_schema.tablelocks 
>       --collect.perf_schema.file_events 
>       --collect.perf_schema.eventswaits 
>       --collect.perf_schema.indexiowaits 
>       --collect.perf_schema.tableiowaits 
>       --collect.slave_status 
>       --collect.info_schema.tables.databases=db-schema1
>       --collect.engine_innodb_status 
>       --web.listen-address=0.0.0.0:9104   
>   
>   sql-exporter-db2:
>     image: prom/mysqld-exporter
>     ports:
>       - 9105:9104
>     links:
>       -db2
>     volumes:
>       - ./mysql-exporter/.my.cnf:/root/.my.cnf
>     environment:
>       - DATA_SOURCE_NAME:root:password2@(db2:3306)/
>     command: 
>       --collect.global_status 
>       --collect.info_schema.innodb_metrics 
>       --collect.auto_increment.columns 
>       --collect.info_schema.processlist 
>       --collect.binlog_size 
>       --collect.info_schema.tablestats 
>       --collect.global_variables 
>       --collect.info_schema.query_response_time 
>       --collect.info_schema.userstats 
>       --collect.info_schema.tables 
>       --collect.perf_schema.tablelocks 
>       --collect.perf_schema.file_events 
>       --collect.perf_schema.eventswaits 
>       --collect.perf_schema.indexiowaits 
>       --collect.perf_schema.tableiowaits 
>       --collect.slave_status 
>       --collect.info_schema.tables.databases=db-schema2 
>       --collect.engine_innodb_status 
>       --web.listen-address=0.0.0.0:9105   
>   
> when i am running docker compose up, the sql-exporter for db1 runs without 
> problems and delivers all metrices, i need.
> but sql-exporter for db2 just logs these error and quites:
>
> ts=2023-05-26T07:09:18.008Z caller=mysqld_exporter.go:277 level=info 
> msg="Starting mysqld_exporter" version="(version=0.14.0, branch=HEAD, 
> revision=ca1b9af82a471c849c529eb8aadb1aac73e7b68c)"
> ts=2023-05-26T07:09:18.008Z caller=mysqld_exporter.go:278 level=info 
> msg="Build context" 
> (gogo1.17.8,userroot@401d370ca42e,date20220304-16:25:15)=(MISSING)
> ts=2023-05-26T07:09:18.008Z caller=mysqld_exporter.go:284 level=info 
> msg="Error parsing my.cnf" file=/home/.my.cnf err="failed reading ini file: 
> open /home/.my.cnf: no such file or directory"
>
> i tried different configurations for sql-exporter for db2 like
> * mounting a .my.cnf-file
> * dont mounting a .my.cnf-file
> ' DATA_SOURCE_NAME to @(db2:3306)/
> ' DATA_SOURCE_NAME to @(db2:3308)/
>
> but every time i see only this 3 log lines and then the container exits.
>
> has somebody the same issue and can help me?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/944522ca-df56-4d1d-9889-5ad5b6fea9edn%40googlegroups.com.

Reply via email to