使用Nagios监控mysql数据库的数量

我想用Nagios监视MySQL数据库的数量。 我已经安装了官方的Nagios插件。

我正在使用'check_mysql_query':

./check_nrpe -H 192.168.1.10 -c check_mysql_query 

Nagios代理:

 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 

我不得不将客户端凭据添加到“my.cnf”文件。

问题:

  1. 有没有更好的/安全的解决scheme呢?

  2. 运行此命令所需的最低MySQL权限是多less?

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

  1. 您可以删除where子句并减去2来计数(*): COUNT(*)-2
  2. 您需要SELECT权限才能执行SELECT。