日本不卡不码高清免费观看,久久国产精品久久w女人spa,黄色aa久久,三上悠亚国产精品一区二区三区

您的位置:首頁技術文章
文章詳情頁

zabbix 監(jiān)控mysql的方法

瀏覽:375日期:2023-04-06 15:09:37

zabbix部署文檔

zabbix部署完之后

zabbix-agent操作

1.監(jiān)控mysql,首先要先安裝mysql

[root@localhost ~]# yum -y install mariadb mariadb-server

2.編寫mysql監(jiān)控項的腳本

在zabbix-agent先授權個用戶 不然測試時沒有權限

[root@localhost ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 33Server version: 5.5.65-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type "help;" or "\h" for help. Type "\c" to clear the current input statement.MariaDB [(none)]> grant all on *.* to "check"@"localhost" identified by "123";Query OK, 0 rows affected (0.00 sec)

mysql監(jiān)控的內(nèi)容主要有

  • 主從的狀態(tài) (得先配置主從 在下面)
  • 流量檢測 發(fā)送,接受常規(guī)操作 增刪改查
  • 某個庫、某個表的大小
  • tps(每秒查詢處理的事務數(shù))qps(每秒能處理多少次請求數(shù))
[root@localhost ~]# mkdir /etc/zabbix/scipts[root@localhost ~]# cd /etc/zabbix/scipts/[root@localhost scipts]# vim mysql.sh #!/bin/bashmysql="mysql -ucheck -p123"case $1 in  # mysql主從狀態(tài) slave_status)  $mysql -e "show slave status\G" |grep "Yes" |wc -l ;;  # mysql流量 接受 Bytes_received)  mysqladmin extended-status |grep "Bytes_received" |awk "{print $4}" ;; # mysql流量 發(fā)送 Bytes_sent)  mysqladmin extended-status |grep "Bytes_sent" |awk "{print $4}" ;; # mysql常規(guī)操作 增 Com_insert)  mysqladmin extended-status |grep -w "Com_insert" |awk "{print $4}" ;; # mysql常規(guī)操作 刪 Com_delete)  mysqladmin extended-status |grep -w "Com_delete" |awk "{print $4}" ;; # mysql常規(guī)操作 改 Com_update)  mysqladmin extended-status |grep -w "Com_update" |awk "{print $4}"		;; # mysql常規(guī)操作 查 Com_select)  mysqladmin extended-status |grep -w "Com_select" |awk "{print $4}" ;; # mysql tps tps)  mysqladmin status |awk "{print $6/$2}" ;; # mysql qps=(rollback+commit)/uptime qps)  rollback=$(mysqladmin extended-status |grep -w "Com_rollback" |awk "{print $4}")  commit=$(mysqladmin extended-status |grep -w "Com_commit" |awk "{print $4}")  uptime=$(mysqladmin status |awk "{print $2}")  count=$[$rollback+$commit]  echo "$count $uptime" > /tmp/a.txt  cat /tmp/a.txt |awk "{print $1/$2}" ;; # 庫大小 我們這里拿mysql庫舉例 db)  $mysql -e "select sum(data_length) from information_schema.tables where table_schema="mysql"" |sed -n "2p" ;; # 表大小 我們這里拿mysql下面的user表舉例 tb)  $mysql -e "select sum(data_length) from information_schema.tables where table_schema="mysql" and table_name="user"" |sed -n "2p" ;;esac

3.自定義鍵值key 重啟zabbix-agent

[root@localhost scipts]# cd /etc/zabbix/zabbix_agentd.d/[root@localhost zabbix_agentd.d]# vim mysql.confUserParameter=mysql[*],/etc/zabbix/scipts/mysql.sh $1[root@localhost zabbix_agentd.d]# systemctl restart zabbix-agent

4.在zabbix-server測試 先安裝zabbix-get

[root@localhost ~]# yum -y install zabbix-get[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[slave_status]2[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[Bytes_received]850970[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[Bytes_sent]224906[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[Com_insert]3001[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[Com_delete]135[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[Com_update]128[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[Com_select]19[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[qps]0.864842[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[tps]1.92936[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[db]555118[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[tb]420

報錯處理

[root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[slave_status]sh: /etc/zabbix/scipts/mysql.sh: 權限不夠腳本執(zhí)行權限不夠 去zabbix-agent 加權限[root@localhost zabbix_agentd.d]# chmod +x /etc/zabbix/scipts/mysql.sh [root@localhost ~]# zabbix_get -s 192.168.27.137 -k mysql[slave_status]ERROR 1227 (42000) at line 1: Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation是因為用戶沒有權限查看 去zabbix-agent 授權個用戶在腳本里面加上[root@localhost ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 33Server version: 5.5.65-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type "help;" or "\h" for help. Type "\c" to clear the current input statement.MariaDB [(none)]> grant all on *.* to "check"@"localhost" identified by "123";Query OK, 0 rows affected (0.00 sec)[root@localhost scipts]# vim mysql.sh #!/bin/bashmysql="mysql -ucheck -p123"case $1 in  # mysql主從狀態(tài) slave_status)  $mysql -e "show slave status\G" |grep "Yes" |wc -l ;; 

zabbix頁面上添加監(jiān)控項和圖形




查看mysql流量數(shù)據(jù)


查看mysql qps tps

查看mysql主從狀態(tài)

查看mysql常規(guī)操作

查看mysql庫表大小

mysql主從配置

一.zabbix-server端

[root@localhost ~]# vim /etc/my.cnf

[root@localhost ~]# systemctl restart mariadb[root@localhost ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 7Server version: 5.5.65-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type "help;" or "\h" for help. Type "\c" to clear the current input statement.MariaDB [(none)]> show master status;+------------------+----------+--------------+------------------+| File  | Position | Binlog_Do_DB | Binlog_Ignore_DB |+------------------+----------+--------------+------------------+| mysql-bin.000001 | 175170 |  |   |+------------------+----------+--------------+------------------+1 row in set (0.00 sec)MariaDB [(none)]> grant all on *.* to "tom"@"%" identified by "123";Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> flush privileges;Query OK, 0 rows affected (0.00 sec)

二.zabbix-agent端

[root@localhost ~]# vim /etc/my.cnf

[root@localhost ~]# systemctl restart mariadb[root@localhost ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 2Server version: 5.5.65-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type "help;" or "\h" for help. Type "\c" to clear the current input statement.MariaDB [(none)]> change master to -> master_host="192.168.27.136", -> master_user="tom", -> master_password="123", -> master_log_file="mysql-bin.000001", -> master_log_pos=175170;Query OK, 0 rows affected (0.01 sec)MariaDB [(none)]> start slave;Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> show slave status \G;*************************** 1. row ***************************  Slave_IO_State: Waiting for master to send event   Master_Host: 192.168.27.136   Master_User: tom   Master_Port: 3306  Connect_Retry: 60  Master_Log_File: mysql-bin.000001  Read_Master_Log_Pos: 175170  Relay_Log_File: mysql-relay.000004  Relay_Log_Pos: 529 Relay_Master_Log_File: mysql-bin.000001  Slave_IO_Running: Yes  Slave_SQL_Running: No  Replicate_Do_DB:   Replicate_Ignore_DB:   Replicate_Do_Table:  Replicate_Ignore_Table:  Replicate_Wild_Do_Table:  Replicate_Wild_Ignore_Table:    Last_Errno: 1146   Last_Error: Error "Table "zabbix.history_uint" doesn"t exist" on query. Default database: "zabbix". Query: "insert into history_uint (itemid,clock,ns,value) values (23287,1602301747,810415730,1)"   Skip_Counter: 0  Exec_Master_Log_Pos: 173424  Relay_Log_Space: 2565  Until_Condition: None  Until_Log_File:   Until_Log_Pos: 0  Master_SSL_Allowed: No  Master_SSL_CA_File:   Master_SSL_CA_Path:   Master_SSL_Cert:   Master_SSL_Cipher:   Master_SSL_Key:  Seconds_Behind_Master: NULLMaster_SSL_Verify_Server_Cert: No  Last_IO_Errno: 0  Last_IO_Error:   Last_SQL_Errno: 1146  Last_SQL_Error: Error "Table "zabbix.history_uint" doesn"t exist" on query. Default database: "zabbix". Query: "insert into history_uint (itemid,clock,ns,value) values (23287,1602301747,810415730,1)" Replicate_Ignore_Server_Ids:   Master_Server_Id: 11 row in set (0.00 sec)ERROR: No query specified

報錯處理

[root@localhost ~]# vim /etc/my.cnf

[root@localhost ~]# systemctl restart mariadb[root@localhost ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 4Server version: 5.5.65-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type "help;" or "\h" for help. Type "\c" to clear the current input statement.MariaDB [(none)]> show slave status \G;*************************** 1. row ***************************  Slave_IO_State: Waiting for master to send event   Master_Host: 192.168.27.136   Master_User: tom   Master_Port: 3306  Connect_Retry: 60  Master_Log_File: mysql-bin.000001  Read_Master_Log_Pos: 199126  Relay_Log_File: mysql-relay.000006  Relay_Log_Pos: 3950 Relay_Master_Log_File: mysql-bin.000001  Slave_IO_Running: Yes  Slave_SQL_Running: Yes  Replicate_Do_DB:   Replicate_Ignore_DB:   Replicate_Do_Table:  Replicate_Ignore_Table:  Replicate_Wild_Do_Table:  Replicate_Wild_Ignore_Table:    Last_Errno: 0   Last_Error:    Skip_Counter: 0  Exec_Master_Log_Pos: 199126  Relay_Log_Space: 4240  Until_Condition: None  Until_Log_File:   Until_Log_Pos: 0  Master_SSL_Allowed: No  Master_SSL_CA_File:   Master_SSL_CA_Path:   Master_SSL_Cert:   Master_SSL_Cipher:   Master_SSL_Key:  Seconds_Behind_Master: 0Master_SSL_Verify_Server_Cert: No  Last_IO_Errno: 0  Last_IO_Error:   Last_SQL_Errno: 0  Last_SQL_Error:  Replicate_Ignore_Server_Ids:   Master_Server_Id: 11 row in set (0.00 sec)

到此這篇關于zabbix 監(jiān)控mysql的方法的文章就介紹到這了,更多相關zabbix 監(jiān)控mysql內(nèi)容請搜索以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持!

標簽: Zabbix
相關文章:
日本不卡不码高清免费观看,久久国产精品久久w女人spa,黄色aa久久,三上悠亚国产精品一区二区三区
麻豆91在线播放| av一区二区高清| 欧美搞黄网站| 亚洲精品裸体| 欧美aⅴ一区二区三区视频| 日韩av专区| 亚洲一区免费| 国产乱子精品一区二区在线观看| 日本一区二区免费高清| 午夜在线精品| 免费观看亚洲天堂| 深夜视频一区二区| 色综合视频一区二区三区日韩 | 久久的色偷偷| 日韩精品首页| 精品日韩毛片| 国产伊人久久| 精品一区二区三区中文字幕在线| 99视频精品| 蜜桃视频欧美| 久久精品观看| 成人在线免费观看网站| 免费看欧美美女黄的网站| 久久亚洲不卡| 91伊人久久| 91精品一区| 日本在线视频一区二区| 国产极品一区| 精品国产亚洲一区二区三区在线| 91欧美日韩在线| 美腿丝袜在线亚洲一区| 国产理论在线| 在线综合亚洲| 蜜臀av亚洲一区中文字幕| 中文字幕亚洲在线观看| 国产精品v一区二区三区| 日韩综合精品| 蜜臀av国产精品久久久久| 日本视频中文字幕一区二区三区| 日韩av自拍| 蜜臀av国产精品久久久久 | 免费污视频在线一区| 国内揄拍国内精品久久| 久久国产精品久久久久久电车| 精品一区二区三区中文字幕视频 | 欧美亚洲精品在线| 免费在线看一区| 国内揄拍国内精品久久| 亚洲影院天堂中文av色| 亚洲免费激情| 亚州av乱码久久精品蜜桃| 一区二区不卡| 最新中文字幕在线播放| 高清日韩中文字幕| 噜噜噜躁狠狠躁狠狠精品视频| 麻豆精品视频在线观看| 国产精品美女午夜爽爽| 精品香蕉视频| 日韩国产在线| 91精品高清| 久久国产高清| 欧美激情精品| 免费一二一二在线视频| 久久成人一区| 鲁大师影院一区二区三区| 欧美特黄一级大片| 日韩精品中文字幕吗一区二区| 国产一区二区三区四区大秀| 欧美日韩国产探花| 国产精品多人| 久久久精品久久久久久96| 亚洲乱码久久| 99成人超碰| 国产精品手机在线播放| 日韩视频不卡| 日韩精品专区| 国产欧美成人| 快she精品国产999| 久久精品二区三区| 欧美精品1区| 激情久久婷婷| 国产精品99一区二区三区| 欧美freesex黑人又粗又大| www成人在线视频| 综合亚洲自拍| 亚洲免费专区| 国产一区二区三区视频在线| 亚洲一区欧美激情| 国产精品极品在线观看| 99re国产精品| 红杏一区二区三区| 欧美日韩国产一区二区三区不卡| 一区二区日韩免费看| 色一区二区三区四区| 亚洲免费专区| 亲子伦视频一区二区三区| 日韩国产在线观看| 91久久中文| 国产一区一一区高清不卡| 美日韩精品视频| 久久wwww| 日韩视频久久| 久久久国产亚洲精品| 日韩精品国产欧美| 日韩欧美一区二区三区在线视频| 三级亚洲高清视频| 成人亚洲一区二区| 91欧美极品| 在线一区免费观看| 日本а中文在线天堂| 久久99国产精品视频| 国产欧美一区二区三区精品观看 | 欧美国产专区| 日本麻豆一区二区三区视频| 亚洲少妇诱惑| 国产亚洲精品自拍| 久久精品官网| 久久久久免费av| 日韩一区电影| 精精国产xxxx视频在线野外| 国产精品久久久久久久久免费高清| 久久亚洲精品伦理| 亚洲三级国产| 亚洲日本在线观看视频| 色8久久久久| 日本aⅴ亚洲精品中文乱码 | 中文字幕一区二区精品区| 久久高清一区| 欧美亚洲tv| 四虎8848精品成人免费网站| 中文字幕在线高清| 激情欧美亚洲| 欧美一区=区| 中文字幕亚洲精品乱码| 亚洲1区在线| 国产日本精品| 麻豆网站免费在线观看| 欧美aa在线观看| 亚洲免费黄色| 欧美三级第一页| 久久国产毛片| 亚洲区国产区| 国产成人免费精品| 日韩精品一二区| 日韩a一区二区| 免费观看日韩电影| 国产精品美女午夜爽爽| 欧美精品高清| 亚洲精品在线二区| 国产一区不卡| 亚洲一区二区三区久久久| 国产精品激情| 美女被久久久| 精品视频在线观看网站| 亚洲制服少妇| 精品视频自拍| 久久午夜视频| 肉色欧美久久久久久久免费看| 蜜臀久久久久久久| 久久精品三级| 在线观看视频免费一区二区三区| 久久免费福利| 男女性色大片免费观看一区二区| 成人在线观看免费视频| 蜜桃视频一区二区| 日韩a一区二区| 偷拍欧美精品| 久久尤物视频| 亚洲一区欧美激情| 国产91在线播放精品| 国产精品婷婷| 精品黄色一级片| 日日夜夜免费精品| 91精品国产成人观看| 国产伦一区二区三区| 亚洲女同中文字幕| 在线天堂中文资源最新版| 日韩精品电影一区亚洲| 亚洲不卡av不卡一区二区| 麻豆一区二区三区| 蜜桃av一区二区| av高清一区| 国产精品亚洲欧美| 夜夜精品视频| 国产精品igao视频网网址不卡日韩 | 国产精品社区| 免费一二一二在线视频| 欧美激情91| 欧美日韩中出| 国产亚洲精品久久久久婷婷瑜伽| 国产精品专区免费| 精品日韩一区| 日韩一区二区三区免费播放| 久久99偷拍| 国产精品a级| 日韩av中文字幕一区二区| 亚洲精品自拍| 亚洲一级在线| 免费不卡在线观看| 亚洲美女久久|