grafana之JAVA自动化配置图表

来源:互联网 发布:mac os 离线升级 编辑:程序博客网 时间:2024/06/06 20:30

以下模板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": "1m",                "explicitTags": false,                "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.GarbageCollectorImpl.PSScavenge.CollectionTime",                "refId": "A",                "shouldComputeRate": true,                "isCounter": true              },              {                "aggregator": "none",                "alias": "PSScavenge.CollectionCount -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "disableDownsampling": false,                "downsampleAggregator": "last",                "downsampleFillPolicy": "none",                "downsampleInterval": "1m",                "explicitTags": false,                "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.GarbageCollectorImpl.PSScavenge.CollectionCount",                "refId": "B",                "shouldComputeRate": true,                "isCounter": true              },              {                "aggregator": "none",                "alias": "PSMarkSweep.CollectionTime -> [[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": "iliteral_or"                  },                  {                    "filter": "$instanceId",                    "groupBy": true,                    "tagk": "instance.id",                    "type": "literal_or"                  }                ],                "metric": "sun.management.GarbageCollectorImpl.PSMarkSweep.CollectionTime",                "refId": "C",                "shouldComputeRate": true,                "isCounter": true              },              {                "aggregator": "none",                "alias": "PSMarkSweep.CollectionCount -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "sum",                "downsampleFillPolicy": "none",                "downsampleInterval": "1m",                "explicitTags": false,                "filters": [                  {                    "filter": "${service.name}",                    "groupBy": false,                    "tagk": "service.name",                    "type": "iliteral_or"                  },                  {                    "filter": "$instanceId",                    "groupBy": true,                    "tagk": "instance.id",                    "type": "literal_or"                  }                ],                "metric": "sun.management.GarbageCollectorImpl.PSMarkSweep.CollectionCount",                "refId": "D",                "shouldComputeRate": true,                "isCounter": true              }            ],            "thresholds": [],            "timeFrom": null,            "timeShift": null,            "title": "垃圾回收(GC)",            "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              }            ]          },          {            "aliasColors": {},            "bars": false,            "dashLength": 10,            "dashes": false,            "datasource": "${datasource}",            "fill": 1,            "id": 4,            "legend": {              "alignAsTable": true,              "avg": false,              "current": true,              "max": true,              "min": true,              "show": 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": "ThreadCount -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "last",                "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.ThreadImpl.ThreadCount",                "refId": "B"              },              {                "aggregator": "none",                "alias": "PeakThreadCount -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "max",                "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.ThreadImpl.PeakThreadCount",                "refId": "C"              },              {                "aggregator": "none",                "alias": "DaemonThreadCount -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "last",                "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.ThreadImpl.DaemonThreadCount",                "refId": "D"              }            ],            "thresholds": [],            "timeFrom": null,            "timeShift": null,            "title": "线程(Thread)",            "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": "${datasource}",            "fill": 1,            "id": 5,            "legend": {              "alignAsTable": true,              "avg": true,              "current": true,              "max": true,              "min": true,              "show": true,              "total": false,              "values": true            },            "lines": true,            "linewidth": 1,            "links": [],            "nullPointMode": "null",            "percentage": false,            "pointradius": 5,            "points": false,            "renderer": "flot",            "seriesOverrides": [],            "spaceLength": 10,            "span": 4,            "stack": false,            "steppedLine": false,            "targets": [              {                "aggregator": "none",                "alias": "Max -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "last",                "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.MemoryPoolImpl.PSEdenSpace.Usage.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.MemoryPoolImpl.PSEdenSpace.Usage.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.MemoryPoolImpl.PSEdenSpace.Usage.committed",                "refId": "C"              }            ],            "thresholds": [],            "timeFrom": null,            "timeShift": null,            "title": "PSEdenSpace",            "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              }            ]          },          {            "aliasColors": {},            "bars": false,            "dashLength": 10,            "dashes": false,            "datasource": "${datasource}",            "fill": 1,            "id": 6,            "legend": {              "alignAsTable": true,              "avg": true,              "current": true,              "max": true,              "min": true,              "show": true,              "total": false,              "values": true            },            "lines": true,            "linewidth": 1,            "links": [],            "nullPointMode": "null",            "percentage": false,            "pointradius": 5,            "points": false,            "renderer": "flot",            "seriesOverrides": [],            "spaceLength": 10,            "span": 4,            "stack": false,            "steppedLine": false,            "targets": [              {                "aggregator": "none",                "alias": "Max -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "last",                "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.MemoryPoolImpl.PSSurvivorSpace.Usage.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.MemoryPoolImpl.PSSurvivorSpace.Usage.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.MemoryPoolImpl.PSSurvivorSpace.Usage.committed",                "refId": "C"              }            ],            "thresholds": [],            "timeFrom": null,            "timeShift": null,            "title": "PSSurvivorSpace",            "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              }            ]          },          {            "aliasColors": {},            "bars": false,            "dashLength": 10,            "dashes": false,            "datasource": "${datasource}",            "fill": 1,            "id": 7,            "legend": {              "alignAsTable": true,              "avg": true,              "current": true,              "max": true,              "min": true,              "show": true,              "total": false,              "values": true            },            "lines": true,            "linewidth": 1,            "links": [],            "nullPointMode": "null",            "percentage": false,            "pointradius": 5,            "points": false,            "renderer": "flot",            "seriesOverrides": [],            "spaceLength": 10,            "span": 4,            "stack": false,            "steppedLine": false,            "targets": [              {                "aggregator": "none",                "alias": "Max -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "last",                "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.MemoryPoolImpl.PSOldGen.Usage.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.MemoryPoolImpl.PSOldGen.Usage.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.MemoryPoolImpl.PSOldGen.Usage.committed",                "refId": "C"              }            ],            "thresholds": [],            "timeFrom": null,            "timeShift": null,            "title": "PSOldGen",            "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": "${datasource}",            "fill": 1,            "id": 8,            "legend": {              "alignAsTable": true,              "avg": false,              "current": true,              "max": true,              "min": true,              "show": true,              "total": false,              "values": true            },            "lines": true,            "linewidth": 1,            "links": [],            "nullPointMode": "null",            "percentage": false,            "pointradius": 5,            "points": false,            "renderer": "flot",            "seriesOverrides": [],            "spaceLength": 10,            "span": 4,            "stack": false,            "steppedLine": false,            "targets": [              {                "aggregator": "max",                "alias": "RequestCount -> [[tag_instance.id]]",                "counterMax": "10",                "counterResetValue": "1",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "disableDownsampling": false,                "downsampleAggregator": "max",                "downsampleFillPolicy": "none",                "downsampleInterval": "1m",                "explicitTags": false,                "filters": [                  {                    "filter": "${service.name}",                    "groupBy": false,                    "tagk": "service.name",                    "type": "iliteral_or"                  },                  {                    "filter": "$instanceId",                    "groupBy": true,                    "tagk": "instance.id",                    "type": "literal_or"                  }                ],                "isCounter": false,                "metric": "org.apache.tomcat.util.modeler.BaseModelMBean.http-apr-8080.requestCount",                "refId": "A",                "shouldComputeRate": true,                "isCounter": true              },              {                "aggregator": "none",                "alias": "ErrorCount -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "last",                "downsampleFillPolicy": "zero",                "downsampleInterval": "1m",                "filters": [                  {                    "filter": "${service.name}",                    "groupBy": false,                    "tagk": "service.name",                    "type": "iliteral_or"                  },                  {                    "filter": "$instanceId",                    "groupBy": true,                    "tagk": "instance.id",                    "type": "literal_or"                  }                ],                "metric": "org.apache.tomcat.util.modeler.BaseModelMBean.http-apr-8080.errorCount",                "refId": "B",                "shouldComputeRate": true,                "isCounter": true              }            ],            "thresholds": [],            "timeFrom": null,            "timeShift": null,            "title": "Tomcat请求(Request)",            "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              }            ]          },          {            "aliasColors": {},            "bars": false,            "dashLength": 10,            "dashes": false,            "datasource": "${datasource}",            "decimals": null,            "fill": 1,            "id": 9,            "legend": {              "alignAsTable": true,              "avg": false,              "current": true,              "max": true,              "min": true,              "show": true,              "total": false,              "values": true            },            "lines": true,            "linewidth": 1,            "links": [],            "nullPointMode": "null",            "percentage": false,            "pointradius": 5,            "points": false,            "renderer": "flot",            "seriesOverrides": [],            "spaceLength": 10,            "span": 4,            "stack": false,            "steppedLine": false,            "targets": [              {                "aggregator": "none",                "alias": "activeSessions -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "last",                "downsampleFillPolicy": "none",                "downsampleInterval": "1m",                "filters": [                  {                    "filter": "${service.name}",                    "groupBy": false,                    "tagk": "service.name",                    "type": "iliteral_or"                  },                  {                    "filter": "$instanceId",                    "groupBy": true,                    "tagk": "instance.id",                    "type": "literal_or"                  }                ],                "metric": "org.apache.tomcat.util.modeler.BaseModelMBean.activeSessions",                "refId": "A",                "shouldComputeRate": false              },              {                "aggregator": "none",                "alias": "rejectedSessions -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "last",                "downsampleFillPolicy": "none",                "downsampleInterval": "1m",                "filters": [                  {                    "filter": "${service.name}",                    "groupBy": false,                    "tagk": "service.name",                    "type": "iliteral_or"                  },                  {                    "filter": "$instanceId",                    "groupBy": true,                    "tagk": "instance.id",                    "type": "literal_or"                  }                ],                "metric": "org.apache.tomcat.util.modeler.BaseModelMBean.rejectedSessions",                "refId": "B",                "shouldComputeRate": false              }            ],            "thresholds": [],            "timeFrom": null,            "timeShift": null,            "title": "Tomcat会话(Session)",            "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              }            ]          },          {            "aliasColors": {},            "bars": false,            "dashLength": 10,            "dashes": false,            "datasource": "${datasource}",            "fill": 1,            "id": 10,            "legend": {              "alignAsTable": true,              "avg": false,              "current": true,              "max": true,              "min": true,              "show": true,              "total": false,              "values": true            },            "lines": true,            "linewidth": 1,            "links": [],            "nullPointMode": "null",            "percentage": false,            "pointradius": 5,            "points": false,            "renderer": "flot",            "seriesOverrides": [],            "spaceLength": 10,            "span": 4,            "stack": false,            "steppedLine": false,            "targets": [              {                "aggregator": "none",                "alias": "MaxThreads -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "last",                "downsampleFillPolicy": "none",                "downsampleInterval": "1m",                "filters": [                  {                    "filter": "${service.name}",                    "groupBy": false,                    "tagk": "service.name",                    "type": "iliteral_or"                  },                  {                    "filter": "$instanceId",                    "groupBy": true,                    "tagk": "instance.id",                    "type": "literal_or"                  }                ],                "metric": "org.apache.tomcat.util.modeler.BaseModelMBean.http-apr-8080.maxThreads",                "refId": "A"              },              {                "aggregator": "none",                "alias": "CurrentThreadCount -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "last",                "downsampleFillPolicy": "none",                "downsampleInterval": "1m",                "filters": [                  {                    "filter": "${service.name}",                    "groupBy": false,                    "tagk": "service.name",                    "type": "iliteral_or"                  },                  {                    "filter": "$instanceId",                    "groupBy": true,                    "tagk": "instance.id",                    "type": "literal_or"                  }                ],                "metric": "org.apache.tomcat.util.modeler.BaseModelMBean.http-apr-8080.currentThreadCount",                "refId": "B"              },              {                "aggregator": "none",                "alias": "CurrentThreadsBusy -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "last",                "downsampleFillPolicy": "none",                "downsampleInterval": "1m",                "filters": [                  {                    "filter": "${service.name}",                    "groupBy": false,                    "tagk": "service.name",                    "type": "iliteral_or"                  },                  {                    "filter": "$instanceId",                    "groupBy": true,                    "tagk": "instance.id",                    "type": "literal_or"                  }                ],                "metric": "org.apache.tomcat.util.modeler.BaseModelMBean.http-apr-8080.currentThreadsBusy",                "refId": "C"              }            ],            "thresholds": [],            "timeFrom": null,            "timeShift": null,            "title": "Tomcat线程池(ThreadPool)",            "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": "${datasource}",          "hide": 0,          "includeAll": true,          "label": "实例",          "multi": true,          "name": "instanceId",          "options": [],          "query": "tag_values(sun.management.MemoryImpl.HeapMemoryUsage.max, instance.id, service.name=${service.name})",          "refresh": 2,          "regex": "",          "sort": 0,          "tagValuesQuery": "",          "tags": [],          "tagsQuery": "",          "type": "query",          "useTags": false        }      ]    },    "time": {      "from": "now-1h",      "to": "now"    },    "timepicker": {      "refresh_intervals": [        "1m",        "5m"      ],      "time_options": [        "5m",        "15m",        "30m",        "1h",        "6h",        "12h",        "1d",        "7d"      ]    },    "timezone": "browser",    "title": "${title}",    "version": 0  },  "overwrite": false}

效果图:

这里写图片描述

这里写图片描述


服务质量

说明:服务质量即web应用接口访问次数、响应时间、错误等,用于查看系统接口调用详情。

模板JSON

{  "dashboard": {    "annotations": {      "list": []    },    "editable": true,    "gnetId": null,    "graphTooltip": 0,    "hideControls": false,    "id": null,    "links": [],    "refresh": false,    "rows": [      {        "collapse": false,        "height": "250px",        "panels": [          {            "aliasColors": {},            "bars": false,            "dashLength": 10,            "dashes": false,            "datasource": "${datasource}",            "fill": 1,            "id": 1,            "legend": {              "alignAsTable": true,              "avg": true,              "current": true,              "max": true,              "min": true,              "show": true,              "total": false,              "values": true            },            "lines": true,            "linewidth": 1,            "links": [],            "nullPointMode": "null",            "percentage": false,            "pointradius": 5,            "points": false,            "renderer": "flot",            "seriesOverrides": [],            "spaceLength": 10,            "span": 7,            "stack": false,            "steppedLine": false,            "targets": [              {                "aggregator": "p95",                "alias": "接口访问耗时 -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "p95",                "downsampleFillPolicy": "none",                "downsampleInterval": "",                "filters": [                  {                    "filter": "${service.name}",                    "groupBy": false,                    "tagk": "service.name",                    "type": "literal_or"                  },                  {                    "filter": "$instanceId",                    "groupBy": true,                    "tagk": "instance.id",                    "type": "literal_or"                  }                ],                "metric": "api.call.duration",                "refId": "A"              }            ],            "thresholds": [],            "timeFrom": null,            "timeShift": null,            "title": "接口响应时间",            "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              }            ]          },          {            "aliasColors": {},            "bars": false,            "dashLength": 10,            "dashes": false,            "datasource": "${datasource}",            "fill": 1,            "id": 2,            "legend": {              "alignAsTable": true,              "avg": true,              "current": true,              "max": true,              "min": true,              "show": true,              "total": true,              "values": true            },            "lines": true,            "linewidth": 1,            "links": [],            "nullPointMode": "null",            "percentage": false,            "pointradius": 5,            "points": false,            "renderer": "flot",            "seriesOverrides": [],            "spaceLength": 10,            "span": 7,            "stack": false,            "steppedLine": false,            "targets": [              {                "aggregator": "sum",                "alias": "每秒接口访问量 -> [[tag_instance.id]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "sum",                "downsampleFillPolicy": "zero",                "downsampleInterval": "1s",                "filters": [                  {                    "filter": "${service.name}",                    "groupBy": false,                    "tagk": "service.name",                    "type": "literal_or"                  },                  {                    "filter": "$instanceId",                    "groupBy": true,                    "tagk": "instance.id",                    "type": "literal_or"                  }                ],                "metric": "api.call.count",                "refId": "A"              }            ],            "thresholds": [],            "timeFrom": null,            "timeShift": null,            "title": "吞吐量(QPS)",            "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              }            ]          },          {            "aliasColors": {},            "cacheTimeout": null,            "combine": {              "label": "Others",              "threshold": 0            },            "datasource": "${datasource}",            "fontSize": "80%",            "format": "short",            "id": 3,            "interval": null,            "legend": {              "percentage": true,              "show": true,              "values": true            },            "legendType": "Right side",            "links": [],            "maxDataPoints": 3,            "nullPointMode": "connected",            "pieType": "pie",            "span": 4,            "strokeWidth": 1,            "targets": [              {                "aggregator": "sum",                "alias": "[[tag_errorCode]]",                "currentFilterGroupBy": false,                "currentFilterKey": "",                "currentFilterType": "literal_or",                "currentFilterValue": "",                "downsampleAggregator": "sum",                "downsampleFillPolicy": "none",                "downsampleInterval": "all",                "filters": [                  {                    "filter": "*",                    "groupBy": true,                    "tagk": "errorCode",                    "type": "wildcard"                  },                  {                    "filter": "${service.name}",                    "groupBy": false,                    "tagk": "service.name",                    "type": "literal_or"                  },                  {                    "filter": "$instanceId",                    "groupBy": false,                    "tagk": "instance.id",                    "type": "literal_or"                  }                ],                "metric": "api.call.count",                "refId": "A"              }            ],            "title": "接口返回错误码",            "type": "grafana-piechart-panel",            "valueName": "current"          }        ],        "repeat": null,        "repeatIteration": null,        "repeatRowId": null,        "showTitle": false,        "title": "Dashboard Row",        "titleSize": "h6"      }    ],    "schemaVersion": 14,    "style": "dark",    "tags": [],    "templating": {      "list": [        {          "allValue": null,          "current": {},          "datasource": "${datasource}",          "hide": 0,          "includeAll": true,          "label": "实例",          "multi": true,          "name": "instanceId",          "options": [],          "query": "tag_values(api.call.count, instance.id, service.name=${service.name})",          "refresh": 2,          "regex": "",          "sort": 0,          "tagValuesQuery": "",          "tags": [],          "tagsQuery": "",          "type": "query",          "useTags": false        }      ]    },    "time": {      "from": "now-1h",      "to": "now"    },    "timepicker": {      "refresh_intervals": [        "1m",        "5m"      ],      "time_options": [        "5m",        "15m",        "30m",        "1h",        "6h",        "12h",        "1d",        "7d"      ]    },    "timezone": "browser",    "title": "${title}",    "version": 0  },  "overwrite": false}

效果展示:

这里写图片描述

这里写图片描述