ganglia gweb Custom Composite Graphs

在讲gweb 自定义view时, 我们看到json文件里面对items主机配置时, 可以选择查看主机的graph还是metric,


# pwd
/data01/web/ganglia-web/conf
view_jira.json
{
  "view_name":"jira",   # 视图名称
  "items":[    # 视图里包含的东西, 配置为列表形式, 如下
    { "hostname":"web01.domain.com","graph":"cpu_report"},     # 图表1, 单台主机的单个graph. 在graph.d目录中定义具体内容
    { "hostname":"web03.domain.com","metric":"cpu_aidle"},    # 图表3, 单台主机的单个metric
...

metric很好理解, 使用gmond -m就能查看所有module支持的metric.
graph则是一些metric的组合, 在graph.d目录中配置.
例如 : 
[root@db-172-16-3-221 graph.d]# pwd
/data01/web/ganglia-web/graph.d
[root@db-172-16-3-221 graph.d]# ll
total 80
-rw-r--r-- 1 nobody 1000  578 Jan  6  2014 apache_report.json
-rw-r--r-- 1 nobody 1000  186 Jan  6  2014 apache_response_report.json
-rw-r--r-- 1 nobody 1000  426 Jan  6  2014 cpu_report.json
-rw-r--r-- 1 nobody 1000 9065 Jan  6  2014 cpu_report.php
-rw-r--r-- 1 nobody 1000  476 Jan  6  2014 load_all_report.json
-rw-r--r-- 1 nobody 1000  590 Jan  6  2014 load_report.json
-rw-r--r-- 1 nobody 1000  680 Jan  6  2014 mem_report.json
-rw-r--r-- 1 nobody 1000 8324 Aug  4 03:04 mem_report.php
-rw-r--r-- 1 nobody 1000 4973 Jan  6  2014 metric.php
-rw-r--r-- 1 nobody 1000  355 Jan  6  2014 network_report.json
-rw-r--r-- 1 nobody 1000 1616 Jan  6  2014 nfs_v3_client_report.json
-rw-r--r-- 1 nobody 1000  358 Jan  6  2014 packet_report.json
-rw-r--r-- 1 nobody 1000 6392 Jan  6  2014 sample_report.php
-rw-r--r-- 1 nobody 1000 3543 Jan  6  2014 varnish_report.php
[root@db-172-16-3-221 graph.d]# cat cpu_report.json 
{
   "report_name" : "cpu_report",
   "report_type" : "template",
   "title" : "CPU Report",
   "graphite"  : "target=alias(HOST_CLUSTER.cpu_user.sum,'User')&target=alias(HOST_CLUSTER.cpu_nice.sum%2C'Nice')&target=alias(HOST_CLUSTER.cpu_system.sum,'System')&target=alias(HOST_CLUSTER.cpu_wio.sum,'Wait')&target=alias(HOST_CLUSTER.cpu_idle.sum%2C'Idle')&areaMode=stacked&max=100&colorList=3333bb,ffea00,dd0000,ff8a60,e2e2f2"
}


[root@db-172-16-3-221 graph.d]# cat load_all_report.json 
{
   "report_name" : "load_all_report",
   "report_type" : "standard",
   "title" : "Load All Report",
   "vertical_label" : "load",
   "series" : [
      { "metric": "load_one", "color": "3333bb", "label": "Load 1", "line_width": "2", "type": "line" },
      { "metric": "load_five", "color": "ffea00", "label": "Load 5", "line_width": "2", "type": "line" },
      { "metric": "load_fifteen", "color": "dd0000", "label": "Load 15", "line_width": "2", "type": "line" }
   ]
}

graph的命名规则 : 
?_report.json
内容解释 : 
Graph configuration
Key: Value
report_name: Name of the report that web UI uses.
title: Title of the report to show on a graph.
vertical_label: Y-axis description (optional).
series: An array of metrics to use to compose a graph. 

Series options
Key: Value
metric: Name of a metric, such as load_one and cpu_system. If the metric doesn’t exist it will be skipped.
color: A 6 hex-decimal color code, such as 000000 for black.
label: Metric label, such as Load 1.
type: Item type. It can be either line or stack.
line_width: If type is set to line, this value will be used as a line width. If this value is not specified, it defaults to 2. If type is stack, it's ignored even if set.

通过配置?_report.json, 我们可以简化view的json配置.

[参考]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值