使用grafana展示kairosdb数据

最近使用grafana展示opentsd中的heapster监控数据,但是grafana配置opentsdb模板时,query查询tag_values时出现问题,后因为一系列问题,剑神老大决定使用kairosdb,kairosdb果然比opentsd好使啊,文件类型为.json 可以直接导入使用,细节需要自己更改


{
  "__inputs": [
    {
      "name": "DS_KAIROSDB",
      "label": "Kairosdb",
      "description": "",
      "type": "datasource",
      "pluginId": "grafana-kairosdb-datasource",
      "pluginName": "KairosDB"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "4.4.3"
    },
    {
      "type": "datasource",
      "id": "grafana-kairosdb-datasource",
      "name": "KairosDB",
      "version": "2.0.1"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    }
  ],
  "annotations": {
    "list": []
  },
  "editMode": false,
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "hideControls": false,
  "id": null,
  "links": [],
  "rows": [
    {
      "collapse": false,
      "height": "250px",
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_KAIROSDB}",
          "fill": 1,
          "id": 1,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "addFilterTagMode": false,
              "addGroupByMode": false,
              "alias": "cpu_usage_rate ( container_name=$_tag_group_container_name )",
              "aliasMode": "default",
              "currentGroupByType": "tag",
              "currentTagKey": "",
              "currentTagValue": "",
              "downsampling": "avg",
              "errors": {},
              "exOuter": false,
              "groupBy": {
                "tagKey": "",
                "timeInterval": "1s"
              },
              "groupByTags": [
                "container_name"
              ],
              "hide": false,
              "horAggregator": {
                "factor": "1",
                "percentile": "0.75",
                "samplingRate": "1s",
                "trim": "both",
                "unit": "millisecond"
              },
              "isGroupByValid": true,
              "isTagGroupBy": false,
              "isTimeGroupBy": false,
              "isValueGroupBy": false,
              "metric": "cpu_usage_rate",
              "refId": "A",
              "tags": {
                "namespace_name": [
                  "$nameSpace"
                ],
                "pod_name": [
                  "$podName"
                ],
                "type": [
                  "pod_container"
                ]
              }
            },
            {
              "addFilterTagMode": false,
              "addGroupByMode": false,
              "alias": "cpu_limit ( container_name=$_tag_group_container_name )",
              "aliasMode": "default",
              "currentGroupByType": "tag",
              "currentTagKey": "",
              "currentTagValue": "",
              "downsampling": "avg",
              "errors": {},
              "groupBy": {
                "tagKey": "",
                "timeInterval": "1s"
              },
              "groupByTags": [
                "container_name"
              ],
              "hide": false,
              "horAggregator": {
                "factor": "1",
                "percentile": "0.75",
                "samplingRate": "1s",
                "trim": "both",
                "unit": "millisecond"
              },
              "isGroupByValid": true,
              "isTagGroupBy": false,
              "isTimeGroupBy": false,
              "isValueGroupBy": false,
              "metric": "cpu_limit",
              "refId": "B",
              "tags": {
                "namespace_name": [
                  "$nameSpace"
                ],
                "pod_name": [
                  "$podName"
                ],
                "type": [
                  "pod_container"
                ]
              }
            },
            {
              "addFilterTagMode": false,
              "addGroupByMode": false,
              "alias": "cpu_request ( container_name=$_tag_group_container_name )",
              "aliasMode": "default",
              "currentGroupByType": "tag",
              "currentTagKey": "",
              "currentTagValue": "",
              "downsampling": "avg",
              "errors": {},
              "groupBy": {
                "tagKey": "",
                "timeInterval": "1s"
              },
              "groupByTags": [
                "container_name"
              ],
              "hide": false,
              "horAggregator": {
                "factor": "1",
                "percentile": "0.75",
                "samplingRate": "1s",
                "trim": "both",
                "unit": "millisecond"
              },
              "isGroupByValid": true,
              "isTagGroupBy": false,
              "isTimeGroupBy": false,
              "isValueGroupBy": false,
              "metric": "cpu_request",
              "refId": "C",
              "tags": {
                "namespace_name": [
                  "$nameSpace"
                ],
                "pod_name": [
                  "$podName"
                ],
                "type": [
                  "pod_container"
                ]
              }
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "CPU $nameSpace $podName",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Dashboard Row",
      "titleSize": "h6"
    },
    {
      "collapse": false,
      "height": 250,
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_KAIROSDB}",
          "fill": 1,
          "id": 2,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "addFilterTagMode": false,
              "addGroupByMode": false,
              "alias": "memory_usage ( container_name=$_tag_group_container_name )",
              "aliasMode": "default",
              "currentGroupByType": "tag",
              "currentTagKey": "",
              "currentTagValue": "",
              "downsampling": "avg",
              "errors": {},
              "groupBy": {
                "tagKey": "",
                "timeInterval": "1s"
              },
              "groupByTags": [
                "container_name"
              ],
              "hide": false,
              "horAggregator": {
                "factor": "1",
                "percentile": "0.75",
                "samplingRate": "1s",
                "trim": "both",
                "unit": "millisecond"
              },
              "isGroupByValid": true,
              "isTagGroupBy": false,
              "isTimeGroupBy": false,
              "isValueGroupBy": false,
              "metric": "memory_usage",
              "refId": "A",
              "tags": {
                "namespace_name": [
                  "$nameSpace"
                ],
                "pod_name": [
                  "$podName"
                ],
                "type": [
                  "pod_container"
                ]
              }
            },
            {
              "addFilterTagMode": false,
              "addGroupByMode": false,
              "alias": "memory_limit ( container_name=$_tag_group_container_name )",
              "aliasMode": "default",
              "currentGroupByType": "tag",
              "currentTagKey": "",
              "currentTagValue": "",
              "downsampling": "avg",
              "errors": {},
              "groupBy": {
                "tagKey": "",
                "timeInterval": "1s"
              },
              "groupByTags": [
                "container_name"
              ],
              "hide": false,
              "horAggregator": {
                "factor": "1",
                "percentile": "0.75",
                "samplingRate": "1s",
                "trim": "both",
                "unit": "millisecond"
              },
              "isGroupByValid": true,
              "isTagGroupBy": false,
              "isTimeGroupBy": false,
              "isValueGroupBy": false,
              "metric": "memory_limit",
              "refId": "B",
              "tags": {
                "namespace_name": [
                  "$nameSpace"
                ],
                "pod_name": [
                  "$podName"
                ],
                "type": [
                  "pod_container"
                ]
              }
            },
            {
              "addFilterTagMode": false,
              "addGroupByMode": false,
              "alias": "memory_request ( container_name=$_tag_group_container_name )",
              "aliasMode": "default",
              "currentGroupByType": "tag",
              "currentTagKey": "",
              "currentTagValue": "",
              "downsampling": "avg",
              "errors": {},
              "groupBy": {
                "tagKey": "",
                "timeInterval": "1s"
              },
              "groupByTags": [
                "container_name"
              ],
              "hide": false,
              "horAggregator": {
                "factor": "1",
                "percentile": "0.75",
                "samplingRate": "1s",
                "trim": "both",
                "unit": "millisecond"
              },
              "isGroupByValid": true,
              "isTagGroupBy": false,
              "isTimeGroupBy": false,
              "isValueGroupBy": false,
              "metric": "memory_request",
              "refId": "C",
              "tags": {
                "namespace_name": [
                  "$nameSpace"
                ],
                "pod_name": [
                  "$podName"
                ],
                "type": [
                  "pod_container"
                ]
              }
            },
            {
              "addFilterTagMode": false,
              "addGroupByMode": false,
              "alias": "memory_working_set ( container_name=$_tag_group_container_name )",
              "aliasMode": "default",
              "currentGroupByType": "tag",
              "currentTagKey": "",
              "currentTagValue": "",
              "downsampling": "avg",
              "errors": {},
              "groupBy": {
                "tagKey": "",
                "timeInterval": "1s"
              },
              "groupByTags": [
                "container_name"
              ],
              "horAggregator": {
                "factor": "1",
                "percentile": "0.75",
                "samplingRate": "1s",
                "trim": "both",
                "unit": "millisecond"
              },
              "isGroupByValid": true,
              "isTagGroupBy": false,
              "isTimeGroupBy": false,
              "isValueGroupBy": false,
              "metric": "memory_working_set",
              "refId": "D",
              "tags": {
                "namespace_name": [
                  "$nameSpace"
                ],
                "pod_name": [
                  "$podName"
                ],
                "type": [
                  "pod_container"
                ]
              }
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "Memory $nameSpace $podName",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Dashboard Row",
      "titleSize": "h6"
    },
    {
      "collapse": false,
      "height": 250,
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_KAIROSDB}",
          "fill": 1,
          "id": 3,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "addFilterTagMode": false,
              "alias": "network_tx_rate",
              "aliasMode": "default",
              "currentTagKey": "",
              "currentTagValue": "",
              "downsampling": "avg",
              "errors": {},
              "groupBy": {
                "timeInterval": "1s"
              },
              "horAggregator": {
                "factor": "1",
                "percentile": "0.75",
                "samplingRate": "1s",
                "trim": "both",
                "unit": "millisecond"
              },
              "metric": "network_tx_rate",
              "refId": "A",
              "tags": {
                "namespace_name": [
                  "$nameSpace"
                ],
                "pod_name": [
                  "$podName"
                ],
                "type": [
                  "pod"
                ]
              }
            },
            {
              "addFilterTagMode": false,
              "alias": "network_rx_rate",
              "aliasMode": "default",
              "currentTagKey": "",
              "currentTagValue": "",
              "downsampling": "avg",
              "errors": {},
              "groupBy": {
                "timeInterval": "1s"
              },
              "horAggregator": {
                "factor": "1",
                "percentile": "0.75",
                "samplingRate": "1s",
                "trim": "both",
                "unit": "millisecond"
              },
              "metric": "network_rx_rate",
              "refId": "B",
              "tags": {
                "namespace_name": [
                  "$nameSpace"
                ],
                "pod_name": [
                  "$podName"
                ],
                "type": [
                  "pod"
                ]
              }
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "Network $nameSpace $podName",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Dashboard Row",
      "titleSize": "h6"
    },
    {
      "collapse": false,
      "height": 250,
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_KAIROSDB}",
          "fill": 1,
          "id": 4,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "addFilterTagMode": false,
              "alias": "filesystem_usage",
              "aliasMode": "default",
              "currentTagKey": "",
              "currentTagValue": "",
              "downsampling": "avg",
              "errors": {},
              "groupBy": {
                "timeInterval": "1s"
              },
              "horAggregator": {
                "factor": "1",
                "percentile": "0.75",
                "samplingRate": "1s",
                "trim": "both",
                "unit": "millisecond"
              },
              "metric": "filesystem_usage",
              "refId": "A",
              "tags": {
                "namespace_name": [
                  "$nameSpace"
                ],
                "pod_name": [
                  "$podName"
                ],
                "type": [
                  "pod"
                ]
              }
            },
            {
              "addFilterTagMode": false,
              "alias": "filesystem_limit",
              "aliasMode": "default",
              "currentTagKey": "",
              "currentTagValue": "",
              "downsampling": "avg",
              "errors": {},
              "groupBy": {
                "timeInterval": "1s"
              },
              "horAggregator": {
                "factor": "1",
                "percentile": "0.75",
                "samplingRate": "1s",
                "trim": "both",
                "unit": "millisecond"
              },
              "metric": "filesystem_limit",
              "refId": "B",
              "tags": {
                "namespace_name": [
                  "$nameSpace"
                ],
                "pod_name": [
                  "$podName"
                ],
                "type": [
                  "pod"
                ]
              }
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "Filesystem $nameSpace $podName",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Dashboard Row",
      "titleSize": "h6"
    }
  ],
  "schemaVersion": 14,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_KAIROSDB}",
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "nameSpace",
        "options": [],
        "query": "tag_values(memory_limit,namespace_name)",
        "refresh": 1,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_KAIROSDB}",
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "podName",
        "options": [],
        "query": "tag_values(memory_limit,pod_name)",
        "refresh": 1,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "heapsterDashboard2",
  "version": 7
}


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值