登陆从服务器mysql,添加验证的用户 1grant replication client on . to 'nagios'@localhost identified by 'jiankong'; 2flush privileges; 查看是否添加成功 1select user,host from mysql.user 在从服务器安装 nrpe,然后在配置文件nrpe.cfg加入一行 1command[check_mysql_slave]=/usr/local/nagios/libexec/check_mysql_slave 添加这个文件内容 1#!/bin/sh 2 3declare -a slave_is 4slave_is=((/usr/local/mysql/bin/mysql -unagios -pjiankong -e "show slave statusG"|grep Running |awk '{print 2}')) 5if [ "{slave_is[0]}" = "Yes" -a "{slave_is[1]}" = "Yes" ];then 6 echo "OK -slave is running" 7 exit 0 8else 9 echo "Critical -slave is error" 10 exit 2 11fi 再执行这个脚本,观察输……
Continue reading