zabbix企業級監控之監控MYSQL流量

來源:互聯網
上載者:User

標籤:如何   otto   bre   tor   too   分享圖片   neu   hit   sha   

1.mysql流量有哪些?

(1)接收的流量(Bytes_received)

(2)發出的流量(Bytes_sent)

2.如何擷取接收和發出的流量?

擷取接收的流量:

[[email protected] usr]# mysqladmin extended-status | awk '/\<Bytes_received\>/{print $4}'72671

擷取發出的流量:

[[email protected] usr]# mysqladmin extended-status | awk '/\<Bytes_sent\>/{print $4}'136264

3.如何統計兩秒內或更多時間內流量的統計?

Eg:計算兩秒內MYSQL的接收和發出的流量的統計?

cat /etc/zabbix/shell/monitor_mysql.sh
#!/bin/bash#統計2秒內MYSQL的接收和發出的流量統計Bytes_sent() {     Bytes_sent1=`mysqladmin extended-status | awk '/\<Bytes_sent\>/{print $4}'`     sleep 2     Bytes_sent2=`mysqladmin extended-status | awk '/\<Bytes_sent\>/{print $4}'`     echo $(($Bytes_sent2-$Bytes_sent1))}Bytes_recive() {     Bytes_recive1=`mysqladmin extended-status | awk '/\<Bytes_received\>/{print $4}'`     sleep 2     Bytes_recive2=`mysqladmin extended-status | awk '/\<Bytes_received\>/{print $4}'`     echo $(($Bytes_recive2-$Bytes_recive1))}$1

4.在agent定義模板

vim userparameter_my.conf
UserParameter=monitor_mysql[*],/bin/bash /etc/zabbix/shell/monitor_mysql.sh "$1"

monitor_mysql[*]:是自訂key,*是傳參

server端自訂索引值,monitor_mysql[Bytes_sent],調用Bytes_sent函數

server端自訂索引值,monitor_mysql[Bytes_recive],調用Bytes_recive函數

5.準備更新一個關於zabbix監控的專題,歡迎加入我們的Linux技術交流群:642921645,zabbix監控交流群:832462735 ,我們不定期去更新很多關於系統營運的資料在群裡,期待你的加入!

6.文章也會推送到公眾號



zabbix企業級監控之監控MYSQL流量

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.