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

check_mysql do not use opt file #383

Closed
benkeil opened this issue Jun 4, 2018 · 3 comments
Closed

check_mysql do not use opt file #383

benkeil opened this issue Jun 4, 2018 · 3 comments

Comments

@benkeil
Copy link

benkeil commented Jun 4, 2018

As mentioned here https://community.librenms.org/t/nagios-check-mysql-and-storing-password/773/6, I try to put my password in db-production-master.cnf file.

[client]
user=xxx
password=yyy

but the check does not use it

./check_mysql -H db-production-master -f db-production-master.cnf

Access denied for user 'root'@'10.2.90.85' (using password: NO)

Further the flag is not being checked:

./check_mysql --file does-not.exist

Access denied for user 'root'@'localhost' (using password: NO)
@scottwilkerson
Copy link

scottwilkerson commented Aug 16, 2018

you need to use the full path to the file and the nagios user needs access to it
./check_mysql -H db-production-master -f /path/to/file/db-production-master.cnf

If it cannot find the file it attemps to make a connection with the current user and no password

@sdturne
Copy link

sdturne commented Feb 23, 2023

My problem with check_mysql is that it's parsing the /etc/my.cnf file using its own parse logic that does not respect or understand !includedir statements. The /etc/my.cnf file supplied by MariaDB contains the following statement:

!includedir /etc/my.cnf.d

check_mysql does not interpret this statement or read the files nested therein. A nested config file is where I have a password=blah statement, which is never seen. If I replace the original /etc/my.cnf file with the contents of my nested file then check_mysql works. I shouldn't have to use a -f option to get check_mysql to only read my specific nested configuration file; ALL files in the hierarchy are significant.

@sawolf
Copy link
Member

sawolf commented Mar 20, 2023

Hi @sdturne - thanks for the comment. It looks like the opening post had a different problem, so I've opened a new issue for you at #692. I'm also closing this because it looks like the original problem was solved.

@sawolf sawolf closed this as completed Mar 20, 2023
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

4 participants