swirl icon indicating copy to clipboard operation
swirl copied to clipboard

图表怎么创建?

Open qq12157138 opened this issue 7 years ago • 1 comments

Query expression怎么写?

我觉得楼主直接定好模版就行了。

qq12157138 avatar Apr 27 '18 07:04 qq12157138

就是 Prometheus 的查询表达式,可参考其官方文档:https://prometheus.io/docs/prometheus/latest/querying/basics/

下面是几个首页示例图表,你可以使用图表的导入功能来导入 Swirl 中

  • 服务器 1 分钟内平均负载
{
  "name": "node_load1",
  "title": "node_load1",
  "desc": "Node load in 1 minute",
  "metrics": [
    {
      "legend": "${host_name}",
      "query": "node_load1"
    }
  ],
  "kind": "",
  "dashboard": "home",
  "type": "line",
  "unit": "percent:1",
  "width": 6,
  "height": 200,
  "options": {}
}
  • 容器占用的总内存
{
  "name": "container_memory_total",
  "title": "Total memory usage",
  "desc": "Total memory usage of all containers",
  "metrics": [
    {
      "legend": "${host_name}",
      "query": "sum(container_memory_usage_bytes{image!=\"\"}) by(host_name)"
    }
  ],
  "kind": "",
  "dashboard": "home",
  "type": "pie",
  "unit": "size:bytes",
  "width": 3,
  "height": 200,
  "options": {}
}

cuigh avatar Apr 28 '18 02:04 cuigh