4

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');

faker
  • 17,496
  • 2
  • 60
  • 70
HTF
  • 3,148
  • 14
  • 52
  • 82

1 Answers1

1
  1. You could remove the where clause and subtract 2 to count(*): COUNT(*)-2.
  2. You need SELECT privileges to do a SELECT.
lg.
  • 4,649
  • 3
  • 21
  • 20