当前位置: > Linux服务器 > 监控工具 >

Nagios监控mysql、Oracle、db2、postgreSQL的脚本

时间:2014-10-26 01:16来源:linux.it.net.cn 作者:it

Nagios监控mysql,需要下载chech_mysql_health插件进行监控。
下载地址:http://labs.consol.de/lang/de/nagios/check_mysql_health/

当然nagios监控Oracle、DB2等也可以在这个网站上找到。

对PostgreSQL数据库的监控也是按照PostgreSQL插件,使用方法如下:
http://bucardo.org/check_postgres/check_postgres.pl.html

command.cfg定义:
 

复制代码代码如下:

##----MYSQL----##
define command {
command_name check_mysql
command_line $USER1$/check_mysql -H $HOSTADDRESS$  -P $ARG1$ -u $ARG2$  -p $ARG3$
}

define command{
command_name check_mysql_health
command_line $USER1$/check_mysql_health -port $ARG1$ -hostname $ARG2$ -username $ARG3$ -password $ARG4$ -warning $ARG5$ -critical $ARG6$ -mode $ARG7$
}

主机定义:
 

复制代码代码如下:

define host{
         use            linux-server,host-pnp
        host_name       test
        alias           test
        address         192.168.2.30
        hostgroups      linux-servers
        }

##----thread-connected----##
define service{
        use                             linux-service,srv-pnp
        host_name                       test
        service_description             threads-connected
        check_command                   check_mysql_health!3306!192.168.2.30!root!qwer1234!1000!1500!threads-connected
        }

##----index-usage----##

#define service{
#        use                             linux-service,srv-pnp
#        host_name                       test
#        service_description             index-usage
#        check_command                   check_mysql_health!3306!192.168.2.30!root!qwer1234!1000!1500!index-usage
#        }

##----qcahe-hitrate----##

define service{
        use                             linux-service,srv-pnp
        host_name                       test
        service_description             qcahe-hitrate
        check_command                   check_mysql_health!3306!192.168.2.30!root!qwer1234!1000!1500!qcache-hitrate
        }

##----uptime----##

define service{
        use                             linux-service,srv-pnp
        host_name                       test
        service_description             connect-time
        check_command                   check_mysql_health!3306!192.168.2.30!root!qwer1234!1000!1500!connection-time
        }

##----threadcache-hitrate----##


(责任编辑:IT)
------分隔线----------------------------