mysqlreport 工具是一個perl 的腳本,為了能夠正常運(yùn)行該腳本,需要安裝DBI 和DBD-mysql 等庫。
現(xiàn)在的版本為3.5版本。
以下講解選項(xiàng)的應(yīng)用:
--user USER 連接mysql 的用戶名
--password PASS 連接mysql 的密碼-
--host ADDRESS 連接mysql 的數(shù)據(jù)庫ip地址,如果連接的是本機(jī),則可以省略
--port PORT mysql 的端口
--socket SOCKET 連接mysql的socket 文件,如果有host,用戶名和密碼等,可以省略該參數(shù)
--no-mycnf 告訴mysqlreport 不需要讀取my.cnf配置文件,默認(rèn)情況會從my.cnf中讀取配置
--infile FILE 從文件中讀取狀態(tài)資料,通常為使用show status 后輸出的結(jié)果
--outfile FILE 把結(jié)果寫入到一個文件中
--email ADDRESS 把報告的內(nèi)容發(fā)送到指定的郵件地址中,主要是調(diào)用sendmail 程序來完成郵件的發(fā)送(doesn't work on Windows)
--flush-status 顯示完報告后,執(zhí)行 "FLUSH STATUS;" 語句,但需要有該權(quán)限
--relative X 間隔多少秒后再產(chǎn)生一份報告,每次的結(jié)果都是基于上一次的結(jié)果的差異。
--report-count N 合計采集多少份報告,只有設(shè)置了relative 后方生效(default 1)
--detach 后臺運(yùn)行(run in background)
--help Prints this
--debug Print debugging information
應(yīng)用舉例:
./mysqlreport -r 3600 -detach -email host@local --outfile /home/report.log host.com
一個小時后再產(chǎn)生一份系統(tǒng)報告,寫入文件的同時發(fā)送email。
./mysqlreport 的結(jié)果如下:
MySQL 5.1.22-log uptime 47 18:44:29 Mon May 3 17:14:12 2010
__ Key _________________________________________________________________
Buffer used 14.16M of 16.00M %Used: 88.48
Current 9.57M %Usage: 59.82
Write hit 98.68%
Read hit 99.77%
__ Questions ___________________________________________________________
Total 29.30M 7.1/s
DMS 27.56M 6.7/s %Total: 94.05
Com_ 1.39M 0.3/s 4.76
COM_QUIT 347.22k 0.1/s 1.18
+Unknown 434 0.0/s 0.00
Slow 10 s 10 0.0/s 0.00 %DMS: 0.00 Log: OFF
DMS 27.56M 6.7/s 94.05
DELETE 17.67M 4.3/s 60.31 64.13
UPDATE 8.84M 2.1/s 30.16 32.07
SELECT 898.65k 0.2/s 3.07 3.26
INSERT 150.31k 0.0/s 0.51 0.55
REPLACE 0 0/s 0.00 0.00
Com_ 1.39M 0.3/s 4.76
change_db 963.51k 0.2/s 3.29
set_option 347.70k 0.1/s 1.19
show_create 23.12k 0.0/s 0.08
__ SELECT and Sort _____________________________________________________
Scan 146.59k 0.0/s %SELECT: 16.31
Range 68.85k 0.0/s 7.66
Full join 0 0/s 0.00
Range check 0 0/s 0.00
Full rng join 0 0/s 0.00
Sort scan 30 0.0/s
Sort range 82 0.0/s
Sort mrg pass 0 0/s
__ Table Locks _________________________________________________________
Waited 121.95k 0.0/s %Total: 0.44
Immediate 27.45M 6.6/s
__ Tables ______________________________________________________________
Open 64 of 64 %Cache: 100.00
Opened 50.67k 0.0/s
__ Connections _________________________________________________________
Max used 12 of 100 %Max: 12.00
Total 347.25k 0.1/s
__ Created Temp ________________________________________________________
Disk table 7.86k 0.0/s
Table 77.82k 0.0/s Size: 32.0M
File 32 0.0/s
__ Threads _____________________________________________________________
Running 1 of 3
Cached 0 of 0 %Hit: 0
Created 347.25k 0.1/s
Slow 0 0/s
__ Aborted _____________________________________________________________
Clients 56 0.0/s
Connects 1 0.0/s
__ Bytes _______________________________________________________________
Sent 553.34M 134.0/s
Received 892.11M 216.1/s
__ InnoDB Buffer Pool __________________________________________________
Usage 8.00M of 8.00M %Used: 100.00
Read hit 99.99%
Pages
Free 0 %Total: 0.00
Data 508 99.22 %Drty: 0.00
Misc 4 0.78
Latched 0 0.00
Reads 555.12M 134.5/s
From file 46.30k 0.0/s 0.01
Ahead Rnd 455 0.0/s
Ahead Sql 141 0.0/s
Writes 124.86M 30.2/s
Flushes 273.15k 0.1/s
Wait Free 0 0/s
__ InnoDB Lock _________________________________________________________
Waits 0 0/s
Current 0
Time acquiring
Total 0 ms
Average 0 ms
Max 0 ms
__ InnoDB Data, Pages, Rows ____________________________________________
Data
Reads 51.85k 0.0/s
Writes 112.45k 0.0/s
fsync 40.80k 0.0/s
Pending
Reads 0
Writes 0
fsync 0
Pages
Created 195.73k 0.0/s
Read 55.60k 0.0/s
Written 273.15k 0.1/s
Rows
Deleted 0 0/s
Inserted 31.16M 7.5/s
Read 57.86M 14.0/s
Updated 0 0/s
報表解讀:
MySQL 5.0.22-log uptime 47 18:49:16 Mon May 3 17:18:59 2010
顯示了mysql 的版本,運(yùn)行時間,當(dāng)前服務(wù)器時間
__ Key _________________________________________________________________
Buffer used 14.16M of 16.00M %Used: 88.48
Current 9.57M %Usage: 59.82
Write hit 98.68%
Read hit 99.77%
顯示緩沖區(qū)的使用情況。讀和寫的命中率信息
__ Questions ___________________________________________________________
Total 29.30M 7.1/s ---總共進(jìn)行的查詢及查詢的頻率
DMS 27.56M 6.7/s %Total: 94.05 --進(jìn)行DMS 操作的總量和操作頻率及DMS占用整個查詢的百分比
Com_ 1.39M 0.3/s 4.76 --所有 MySQL 所執(zhí)行過的指令,如果值比較高表示 MySQL 正忙碌于無關(guān)緊要的事情上
COM_QUIT 347.24k 0.1/s 1.18
+Unknown 434 0.0/s 0.00
Slow 10 s 10 0.0/s 0.00 %DMS: 0.00 Log: OFF 記錄慢查詢的執(zhí)行總次數(shù),頻率,占用比列,是否開啟慢查詢log。
DMS 27.56M 6.7/s 94.05 ---統(tǒng)計DMS 操作的各項(xiàng)的詳細(xì)匯總
DELETE 17.67M 4.3/s 60.31 64.13
UPDATE 8.84M 2.1/s 30.16 32.07
SELECT 898.71k 0.2/s 3.07 3.26
INSERT 150.32k 0.0/s 0.51 0.55
REPLACE 0 0/s 0.00 0.00
Com_ 1.39M 0.3/s 4.76
change_db 963.56k 0.2/s 3.29
set_option 347.72k 0.1/s 1.19
show_create 23.12k 0.0/s 0.08
本文出自:億恩科技【mszdt.com】
服務(wù)器租用/服務(wù)器托管中國五強(qiáng)!虛擬主機(jī)域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|