Winse Blog

走走停停, 熙熙攘攘, 忙忙碌碌, 不知何畏.

Ganglia页自定义视图

官网自带的页面指标太拥挤,同一个组各指标的顺序不能指定(默认好像是按名称排序的)不便于观察。通过页面的Views页签可以查看自定的图标。

在conf文件夹(由conf_default.php中views_dir指定)下面建立文件名以 view 开头的json文件。通过Views还可以聚合多个指标,在一个图中查看整体的变化趋势。配置聚合视图前可以先在 Aggregate Graphs 弄出来先瞧一瞧。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
[root@cu2 ~]# cd /var/www/html/ganglia/
# 查看view放置的位置
[root@cu2 ganglia]# grep views_dir conf_default.php 
$conf['views_dir'] = $conf['gweb_confdir'] . '/conf';

# view配置目录
[root@cu2 conf]$ ll
......
-rw-rw-r-- 1 apache apache    58 Oct  2 04:38 view_default.json
-rw-r--r-- 1 root   root    2344 Feb 25 20:12 view_qbevery.json
-rw-r--r-- 1 root   root     241 Feb 25 18:59 view_qb.json

[root@cu2 conf]# cat view_qb.json 
{
"default_size" : "xlarge",
"view_name": "qb",
"items": [
{
"aggregate_graph": "true",
"graph_type": "stack", 
"host_regex":  [ { "regex" : "cu2" } ], 
"metric_regex": [ { "regex":  "qb_.*" } ],
"title": "qb"
}
],
"view_type": "standard"
}
[root@cu2 conf]# cat view_qbevery.json 
{
"default_size" : "medium",
"view_name": "qbevery",
"items": [
{ "hostname":"cu2","metric":"qb_520k_53d_9.82_120807"},
{ "hostname":"cu2","metric":"qb_500k_98d_7.81_116763"},
{ "hostname":"cu2","metric":"qb_400k_91d_7.67_116762"},
{ "hostname":"cu2","metric":"qb_350k_42d_9.08_120802"},
{ "hostname":"cu2","metric":"qb_350k_83d_7.40_116761"},
{ "hostname":"cu2","metric":"qb_300k_78d_7.12_116760"}
],
"view_type": "standard"
}

参考

–END

Comments