zabbix服务--mysql(二)监控流量

1,过滤出监控内容,并写进脚本

[root@localhost scripts] mysqladmin extended-status |grep "Bytes_sent"|awk '{print $4}'
3969067
[root@localhost scripts] mysqladmin extended-status |grep "Bytes_received"|awk '{print $4}'
8960924

[root@localhost scripts] vim check_mysql.sh 
[root@localhost scripts] cat check_mysql.sh 
#!/bin/bash
case $1 in 
	slave_status)
	mysql -ucheck -p123 -e "show slave status \G"|grep "Running"|grep "Yes"|awk '{print $2}'|wc -l
	;;
	Bytes_sent) #发送流量
	mysqladmin extended-status |grep "Bytes_sent"|awk '{print $4}'
	;;
	Bytes_received)	#接受流量
	mysqladmin extended-status |grep "Bytes_received"|awk '{print $4}'
	;;
esac

2,在服务端设置监控
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

发布了56 篇原创文章 · 获赞 65 · 访问量 1990

猜你喜欢

转载自blog.csdn.net/xiaohuai0444167/article/details/105415105