# 连接数
UserParameter=mysql.max_connections,echo "show variables where Variable_name='max_connections';" | mysql -N | awk '{print $2}'
UserParameter=mysql.current_connections,echo "show global status where Variable_name='Threads_connected';" | mysql -N | awk '{print $2}'
# 缓冲池
UserParameter=mysql.buffer_pool_size,echo "show variables where Variable_name='innodb_buffer_pool_size';" | mysql -N |awk '{printf "%.2f",$2/1024/1024/1024}'
UserParameter=mysql.buffer_pool_usage_percent,echo "show global status where Variable_name='Innodb_buffer_pool_pages_free' or Variable_name='Innodb_buffer_pool_pages_total';" | mysql -N | awk '{a[NR]=$2}END{printf "%.1f",100-((a[1]/a[2])*100)}'
# 增删改查
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | mysql -N | awk '{print $$2}'
# 实例状态
UserParameter=mysql.ping,HOME=/usr/local/zabbix_agent mysqladmin ping | grep -c alive
UserParameter=mysql.version,mysql -V