Page 1 of 1

check_mysql_query user error

Posted: Thu Feb 21, 2019 12:02 pm
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?

Re: check_mysql_query user error

Posted: Thu Feb 21, 2019 12:15 pm
by scottwilkerson
Sorry we cannot provide support for Icinga

This is a Nagios forum

Re: check_mysql_query user error

Posted: Thu Feb 21, 2019 12:30 pm
by redbob365
Is there a Nagios plugin to do similar work to it?

Re: check_mysql_query user error

Posted: Thu Feb 21, 2019 12:38 pm
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.

Re: check_mysql_query user error

Posted: Thu Feb 21, 2019 1:10 pm
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"

Re: check_mysql_query user error

Posted: Thu Feb 21, 2019 1:20 pm
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>

Re: check_mysql_query user error

Posted: Thu Feb 21, 2019 1:31 pm
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!

Re: check_mysql_query user error

Posted: Thu Feb 21, 2019 4:03 pm
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