mysql_exporter Won't Start

1,177 views
Skip to first unread message

al carriere

unread,
Mar 30, 2021, 10:14:49 PM3/30/21
to Prometheus Users
System is c$ uname -a
Linux  4.4.0-141-generic #167-Ubuntu SMP Wed Dec 5 10:40:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Using mysqld_exporter-0.12.1.linux-amd64.tar.gz

I just installed Prometheus successfully pulling stats from 5 servers using node_explorer and visualizing with Grafana.

I have installed mysql_explorer on two servers each with an instance of MySql 5.7 and both fail in the same way, they won't start, from journalctl -xe:

Mar 30 20:55:24 sea-server-02 systemd[1]: Started Prometheus MySQL Exporter.
-- Subject: Unit mysql_exporter.service has finished start-up
-- Defined-By: systemd
--
-- Unit mysql_exporter.service has finished starting up.
--
-- The start-up result is done.
Mar 30 20:55:24 sea-server-02 mysqld_exporter[28996]: time="2021-03-30T20:55:24-05:00" level=info msg="Starting mysqld_exporter (version=0.12.1, branch=HEAD, revision=48667bf7c3b438b5e93b259f3d17b70a7c9a
Mar 30 20:55:24 sea-server-02 mysqld_exporter[28996]: time="2021-03-30T20:55:24-05:00" level=info msg="Build context (go=go1.12.7, user=root@0b3e56a7bc0a, date=20190729-12:35:58)" source="mysqld_exporter
Mar 30 20:55:24 sea-server-02 mysqld_exporter[28996]: time="2021-03-30T20:55:24-05:00" level=fatal msg="failed reading ini file: open <strong>/etc/.mysqld_exporter.cnf</strong>: no such file or directory
Mar 30 20:55:24 sea-server-02 systemd[1]: mysql_exporter.service: Main process exited, code=exited, status=1/FAILURE
Mar 30 20:55:24 sea-server-02 systemd[1]: mysql_exporter.service: Unit entered failed state.
Mar 30 20:55:24 sea-server-02 systemd[1]: mysql_exporter.service: Failed with result 'exit-code'.
Mar 30 20:55:25 sea-server-02 systemd[1]: mysql_exporter.service: Service hold-off time over, scheduling restart.
Mar 30 20:55:25 sea-server-02 systemd[1]: Stopped Prometheus MySQL Exporter.
-- Subject: Unit mysql_exporter.service has finished shutting down
-- Defined-By: systemd

The file /etc/.mysqld_exporter.cnf does in fact exist:

/etc$ ls -lart | grep mysqld
-rwxrwxrwx   1 root prometheus    54 Mar 30 15:57 .mysqld_exporter.cnf

And has this content:

/etc$ cat .mysqld_exporter.cnf
[client]
user=mysqld_exporter
password=XXXXXXXX

I have verified from command line that this userid/password work.

Any help, debug tips would be appreciated..

Thanks,
Al


Steven Kreuzer

unread,
Mar 31, 2021, 10:05:26 AM3/31/21
to al carriere, Prometheus Users
On Tue, Mar 30, 2021 at 10:14 PM al carriere <alan.g....@gmail.com> wrote:

The file /etc/.mysqld_exporter.cnf does in fact exist:

/etc$ ls -lart | grep mysqld
-rwxrwxrwx   1 root prometheus    54 Mar 30 15:57 .mysqld_exporter.cnf

Is the systemd service unit you are using doing anything to change the mysqld_exporter's view of the filesystem? (Something like RootDirectory= or ConfigurationDirectory=)

Do the permissions on /etc/ itself grant permission to the uid the process is running as?

Another option you may want to consider is to pass the username and password as env variables. This can be done by editing the [Service] section of the service unit to have:

Environment='DATA_SOURCE_NAME=mysqld_exporter:XXXXXXXX@(localhost:3306)/'

The advantage being that you would no longer need the .mysqld_exporter.cnf file with permissive permissions

al carriere

unread,
Mar 31, 2021, 10:43:25 AM3/31/21
to Prometheus Users
Nice.  I went the environment variable route and it popped right up. Thanks!
Reply all
Reply to author
Forward
0 new messages