nagios 实现Mysql 主从同步状态的监控
2014-10-16 13:27
721 查看
一、系统环境
二、操作步骤
2.1 mysql_s端的配置
2.1.1 编写check_mysql_slave监控脚本
cd /usr/local/nagios/libexec #切换到nagios监控插件所在目录
vim check_mysql_slave #开始编写mysql_slave监控脚本
注意:监控脚本中的mysql账户一定要新建一个,并设置有限的权限。
2.1.2 给脚本增加可执行权限
chmod 755 check_mysql_slave
-rwxr-xr-x 1 root root 471 Oct 16 12:59 check_mysql_slave
2.1.3编辑nrpe的配置文件
vim /usr/local/nagios/libexec/etc/nrpe.cfg +204
#添加监控mysql 主从同步状态的命令
command[check_mysql_slave]=/usr/local/nagios/libexec/check_mysql_slave
2.1.4重新启动 nrpe 服务
2.1.5执行脚本测试输出
[root@mysql_s libexec]# ./check_mysql_slave
OK mysql_s is running
2.2 nagios端的配置:
2.2.1 修改已有的 /usr/local/nagios/etc/objects/service.cfg 配置文件
define service {
use generic-service
host_name mysql_slave
service_description check_21_mysql_replication_status
check_command check_nrpe!check_mysql_slave
max_check_attempts 3
normal_check_interval 2
retry_check_interval 2
check_period 24x7
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
contact_groups admins
process_perf_data 1
}
2.2.2重启 nagios
[root@nagios objects]#/etc/init.d/nagios checkconfig #检查配置文件是否有误
[root@nagios objects]#/etc/init.d/nagios reload #重新加载配置文件
Running configuration check...done.
Stopping nagios: done.
Starting nagios: done.
说明:如果nagios reload完毕,监控页面尚未出现检测结果,可以手动测试
/usr/local/nagios/libexec/check_nrpe -H192.168.15.21 -c check_mysql_slave
2.2.3 最终效果图
主机名 | IP |
nagios | 192.168.15.111 |
mysql_s | 192.168.15.21 |
2.1 mysql_s端的配置
2.1.1 编写check_mysql_slave监控脚本
cd /usr/local/nagios/libexec #切换到nagios监控插件所在目录
vim check_mysql_slave #开始编写mysql_slave监控脚本
注意:监控脚本中的mysql账户一定要新建一个,并设置有限的权限。
2.1.2 给脚本增加可执行权限
chmod 755 check_mysql_slave
-rwxr-xr-x 1 root root 471 Oct 16 12:59 check_mysql_slave
2.1.3编辑nrpe的配置文件
vim /usr/local/nagios/libexec/etc/nrpe.cfg +204
#添加监控mysql 主从同步状态的命令
command[check_mysql_slave]=/usr/local/nagios/libexec/check_mysql_slave
2.1.4重新启动 nrpe 服务
2.1.5执行脚本测试输出
[root@mysql_s libexec]# ./check_mysql_slave
OK mysql_s is running
2.2 nagios端的配置:
2.2.1 修改已有的 /usr/local/nagios/etc/objects/service.cfg 配置文件
define service {
use generic-service
host_name mysql_slave
service_description check_21_mysql_replication_status
check_command check_nrpe!check_mysql_slave
max_check_attempts 3
normal_check_interval 2
retry_check_interval 2
check_period 24x7
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
contact_groups admins
process_perf_data 1
}
2.2.2重启 nagios
[root@nagios objects]#/etc/init.d/nagios checkconfig #检查配置文件是否有误
[root@nagios objects]#/etc/init.d/nagios reload #重新加载配置文件
Running configuration check...done.
Stopping nagios: done.
Starting nagios: done.
说明:如果nagios reload完毕,监控页面尚未出现检测结果,可以手动测试
/usr/local/nagios/libexec/check_nrpe -H192.168.15.21 -c check_mysql_slave
2.2.3 最终效果图
相关文章推荐
- nagios 实现Mysql 主从同步状态的监控
- nagios 监控 mysql 主从同步状态
- nagios 监控 mysql 主从同步状态
- 利用 nagios 自带的插件来监控 mysql 的主从同步状态 (监控多实例)
- 如何实现实时监控数据库主从同步的状态
- nagios监控mysql主从状态
- 监控mysql主从同步状态
- 编写脚本实现MySQL主从复制状态监控
- nagios 监控tcp连接数 物理内存 cpu使用率 web并发数 mysql主从状态
- 监控mysql主从同步状态是否异常
- Shell脚本实现监控MySQL主从同步
- 监控MySQL主从同步状态
- 监控mysql主从同步状态是否异常,如果异常,则发生短信或邮寄给管理员
- Nagios 监控Mysql同步状态
- shell脚本监控mysql主从同步状态并自动修复
- 监控mysql主从同步状态脚本
- mysql 主从备份监控slave状态nagios脚本
- nagios监控mysql主从状态的简单脚本
- Zabbix 监控Mysql 主从状态(Python脚本)
- MySQL主从复制、半同步和主主复制的实现