check_mysql_query user error

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
redbob365
Posts: 4
Joined: Mon Jul 16, 2018 5:17 pm

check_mysql_query user error

Post by redbob365 »

Hi,

i'm trying to use this plugin check_mysql_query, but I'm not lucky.

I type it in my Monitoring Server (whose IP is 172.24.3.98):

Code: Select all

 ./check_mysql_query -H 172.24.36.71 -P 3306 -d fog -u fog -p fog -q select * from images
But I receive this kind of error:

Code: Select all

Access denied for user 'fog'@'172.24.3.98' (using password: YES)
After that, I changed the command syntax to this:

Code: Select all

 ./check_mysql_query -H 172.24.36.71 -P 3306 -d fog -u 'fog'@'$172.24.36.71' -p fog -q select * from images
it gives me this error:

Code: Select all

Access denied for user 'fog'@'172.24.36.71'@'172.24.3.98' (using password: YES)
172.24.36.71 is host to be monitored.

How can I revert this error?
Last edited by redbob365 on Thu Feb 21, 2019 12:19 pm, edited 1 time in total.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_mysql_query user error

Post by scottwilkerson »

Sorry we cannot provide support for Icinga

This is a Nagios forum
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
redbob365
Posts: 4
Joined: Mon Jul 16, 2018 5:17 pm

Re: check_mysql_query user error

Post by redbob365 »

Is there a Nagios plugin to do similar work to it?
redbob365
Posts: 4
Joined: Mon Jul 16, 2018 5:17 pm

Re: check_mysql_query user error

Post by redbob365 »

I am not referencing Icinga anymore. I can test nagios plugins just typing commands at line command, like this:

Code: Select all

/usr/lib/nagios/plugins$ ./check_ping -H 172.24.3.1 -w 200,50% -c 1000,100% -p 5 -t 6
PING OK - Packet loss = 0%, RTA = 30.76 ms|rta=30.764000ms;200.000000;1000.000000;0.000000 pl=0%;50;100;0
I made a fresh download of Nagios Plugins 2.2.1 from this address: https://nagios-plugins.org/download/nag ... 1550770301

I found check_mysql_query within this package.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_mysql_query user error

Post by scottwilkerson »

You need to create a database user that allows access from 172.24.3.98

Then you can run it like this

Code: Select all

./check_mysql_query -H 172.24.36.71 -P 3306 -d fog -u fog -p fog -q "select * from images"
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: check_mysql_query user error

Post by lmiltchev »

You would need to run something like this:

Code: Select all

GRANT ALL ON *.* TO <user>@'<ip address>' IDENTIFIED BY '<password>';
To view the existing grants, you could run:

Code: Select all

echo "show grants;" | mysql -t -uroot -p<password>
Be sure to check out our Knowledgebase for helpful articles and solutions!
redbob365
Posts: 4
Joined: Mon Jul 16, 2018 5:17 pm

Re: check_mysql_query user error

Post by redbob365 »

Well, I did these:
1) I went to host and type this command at MYSQL:

Code: Select all

mysql> GRANT SELECT ON *.* TO 'fog'@'%' IDENTIFIED BY 'fog';
Query OK, 0 rows affected, 1 warning (0.00 sec)
2) I came back to monitoring computer and type this command

Code: Select all

./check_mysql_query -H 172.24.3.144 -P 3306 -d fog -u fog -p fog -q "select * from images"
It gaves me this successfully message:

Code: Select all

QUERY OK: 'select * from images' returned 38.000000 | result=38.000000;;;
Thank you for this tip!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_mysql_query user error

Post by scottwilkerson »

redbob365 wrote:Well, I did these:
1) I went to host and type this command at MYSQL:

Code: Select all

mysql> GRANT SELECT ON *.* TO 'fog'@'%' IDENTIFIED BY 'fog';
Query OK, 0 rows affected, 1 warning (0.00 sec)
2) I came back to monitoring computer and type this command

Code: Select all

./check_mysql_query -H 172.24.3.144 -P 3306 -d fog -u fog -p fog -q "select * from images"
It gaves me this successfully message:

Code: Select all

QUERY OK: 'select * from images' returned 38.000000 | result=38.000000;;;
Thank you for this tip!
Glad it is resolved!

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked