---
title: "cacti-0.8.7i使用percona-monitoring-plugins一些配置备忘"
author: "willvvv"
date: "2012-06-06T17:02:21Z"
tags: ["MySQL", "cacti", "rt"]
categories: ["开源软件"]
slug: "cacti-0-8-7i-percona-monitoring-plugins"
draft: false
lastmod: "2012-06-06T17:21:52Z"
id: 1553413
url: "https://willvvv.iteye.com/blog/1553413"
---

1.如果使用percona-monitoring-plugins的Percona Disk Operations GT等disk相关的监控图表，其中有一个device的项需要手工填写，可以从cat /proc/diskstats 查看device。结果如下：

```
[root@centos-183 bin]# cat /proc/diskstats 
   1    0 ram0 0 0 0 0 0 0 0 0 0 0 0
   1    1 ram1 0 0 0 0 0 0 0 0 0 0 0
   1    2 ram2 0 0 0 0 0 0 0 0 0 0 0
   1    3 ram3 0 0 0 0 0 0 0 0 0 0 0
   1    4 ram4 0 0 0 0 0 0 0 0 0 0 0
   1    5 ram5 0 0 0 0 0 0 0 0 0 0 0
   1    6 ram6 0 0 0 0 0 0 0 0 0 0 0
   1    7 ram7 0 0 0 0 0 0 0 0 0 0 0
   1    8 ram8 0 0 0 0 0 0 0 0 0 0 0
   1    9 ram9 0 0 0 0 0 0 0 0 0 0 0
   1   10 ram10 0 0 0 0 0 0 0 0 0 0 0
   1   11 ram11 0 0 0 0 0 0 0 0 0 0 0
   1   12 ram12 0 0 0 0 0 0 0 0 0 0 0
   1   13 ram13 0 0 0 0 0 0 0 0 0 0 0
   1   14 ram14 0 0 0 0 0 0 0 0 0 0 0
   1   15 ram15 0 0 0 0 0 0 0 0 0 0 0
   8    0 sda 6089 4924 415104 66748 2852 42562 363572 262815 0 42302 329589
   8    1 sda1 111 965 2152 520 2 0 4 2 0 354 522
   8    2 sda2 5944 3731 412690 66021 2850 42562 363568 262813 0 41908 328860
 253    0 dm-0 9463 0 411410 122635 45446 0 363568 22113066 0 41493 22235701
 253    1 dm-1 112 0 896 1247 0 0 0 0 0 183 1247
   9    0 md0 0 0 0 0 0 0 0 0 0 0 0
```

 

下面device就可以写sda或sda1

![](http://dl.iteye.com/upload/attachment/0069/2205/658f613b-6869-3137-8c88-4928ccd4ee5a.png)

 

 

 

 

2.Percona的5.1.53和5.5.8版本，把ResponseTime的统计在MySQL Server端实现，可以统计MySQL Server端sql语句执行时间和次数。

但是默认并没有开启此功能。

我们可以在mysql命令行输入以下命令确认当前版本是否支持该功能

```
mysql> SHOW variables like '%response_time_distribution%';
+---------------------------------+-------+
| Variable_name                   | Value |
+---------------------------------+-------+
| have_response_time_distribution | YES   |
+---------------------------------+-------+
1 row in set (0.00 sec)
```

 

是否开启

```
mysql> SHOW variables like '%response%';
+---------------------------------+-------+
| Variable_name                   | Value |
+---------------------------------+-------+
| have_response_time_distribution | YES   |
| query_response_time_range_base  | 10    |
| query_response_time_stats       | OFF   |
+---------------------------------+-------+
3 rows in set (0.00 sec)
```

query\_response\_time\_stats的值为OFF，说明没有开启

 

开启query\_response\_time\_stats

```
mysql> set global query_response_time_stats=1;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW QUERY_RESPONSE_TIME;
+----------------+---+----------------+
|                |   |                |
+----------------+---+----------------+
|       0.000001 | 0 |       0.000000 |
|       0.000010 | 0 |       0.000000 |
|       0.000100 | 1 |       0.000078 |
|       0.001000 | 0 |       0.000000 |
|       0.010000 | 0 |       0.000000 |
|       0.100000 | 0 |       0.000000 |
|       1.000000 | 0 |       0.000000 |
|      10.000000 | 0 |       0.000000 |
|     100.000000 | 0 |       0.000000 |
|    1000.000000 | 0 |       0.000000 |
|   10000.000000 | 0 |       0.000000 |
|  100000.000000 | 0 |       0.000000 |
| 1000000.000000 | 0 |       0.000000 |
| TOO LONG       | 0 | TOO LONG       |
+----------------+---+----------------+
14 rows in set (0.00 sec)
```

 

再新建模版图像Percona MySQL Query Response Time (Microseconds) GT和 Percona MySQL Query Time Histogram (Count) GT

![](http://dl.iteye.com/upload/attachment/0069/2226/993e0a32-c2bd-3a7b-b066-711f468ab379.png)

 

 

参考：[http://www.percona.com/doc/percona-monitoring-plugins/cacti/ssh-based-templates.html](http://www.percona.com/doc/percona-monitoring-plugins/cacti/ssh-based-templates.html)