Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to monitor the number of MySQL databases with Nagios. I've installed the official Nagios plugins.

I'm using 'check_mysql_query':

./check_nrpe -H 192.168.1.10 -c check_mysql_query

Nagios agent:

command[check_mysql_query]=/usr/lib64/nagios/plugins/check_mysql_query -d mysql -q "select count(*) from information_schema.SCHEMATA where schema_name not in ('mysql','information_schema');" -w 100 -c 150

I had to add client credentials to 'my.cnf' file.

Questions:

  1. Is there any better/secure solution for this?

  2. What's the minimum MySQL required privileges to run this command:

select count(*) from information_schema.SCHEMATA where schema_name not in ('mysql','information_schema');

share|improve this question
1  
Depending on the version and configuration you're running you may also want to exclude performance_schema from the count. –  John Gardeniers Jul 7 '12 at 0:50

1 Answer 1

up vote 1 down vote accepted
  1. You could remove the where clause and subtract 2 to count(*): COUNT(*)-2.
  2. You need SELECT privileges to do a SELECT.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.