百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 主页>网站教程>服务器> centos6.5中nagios监控mysql运行状态方法
分享文章到:

centos6.5中nagios监控mysql运行状态方法

发布时间:01/15 来源: 浏览: 关键词:
nagios本来就是可以用来监控了,在此小编为各位整理篇在centos6.5中nagios监控mysql运行状态方法,希望这篇文章能帮助到大家。

先说一下本机环境,centos 6.5 64位,nagios是用yum装的,版本是Nagios Core 3.5.1,自带的就有check_mysql

1,修改commands.cfg

# vim /etc/nagios/objects/commands.cfg #添加以下内容 
 
define command{ 
 command_name check_mysql 
 command_line $USER1$/check_mysql -H $ARG1$ -u $ARG2$ -p $ARG3$ 

在这里要注意,这三个参数服务器,用户名和密码

2,修改监控机器文件localhost.cfg

# vim /etc/nagios/objects/localhost.cfg #添加以下内容 
 
define service{ 
 use local-service 
 host_name localhost 
 service_description MySQL 
 check_command check_mysql!localhost!root!root 

!localhost!root!root分别对应$ARG1$,$ARG2$,$ARG3$,这三个参数

3,修改客户端nrpe.cfg

# vim /etc/nagios/nrpe.cfg #添加以下内容 
 
command[check_mysql]=/usr/lib64/nagios/plugins/check_mysql -H localhost -u root -p root 
在这里要注意,等于号后面的命令是可执行的,并且不能有错。


[root@node1 objects]# /usr/lib64/nagios/plugins/check_mysql -H localhost -u root -p root 
Uptime: 78680 Threads: 1 Questions: 3488 Slow queries: 0 Opens: 126 Flush tables: 1 Open tables: 133 Queries per second avg: 0.044 

4,重启nagios和nrpe

# /etc/init.d/nrpe start 
# /etc/init.d/nagios start 

如果重启nagios报以下错误:

Running configuration check... CONFIG ERROR! Restart aborted. Check your Nagios configuration.

解决办法:

[root@node1 objects]# /usr/sbin/nagios -v /etc/nagios/nagios.cfg 
检测配置文件错在什么地方,你就可以很轻松的修改错误的地方。如果没有报错,就说明配置OK了。

打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有5人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助

能出一分力是一分吧!

订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板