cuigh / swirl

A web UI for Docker, focused on swarm cluster.
MIT License
604 stars 78 forks source link

图表怎么创建? #7

Open qq12157138 opened 6 years ago

qq12157138 commented 6 years ago

Query expression怎么写?

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

cuigh commented 6 years ago

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

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

{
  "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": {}
}