• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

nagios监控mysql

mysql 搞代码 4年前 (2022-01-09) 16次浏览 已收录 0个评论

先说一下本机环境,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

先说一下本机环境,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/p<div style="color:transparent">本文来源gaodai.ma#com搞##代!^码网(</div>lugins/check_mysql -H localhost -u root -p root

在这里要注意,等于号后面的命令是可执行的,并且不能有错

[root@node1 objects]# /usr/lib64/nagios/plugins/check_mysql -H localhost -u root -p rootUptime: 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了。


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:nagios监控mysql

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址