MySQL数据库各项性能详细参数查看脚本(一)

2014-11-24 18:43:11 · 作者: · 浏览: 0

本脚本主要用于查看mysql的各项性能参数,以及推荐性能指标,脚本在附件中


运行结果:


[root@cacti ~]# python mysqlpulse.py
Host[localhost]:
User[root]:
Password root@localhost:
database[mysql]:
mysqlpulse.py:323: Warning: The foreign data source you are trying to reference does not exist. Data source error: error: 1054 'Unknown column 'alias' in 'field list''
cursor.execute(sql)
mysqlpulse.py:323: Warning: The foreign data source you are trying to reference does not exist. Data source error: error: 1146 'Table 'center_app.middleware' doesn't exist'
cursor.execute(sql)
=============MySQL info=============
Connection id : 207464
Current database : mysql
Current user : root@localhost
SSL : DISABLED
MySQL VERSION : 5.1.59-log MySQL Community Server (GPL)
MySQL client info : 5.1.59
Protocol version : 10
Connection : Localhost via UNIX socket
Server characterset : latin1
Db characterset : latin1
Client characterset : latin1
Conn. characterset : latin1
collation_connection : latin1_swedish_ci
collation_database : latin1_swedish_ci
collation_server : latin1_swedish_ci

Uptime : 7240897s
============processlist=============
processlist rowcount =27
status time>0 threads list:
Id User Host db Command Time State Info
status time>0 threads count=0
=========MySQL status pulse=========
-----------------------------------------------------------------------------------------------------------------------------
Reads/Writes status total current proposal
-----------------------------------------------------------------------------------------------------------------------------
Reads:Writes ratio(Reads/Writes) : 1.28:1 (652.14M/511.02M) 1:22.68 (182.00/4.03k)
QPS(Questions/Uptime) : 173.07/s (1.17G/6.91M) 73.87/s (4.33k/60.00)
TPS(Questions/Uptime) : 2.27/s (15.69M/6.91M) 0.98/s (59.00/60.00)
Table locks waited ratio(waited/immediate): 1:5.22k (111.33k/580.78M) 0:1 (0.00/4.23k) 0:1
select per second(select/Uptime) : 94.44/s (652.14M/6.91M) 3.03/s (182.00/60.00)
insert per second(insert/Uptime) : 2.75/s (19.00M/6.91M) 0.90/s (54.00/60.00)
update per second(update/Uptime) : 70.10/s (484.09M/6.91M) 67.90/s (3.98k/60.00)
delete per second(delete/Uptime) : 1.13/s (7.81M/6.91M) 0.00/s (0.00/60.00)
replace per second(replace/Uptime) : 0.02/s (121.14k/6.91M) 0.00/s (0.00/60.00)
Bytes sent per second(sent/Uptime) : 191.95k/s (1.29T/6.91M) 13.66k/s (819.64k/60.00)
Bytes received per second(re/Uptime) : 45.39k/s (313.44G/6.91M) 16.67k/s (1000.48k/60.00)
------------------------------------
Slow and Sort queries status
------------------------------------
Slow queries Ratio(Slow/Questions) : 0.67% (8.01M/1.17G) 0.25% (11.00/4.33k) Lower than 0
Slow queries PS(Slow/Uptime) : 1.16/s (8.01M/6.91M) 0.18/s (11.00/60.00) Lower than 0
Full join PS(full/Uptime)