yum install -y nagios-plugins-mysql
检测是否可用:/usr/lib64/nagios/plugins/check_mysql -H 127.0.0.1 -u root -p 1234
vi /etc/nagios/objects/commands.cfg最后加上:
define command{
command_name check_mysql
command_line /usr/lib64/nagios/plugins/check_mysql -H 127.0.0.1 -u root -p 9165womoHCJPQ4Wu
}
vi /etc/nagios/objects/localhost.cfg最后加上:
# check_mysql service definition
define service{
use local-service
host_name localhost
service_description check_mysql
check_command check_mysql
}
搞定