vi /usr/local/nagios/etc/object/commands.cfg# 'check_mysql ' command definitiondefine command{command_name check_mysqlcommand_line $USER1$/check_mysql -H $HOSTADDRESS$ -u root -p $USER7$}2.2、配置resource.cfg 加入如下信息
vi /usr/local/nagios/etc/resource.cfg$USER7$=mysqlpass2.3、配置localhost.cfg 添加mysql监控项
vi /usr/local/nagios/etc/object/localhost.cfg# 检查远程Linux主机的Mysql服务define service{use generic-servicehost_name localhostservice_description MySQLcheck_command check_mysqlnotifications_enabled 0}2.4、测试
service nagios restart现在登录web查看mysql监控项 看到如下信息 ok,大功告成 Uptime: 949983 Threads: 3 Questions: 312804 Slow queries: 0 Opens: 154 Flush tables: 1 Open tables: 64 Queries per second avg: 0.329 3、总结 nagios是一款非常强大的监控工具,只要大家深入研究,多多尝试总会得到你想要的 日后如果安装插件,只需将插件下载到/usr/local/nagios/libexec目录下 然后采用上述步骤即可添加监控项,有些系统参数可能需要官方文档才知如何调用,大部分插件官方都给予足够的说明