grafana之JAVA自动化配置图表

以下模板JSON均是配置好dashbord后,view json得到。然后参数自定义传递。


JAVA接口设计


JVM

说明:JVM即JAVA应用的堆、栈、线程等信息,用于监控应用生命周期内一些异常等。

模板JSON

{
  "dashboard": {
    "annotations": {
      "list": []
    },
    "editable": true,
    "gnetId": null,
    "graphTooltip": 0,
    "hideControls": false,
    "id": null,
    "links": [],
    "refresh": "1m",
    "rows": [
      {
        "collapse": false,
        "height": 470,
        "panels": [
          {
            "aliasColors": {},
            "bars": false,
            "dashLength": 10,
            "dashes": false,
            "datasource": "${datasource}",
            "description": "",
            "fill": 1,
            "id": 1,
            "legend": {
              "alignAsTable": true,
              "avg": true,
              "current": true,
              "max": true,
              "min": true,
              "show": true,
              "sortDesc": true,
              "total": false,
              "values": true },
            "lines": true,
            "linewidth": 1,
            "links": [],
            "nullPointMode": "null",
            "percentage": false,
            "pointradius": 5,
            "points": false,
            "renderer": "flot",
            "seriesOverrides": [
            ],
            "spaceLength": 10,
            "span": 6,
            "stack": false,
            "steppedLine": false,
            "targets": [
              {
                "aggregator": "none",
                "alias": "Max -> [[tag_instance.id]]",
                "currentFilterGroupBy": false,
                "currentFilterKey": "service.version",
                "currentFilterType": "wildcard",
                "currentFilterValue": "*",
                "currentTagKey": "service.version",
                "downsampleAggregator": "avg",
                "downsampleFillPolicy": "none",
                "downsampleInterval": "1m",
                "filters": [ { "filter": "${service.name}", "groupBy": false, "tagk": "service.name", "type": "literal_or" }, { "filter": "$instanceId", "groupBy": true, "tagk": "instance.id", "type": "literal_or" } ],
                "hide": false,
                "metric": "sun.management.MemoryImpl.HeapMemoryUsage.max",
                "refId": "A" },
              {
                "aggregator": "none",
                "alias": "Used -> [[tag_instance.id]]",
                "currentFilterGroupBy": false,
                "currentFilterKey": "",
                "currentFilterType": "literal_or",
                "currentFilterValue": "",
                "downsampleAggregator": "avg",
                "downsampleFillPolicy": "none",
                "downsampleInterval": "1m",
                "filters": [ { "filter": "${service.name}", "groupBy": false, "tagk": "service.name", "type": "literal_or" }, { "filter": "$instanceId", "groupBy": true, "tagk": "instance.id", "type": "literal_or" } ],
                "metric": "sun.management.MemoryImpl.HeapMemoryUsage.used",
                "refId": "B" },
              {
                "aggregator": "none",
                "alias": "Committed -> [[tag_instance.id]]",
                "currentFilterGroupBy": false,
                "currentFilterKey": "",
                "currentFilterType": "literal_or",
                "currentFilterValue": "",
                "downsampleAggregator": "avg",
                "downsampleFillPolicy": "none",
                "downsampleInterval": "1m",
                "filters": [ { "filter": "${service.name}", "groupBy": false, "tagk": "service.name", "type": "literal_or" }, { "filter": "$instanceId", "groupBy": true, "tagk": "instance.id", "type": "literal_or" } ],
                "metric": "sun.management.MemoryImpl.HeapMemoryUsage.committed",
                "refId": "C" }
            ],
            "thresholds": [],
            "timeFrom": null,
            "timeShift": null,
            "title": "堆内存使用(HeapMemoryUsage)",
            "tooltip": {
              "shared": true,
              "sort": 0,
              "value_type": "individual" },
            "type": "graph",
            "xaxis": {
              "buckets": null,
              "mode": "time",
              "name": null,
              "show": true,
              "values": [] },
            "yaxes": [
              {
                "format": "bytes",
                "label": null,
                "logBase": 1,
                "max": null,
                "min": null,
                "show": true },
              {
                "format": "bytes",
                "label": null,
                "logBase": 1,
                "max": null,
                "min": null,
                "show": true }
            ]
          },
          {
            "aliasColors": {},
            "bars": false,
            "dashLength": 10,
            "dashes": false,
            "datasource": "${datasource}",
            "description": "",
            "fill": 1,
            "id": 2,
            "legend": {
              "alignAsTable": true,
              "avg": true,
              "current": true,
              "max": true,
              "min": true,
              "show": true,
              "sortDesc": true,
              "total": false,
              "values": true },
            "lines": true,
            "linewidth": 1,
            "links": [],
            "nullPointMode": "null",
            "percentage": false,
            "pointradius": 5,
            "points": false,
            "renderer": "flot",
            "seriesOverrides": [
            ],
            "spaceLength": 10,
            "span": 6,
            "stack": false,
            "steppedLine": false,
            "targets": [
              {
                "aggregator": "none",
                "alias": "Max -> [[tag_instance.id]]",
                "currentFilterGroupBy": false,
                "currentFilterKey": "",
                "currentFilterType": "literal_or",
                "currentFilterValue": "",
                "downsampleAggregator": "avg",
                "downsampleFillPolicy": "none",
                "downsampleInterval": "1m",
                "filters": [ { "filter": "${service.name}", "groupBy": false, "tagk": "service.name", "type": "literal_or" }, { "filter": "$instanceId", "groupBy": true, "tagk": "instance.id", "type": "literal_or" } ],
                "hide": false,
                "metric": "sun.management.MemoryImpl.NonHeapMemoryUsage.max",
                "refId": "A" },
              {
                "aggregator": "none",
                "alias": "Used -> [[tag_instance.id]]",
                "currentFilterGroupBy": false,
                "currentFilterKey": "",
                "currentFilterType": "literal_or",
                "currentFilterValue": "",
                "downsampleAggregator": "avg",
                "downsampleFillPolicy": "none",
                "downsampleInterval": "1m",
                "filters": [ { "filter": "${service.name}", "groupBy": false, "tagk": "service.name", "type": "literal_or" }, { "filter": "$instanceId", "groupBy": true, "tagk": "instance.id", "type": "literal_or" } ],
                "metric": "sun.management.MemoryImpl.NonHeapMemoryUsage.used",
                "refId": "B" },
              {
                "aggregator": "none",
                "alias": "Committed -> [[tag_instance.id]]",
                "currentFilterGroupBy": false,
                "currentFilterKey": "",
                "currentFilterType": "literal_or",
                "currentFilterValue": "",
                "downsampleAggregator": "avg",
                "downsampleFillPolicy": "none",
                "downsampleInterval": "1m",
                "filters": [ { "filter": "${service.name}", "groupBy": false, "tagk": "service.name", "type": "literal_or" }, { "filter": "$instanceId", "groupBy": true, "tagk": "instance.id", "type": "literal_or" } ],
                "metric": "sun.management.MemoryImpl.NonHeapMemoryUsage.committed",
                "refId": "C" }
            ],
            "thresholds": [],
            "timeFrom": null,
            "timeShift": null,
            "title": "非堆内存使用(NonHeapMemoryUsage)",
            "tooltip": {
              "shared": true,
              "sort": 0,
              "value_type": "individual" },
            "type": "graph",
            "xaxis": {
              "buckets": null,
              "mode": "time",
              "name": null,
              "show": true,
              "values": [] },
            "yaxes": [
              {
                "format": "bytes",
                "label": null,
                "logBase": 1,
                "max": null,
                "min": null,
                "show": true },
              {
                "format": "bytes",
                "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": 444,
        "panels": [
          {
            "aliasColors": {},
            "bars": false,
            "dashLength": 10,
            "dashes": false,
            "datasource": "${datasource}",
            "fill": 1,
            "id": 3,
            "legend": {
              "alignAsTable": true,
              "avg": true,
              "current": true,
              "max": true,
              "min": true,
              "rightSide": false,
              "show": true,
              "total": false,
              "values": true },
            "lines": true,
            "linewidth": 1,
            "links": [],
            "nullPointMode": "null",
            "percentage": false,
            "pointradius": 1,
            "points": false,
            "renderer": "flot",
            "seriesOverrides": [
              {
                "alias": "/.*Count.*/",
                "yaxis": 2 }
            ],
            "spaceLength": 10,
            "span": 6,
            "stack": false,
            "steppedLine": false,
            "targets": [
              {
                "aggregator": "none",
                "alias": "PSScavenge.CollectionTime -> [[tag_instance.id]]",
                "currentFilterGroupBy": false,
                "currentFilterKey": "",
                "currentFilterType": "literal_or",
                "currentFilterValue": "",
                "disableDownsampling": false,
                "downsampleAggregator": "avg",
                "downsampleFillPolicy": "none",
                "downsampleInterval": 
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值