标签:监控mysql ini ext uptime ati live user tmp touch
Zabbix监控mysql
yum -y install unixODBC rpm -ivh zabbix-agent-3.0.3-1.el6.x86_64.rpm
注释所有添加以下内容 vim /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf UserParameter=mysql.version,mysql -V UserParameter=mysql.status[*],/etc/zabbix/scripts/chk_mysql.sh $1 UserParameter=mysql.ping,mysqladmin -uzabbix -p123456 -P3306 -h192.168.1.77 ping | grep -c alive
mkdir /etc/zabbix/scripts/ touch /etc/zabbix/scripts/chk_mysql.sh chmod u+x /etc/zabbix/scripts/chk_mysql.sh chown -R zabbix.zabbix /etc/zabbix/scripts/chk_mysql.sh vim /etc/zabbix/scripts/chk_mysql.sh #!/bin/sh # ------------------------------------------------------------------------------- MYSQL_SOCK="/tmp/mysql.sock" MYSQL_USER=‘zabbix‘ MYSQL_PWD=‘123456‘ MYSQL_HOST=‘127.0.0.1‘ MYSQL_PORT=‘3306‘ ARGS=1 if [ $# -ne "$ARGS" ];then echo "Please input one arguement:" fi case $1 in Uptime) result=`/application/mysql/bin/mysqladmin -u$MYSQL_USER -h$MYSQL_HOST -p${MYSQL_PWD} -S $MYSQL_SOCK status|cut -f 2 -d":"|cut -f1 -d"T"` echo $result ;; Com_update) result=`/application/mysql/bin/mysqladmin -u$MYSQL_USER -h$MYSQL_HOST -p${MYSQL_PWD} -S $MYSQL_SOCK extended- status |grep -w "Com_update"|cut -d"|" -f3` echo $result ;; Slow_queries) result=`/application/mysql/bin/mysqladmin -u$MYSQL_USER -h$MYSQL_HOST -p${MYSQL_PWD} -S $MYSQL_SOCK status |cut - f5 -d":"|cut -f1 -d"O"`
sed -i ‘s#ServerActive=127.0.0.1#ServerActive=192.168.1.72#g‘ /etc/zabbix/zabbix_agentd.conf sed -i ‘s#Server=127.0.0.1#Server=192.168.1.72#g‘ /etc/zabbix/zabbix_agentd.conf /etc/init.d/zabbix-agent restart
标签:监控mysql ini ext uptime ati live user tmp touch
原文地址:http://www.cnblogs.com/Carr/p/7395674.html