Grafana-prometheus数据源之集群内java服务的JVM监控

本文介绍了如何使用Grafana Prometheus数据源监控Java服务的JVM,包括展示监控效果图,详细阐述参数配置步骤,并提供了JSON配置示例。
摘要由CSDN通过智能技术生成

效果图

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

参数设置

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

JSON

{
   
  "annotations": {
   
    "list": [
      {
   
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Dashboard for JVM metrics with Prometheus / JMX Exporter",
  "editable": true,
  "gnetId": 3457,
  "graphTooltip": 0,
  "id": 361,
  "iteration": 1664507157766,
  "links": [],
  "panels": [
    {
   
      "collapsed": true,
      "datasource": null,
      "gridPos": {
   
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 36,
      "panels": [
        {
   
          "aliasColors": {
   },
          "bars": false,
          "cacheTimeout": null,
          "dashLength": 10,
          "dashes": false,
          "datasource": "prometheus-china-prod-k8s",
          "description": "",
          "fieldConfig": {
   
            "defaults": {
   },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
   
            "h": 8,
            "w": 24,
            "x": 0,
            "y": 1
          },
          "hiddenSeries": false,
          "id": 39,
          "interval": null,
          "legend": {
   
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "options": {
   
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "7.5.10",
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [
            {
   
              "$$hashKey": "object:588",
              "alias": "java-cash-loan-api-5c87867dc6-vdmhw",
              "yaxis": 1
            }
          ],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
   
              "exemplar": true,
              "expr": "irate(container_cpu_usage_seconds_total{container=~\"$container\", container!=\"POD\", image!=\"\"}[1m])",
              "hide": false,
              "instant": false,
              "interval": "",
              "legendFormat": "{
   { pod }}",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Cpu Usage All Pods",
          "tooltip": {
   
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
   
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
   
              "$$hashKey": "object:120",
              "decimals": 2,
              "format": "none",
              "label": "vCpu",
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
   
              "$$hashKey": "object:121",
              "format": "none",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ],
          "yaxis": {
   
            "align": false,
            "alignLevel": null
          }
        },
        {
   
          "aliasColors": {
   },
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "prometheus-china-prod-k8s",
          "fieldConfig": {
   
            "defaults": {
   },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
   
            "h": 9,
            "w": 12,
            "x": 0,
            "y": 9
          },
          "hiddenSeries": false,
          "id": 32,
          "legend": {
   
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "options": {
   
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "7.5.10",
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [
            {
   
              "alias": "GC次数:ConcurrentMarkSweep",
              "yaxis": 2
            },
            {
   
              "alias": "GC次数:ParNew",
              "yaxis": 2
            }
          ],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
   
              "exemplar": true,
              "expr": "avg(irate(container_cpu_usage_seconds_total{container=~\"$container\", container!=\"POD\", image!=\"\"}[1m])) by (container)",
              "format": "time_series",
              "hide": false,
              "interval": "",
              "intervalFactor": 1,
              "legendFormat": "usage",
              "refId": "A"
            },
            {
   
              "exemplar": true,
              "expr": "avg(irate(container_cpu_cfs_throttled_seconds_total{container=~\"$container\", container!=\"POD\", image!=\"\"}[1m])) by (container)",
              "format": "time_series",
              "hide": false,
              "interval": "",
              "intervalFactor": 1,
              "legendFormat": "throttled",
              "refId": "B"
            },
            {
   
              "exemplar": true,
              "expr": "avg(kube_pod_container_resource_requests_cpu_cores{container=~\"$container\"}) by (container)",
              "format": "time_series",
              "hide": false,
              "interval": "",
              "intervalFactor": 1,
              "legendFormat": "requests",
              "refId": "C"
            },
            {
   
              "exemplar": true,
              "expr": "avg(kube_pod_container_resource_limits_cpu_cores{container=~\"$container\"}) by (container)",
              "format": "time_series",
              "hide": false,
              "interval": "",
              "intervalFactor": 1,
              "legendFormat": "limits",
              "refId": "D"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "CPU Usage",
          "tooltip": {
   
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
   
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
   
              "$$hashKey": "object:368",
              "format": "none",
              "label": "vCpu",
              "logBase": 1,
              "max": null,
              "min": "0",
              "show": true
            },
            {
   
              "$$hashKey": "object:369",
              "format": "none",
              "label": "GC次数",
              "logBase": 1,
              "max": null,
              "min": "0",
              "show": false
            }
          ],
          "yaxis": {
   
            "align": false,
            "alignLevel": null
          }
        },
        {
   
          "aliasColors": {
   },
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "prometheus-china-prod-k8s",
          "fieldConfig": {
   
            "defaults": {
   },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
   
            "h": 9,
            "w": 12,
            "x": 12,
            "y": 9
          },
          "hiddenSeries": false,
          "id": 38,
          "legend": {
   
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "options": {
   
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "7.5.10",
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [
            {
   
              "alias": "GC次数:ConcurrentMarkSweep",
              "yaxis": 2
            },
            {
   
              "alias": "GC次数:ParNew",
              "yaxis": 2
            }
          ],
          "spaceLength": 10,
          "stack": true,
          "steppedLine": false,
          "targets": [
            {
   
              "exemplar": true,
              "expr": "avg(jvm_memory_pool_bytes_used{container=~\"$container\",endpoint!=\"jmx\"}) by (pool)",
              "format": "time_series",
              "hide": false,
              "interval": "",
              "intervalFactor": 1,
              "legendFormat": "{
   { pool }}",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Memory Pool Used",
          "tooltip": {
   
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
   
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
   
              "$$hashKey": "object:368",
              "format": "bytes",
              "label": "",
              "logBase": 1,
              "max": null,
              "min": "0",
              "show": true
            },
            {
   
              "$$hashKey": "object:369",
              "format": "none",
              "label": "GC次数",
              "logBase": 1,
              "max": null,
              "min": "0",
              "show": false
            }
          ],
          "yaxis": {
   
            "align": false,
            "alignLevel": null
          }
        },
        {
   
          "aliasColors": {
   },
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "prometheus-china-prod-k8s",
          "fieldConfig": {
   
            "defaults": {
   },
            "overrides": []
          },
          "fill": 1,
          "fillGradient": 0,
          "gridPos": {
   
            "h": 9,
            "w": 24,
            "x": 0,
            "y": 18
          },
          "hiddenSeries": false,
          "id": 37,
          "legend": {
   
            "avg"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

鬼刺

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值