What does "telnet 127.0.0.1 3306" show? You haven't shown the mariadb "LISTEN" socket. If it's listening on 10.0.0.4:3306 rather than 0.0.0.0:3306 or *:3306, then it will only accept connections on 10.0.0.4:3306, and not 127.0.0.1:3306.
You can see from your original error message that the exporter connects to localhost:3306 by default, as documented under the general flags <https://github.com/prometheus/mysqld_exporter/#general-flags>: mysqld.address Hostname and port used for connecting to MySQL server, format: host:port. (default: locahost:3306) Therefore, if this is the only target you want to scrape, you could pass --mysqld.address=10.0.0.4:3306 to override this. You could also do this through the scraping URL /probe with a "target" parameter: curl -s <IP>:9104/probe?target=10.0.0.4:3306 This is documented here: https://github.com/prometheus/mysqld_exporter/#multi-target-support However, that feature was only introduced in version v0.15.0 <https://github.com/prometheus/mysqld_exporter/releases/tag/v0.15.0>. On Tuesday, 22 August 2023 at 06:16:35 UTC+1 Y.G Kumar wrote: > The mariadb service is infact running on the node on 3306: > -- > # telnet 10.0.0.4 3306 > Trying 10.0.0.4 ... > Connected to 10.0.0.4 . > Escape character is '^]'. > u > 5.5.5-10.6.10-MariaDB-1:10.6.10+maria~ubu2004-logVcYvf{X'V�_X}.iHlf<69\mysql_native_password^CConnection > > closed by foreign host. > --- > > tcp 0 0 10.0.0.4:3306 10.0.0.4:55890 ESTABLISHED > 2863920/mariadbd > > But still the exporter is not able to detect the service. Not sure where > it is going wrong ? > > > On Tuesday, August 22, 2023 at 10:10:02 AM UTC+5:30 Y.G Kumar wrote: > >> What is the exact configuration option to mention the port number of the >> service ? >> >> On Friday, August 18, 2023 at 5:55:58 PM UTC+5:30 Brian Candler wrote: >> >>> > dial tcp 127.0.0.1:3306: connect: connection refused >>> >>> Your mariadb is not listening on TCP port 3306 on the loopback address >>> (127.0.0.1). >>> >>> If you show what command you use to connect to mariadb normally (e.g. >>> using the "mysql" command line client) it should be possible to configure >>> the mysql export to talk the same way. You would set this in whatever file >>> you give to --config.my-cnf (defaults to ~/.my.cnf) >>> See https://github.com/prometheus/mysqld_exporter/ >>> >>> On Friday, 18 August 2023 at 13:06:06 UTC+1 Y.G Kumar wrote: >>> >>>> Hi All, >>>> >>>> We have a galera mariadb 10.6 version three node cluster. When I tried >>>> installing mysql exporter by following the link >>>> https://computingforgeeks.com/monitoring-mysql-mariadb-with-prometheus-in-five-minutes/?expand_article=1 >>>> >>>> , I could not get the exporter to detect the mysql service in which it >>>> is >>>> running .. These are the logs: >>>> -- >>>> /tmp# curl -s <IP>:9104/metrics | grep mysql_up >>>> ts=2023-08-18T11:22:21.544Z caller=exporter.go:152 level=error >>>> msg="Error pinging mysqld" err="dial tcp 127.0.0.1:3306: connect: >>>> connection refused" >>>> # HELP mysql_up Whether the MySQL server is up. >>>> # TYPE mysql_up gauge >>>> mysql_up 0 >>>> --- >>>> >>>> But the mariadb service is running on this node: >>>> --- >>>> ● mariadb.service - MariaDB 10.6.10 database server >>>> Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; >>>> vendor preset: enabled) >>>> Drop-In: /etc/systemd/system/mariadb.service.d >>>> └─migrated-from-my.cnf-settings.conf, override.conf >>>> Active: active (running) since Wed 2023-05-10 23:10:13 UTC; 3 >>>> months 8 days ago >>>> Docs: man:mariadbd(8) >>>> https://mariadb.com/kb/en/library/systemd/ >>>> Main PID: 2540463 (mariadbd) >>>> Status: "Taking your SQL requests now..." >>>> Tasks: 1587 (limit: 618903) >>>> CPU: 2w 5d 9h 34min 28.076s >>>> CGroup: /galera.slice/mariadb.service >>>> └─2540463 /usr/sbin/mariadbd >>>> --wsrep_start_position=d635b506-3dd8-11e8-989e-7aec6efd1673:2862939478 >>>> --- >>>> >>>> Can anyone help me where the fault is ? I have given enough privileges >>>> for the 'mysqld_exporter' user as well. >>>> >>>> Thanks >>>> Kumar >>>> >>>> -- 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/4dfac64d-6a25-4d9b-b032-61d1e3008c31n%40googlegroups.com.

