Tag:mysql monitor status result
[[email protected] scripts]# cat checkmysqlperformance.sh #!/bin/sh #Create by sfzhang 2014.02.20 mysql_sock= "/data/mysql/3306/mysql.sock" MYSQL_PWD= ' cat / Data/mysql/3306/.mysqlpassword ' ARGS=1 if [ $# -ne "$ARGS" ];then echo "Please input one arguement:" fi case $1 In uptime) result= ' mysqladmin -uroot -p${mysql_pwd} -s $MYSQL _sock status|cut -f2 -d ":" |cut -f1 -d "T" ' echo $ result ;; com_update) result= ' Mysqladmin -uroot -p${mysql_pwd} -s $MYSQL _sock extended-status |grep -w "Com_update "|cut -d" | " -f3 ' echo $result ;; slow_queries) result= ' mysqladmin -uroot -p${mysql_pwd} -s $MYSQL _sock status |cut -f5 -d ":" |cut -f1 -d "O" echo $result ;; com_select) result= ' mysqladmin -uroot -p${mysql_pwd} -s $MYSQL _sock extended-status |grep -w "Com_select" |cut -d "|" -f3 ' echo $result ;; com_rollback) result= ' mysqladmin -uroot -p${mysql_pwd} -s $MYSQL _sock extended-status |grep -w "Com_rollback" |cut -d "|" -f3 ' echo $result ;; questions) result= ' mysqladmin -uroot -p${mysql_pwd} -s $MYSQL _sock status|cut -f4 -d ":" |cut -f1 -d "S" ' echo $result ;; com_insert) result= ' mysqladmin -uroot -p${mysql_pwd} -s $MYSQL _sock extended-status |grep -w "Com_insert" |cut -d "|" -f3 ' echo $result ;; com_delete) result= ' mysqladmin -uroot -p${mysql_pwd} -s $MYSQL _sock extended-status |grep -w "Com_delete" |cut -d "|" -f3 ' echo $result ;; com_commit) result= ' mysqladmin -uroot -p${mysql_pwd} -s $MYSQL _sock extended-status |grep -w "Com_commit" |cut -d "|" -f3 ' echo $result ;; bytes_sent) result= ' mysqladmin -uroot -p${mysql_pwd} -s $MYSQL _sock extended-status |grep -w "bytes_sent" |cut -d "|" -f3 ' echo , $result ;; bytes_received) result= ' mysqladmin -uroot -p${mysql_pwd} -s $MYSQL _sock extended-status |grep -w "bytes_received" |cut -d "|" -f3 ' echo $result ;; com_begin) result= ' mysqladmin -uroot -p${mysql_pwd} -s $MYSQL _sock extended-status |grep -w "Com_begin" |cut -d "|" -f3 ' echo $result ;; *) echo "Usage:$0 (uptime| com_update| slow_queries| Com_select| com_rollback| Questions) " ;; esac
Then edit zabbix_agentd.conf
Userparameter=mysql.version,mysql-v userparameter=mysql.ping,mysqladmin-uroot-p123456-s/data/mysql/3306/ Mysql.sock Ping | Grep-c Alive Userparameter=mysql.status[*],/etc/zabbix/scripts/checkmysqlperformance.sh
The system comes with the MySQL monitor all the Enable
Zabbix monitoring MySQL Scripts