监控connections和processlist的脚本下载地址:

processlist的下载地址

connections的下载地址 

1、把脚本上传到/usr/local/nagios/libexec目录下

/usr/local/nagios/libexec/checkMySQLProcesslist.sh
/usr/local/nagios/libexec/check_mysql_connections

2、在/usr/local/nagios/etc/nrpe.cfg中添加监控mysql的connections和processlist命令

command[check_mysql_processlist]=/usr/local/nagios/libexec/checkMySQLProcesslist.sh -u root -p 123456 -H 10.10.1.245 -P 13267 -s 60 -w 20 -c 50
command[check_mysql_connections]=/usr/local/nagios/libexec/check_mysql_connections -w 10 -c 20 -u root -p 123456 -H 10.10.1.245 -P 13267

3、编辑/usr/local/nagios/etc/objects/cfg/navyserver.cfg ,添加监控mysqlmysql的connections和processlist的项目:

define service{
        use             generic-service
        host_name       navy
        service_description     check_mysql_processlist
        check_command           check_nrpe!check_mysql_processlist
        }

define service{
        use             generic-service
        host_name       navy
        service_description     check_mysql_connections
        check_command           check_nrpe!check_mysql_connections
        }

4、重启nagios就OK了

/etc/init.d/nagios restart