terte 发表于 2018-4-9 11:11:14

prometheus 监控 kubernetes tomcat


说明1:kubernetes环境搭建好了,没有就看这个
说明2:基于grafana-kubernetes-app监控tomcat我的另一文章
说明3:对于docker容器开启tomcat监控看完一、配置环境看完就可以了

1、添加prometheus.yaml配置(在末尾就可以了)

   - job_name: 'tomcat-pods'
   kubernetes_sd_configs:
   - role: pod
   relabel_configs:
   - source_labels:
       regex: tomcat
       action: keep
   - source_labels:
       regex: 1234
       action: keep
   - source_labels:
       action: replace
       target_label: kubernetes_pod_name

2、tomcat模板
cat ll-tomcat.json

{
"__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
],
"__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "5.0.3"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": "5.0.0"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "5.0.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": "5.0.0"
    }
],
"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": 3066,
"graphTooltip": 0,
"id": null,
"iteration": 1523075924457,
"links": [],
"panels": [
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
      "#d683ce",
      "#d683ce",
      "#d683ce"
      ],
      "datasource": "${DS_PROMETHEUS}",
      "format": "none",
      "gauge": {
      "maxValue": 100,
      "minValue": 0,
      "show": false,
      "thresholdLabels": false,
      "thresholdMarkers": true
      },
      "gridPos": {
      "h": 3,
      "w": 4,
      "x": 0,
      "y": 0
      },
      "id": 13,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
      {
          "name": "value to text",
          "value": 1
      },
      {
          "name": "range to text",
          "value": 2
      }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
      {
          "from": "null",
          "text": "N/A",
          "to": "null"
      }
      ],
      "sparkline": {
      "fillColor": "rgba(31, 118, 189, 0.18)",
      "full": false,
      "lineColor": "rgb(31, 120, 193)",
      "show": false
      },
      "tableColumn": "",
      "targets": [
      {
          "expr": "tomcat_requestcount_total{port=\"8080\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "refId": "A"
      }
      ],
      "thresholds": "",
      "title": "requestcount",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
      {
          "op": "=",
          "text": "N/A",
          "value": "null"
      }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
      "#299c46",
      "rgba(237, 129, 40, 0.89)",
      "#d44a3a"
      ],
      "datasource": "${DS_PROMETHEUS}",
      "format": "none",
      "gauge": {
      "maxValue": 100,
      "minValue": 0,
      "show": false,
      "thresholdLabels": false,
      "thresholdMarkers": true
      },
      "gridPos": {
      "h": 3,
      "w": 4,
      "x": 4,
      "y": 0
      },
      "id": 14,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
      {
          "name": "value to text",
          "value": 1
      },
      {
          "name": "range to text",
          "value": 2
      }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
      {
          "from": "null",
          "text": "N/A",
          "to": "null"
      }
      ],
      "sparkline": {
      "fillColor": "rgba(31, 118, 189, 0.18)",
      "full": false,
      "lineColor": "rgb(31, 120, 193)",
      "show": false
      },
      "tableColumn": "",
      "targets": [
      {
          "expr": "tomcat_requestcount_total{port=\"8080\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 2,
          "refId": "A"
      }
      ],
      "thresholds": "",
      "title": "Requestcount Current",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
      {
          "op": "=",
          "text": "N/A",
          "value": "null"
      }
      ],
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
      "#299c46",
      "rgba(237, 129, 40, 0.89)",
      "#d44a3a"
      ],
      "datasource": "${DS_PROMETHEUS}",
      "format": "none",
      "gauge": {
      "maxValue": 100,
      "minValue": 0,
      "show": false,
      "thresholdLabels": false,
      "thresholdMarkers": true
      },
      "gridPos": {
      "h": 3,
      "w": 4,
      "x": 8,
      "y": 0
      },
      "id": 15,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
      {
          "name": "value to text",
          "value": 1
      },
      {
          "name": "range to text",
          "value": 2
      }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
      {
          "from": "null",
          "text": "N/A",
          "to": "null"
      }
      ],
      "sparkline": {
      "fillColor": "rgba(31, 118, 189, 0.18)",
      "full": false,
      "lineColor": "rgb(31, 120, 193)",
      "show": false
      },
      "tableColumn": "",
      "targets": [
      {
          "expr": "tomcat_requestcount_total{port=\"8080\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "refId": "A"
      }
      ],
      "thresholds": "",
      "title": "RequestcountAverage",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
      {
          "op": "=",
          "text": "N/A",
          "value": "null"
      }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
      "#299c46",
      "rgba(237, 129, 40, 0.89)",
      "#d44a3a"
      ],
      "datasource": "${DS_PROMETHEUS}",
      "format": "none",
      "gauge": {
      "maxValue": 100,
      "minValue": 0,
      "show": false,
      "thresholdLabels": false,
      "thresholdMarkers": true
      },
      "gridPos": {
      "h": 3,
      "w": 4,
      "x": 12,
      "y": 0
      },
      "id": 16,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
      {
          "name": "value to text",
          "value": 1
      },
      {
          "name": "range to text",
          "value": 2
      }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
      {
          "from": "null",
          "text": "N/A",
          "to": "null"
      }
      ],
      "sparkline": {
      "fillColor": "rgba(31, 118, 189, 0.18)",
      "full": false,
      "lineColor": "rgb(31, 120, 193)",
      "show": false
      },
      "tableColumn": "",
      "targets": [
      {
          "expr": "tomcat_errorcount_total{port=\"8080\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 2,
          "refId": "A"
      }
      ],
      "thresholds": "",
      "title": "Errorcount",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
      {
          "op": "=",
          "text": "N/A",
          "value": "null"
      }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
      "#299c46",
      "rgba(237, 129, 40, 0.89)",
      "#d44a3a"
      ],
      "datasource": "${DS_PROMETHEUS}",
      "format": "bytes",
      "gauge": {
      "maxValue": 100,
      "minValue": 0,
      "show": false,
      "thresholdLabels": false,
      "thresholdMarkers": true
      },
      "gridPos": {
      "h": 3,
      "w": 4,
      "x": 16,
      "y": 0
      },
      "id": 18,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
      {
          "name": "value to text",
          "value": 1
      },
      {
          "name": "range to text",
          "value": 2
      }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
      {
          "from": "null",
          "text": "N/A",
          "to": "null"
      }
      ],
      "sparkline": {
      "fillColor": "rgba(31, 118, 189, 0.18)",
      "full": false,
      "lineColor": "rgb(31, 120, 193)",
      "show": false
      },
      "tableColumn": "",
      "targets": [
      {
          "expr": "jvm_memory_bytes_max{area=\"heap\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 2,
          "refId": "A"
      }
      ],
      "thresholds": "",
      "title": "Jvm Max Mem heap",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
      {
          "op": "=",
          "text": "N/A",
          "value": "null"
      }
      ],
      "valueName": "avg"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "fill": 1,
      "gridPos": {
      "h": 9,
      "w": 12,
      "x": 0,
      "y": 3
      },
      "id": 7,
      "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": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
      {
          "expr": "jvm_memory_bytes_used{area=\"heap\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 2,
          "legendFormat": "Heap memory that has been used",
          "refId": "A"
      },
      {
          "expr": "jvm_memory_bytes_committed{area=\"heap\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 2,
          "legendFormat": "Heap memory that has been committed",
          "refId": "B"
      }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Heap Used",
      "tooltip": {
      "shared": true,
      "sort": 0,
      "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
      "buckets": null,
      "mode": "time",
      "name": null,
      "show": true,
      "values": []
      },
      "yaxes": [
      {
          "format": "decbytes",
          "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": "${DS_PROMETHEUS}",
      "fill": 1,
      "gridPos": {
      "h": 9,
      "w": 12,
      "x": 12,
      "y": 3
      },
      "id": 8,
      "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": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
      {
          "expr": "jvm_memory_bytes_used{area=\"nonheap\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 2,
          "legendFormat": "NonHeap memory that has been used",
          "refId": "A"
      },
      {
          "expr": "jvm_memory_bytes_committed{area=\"nonheap\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 2,
          "legendFormat": "NonHeap memory that has been committed",
          "refId": "B"
      }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Mem Committed",
      "tooltip": {
      "shared": true,
      "sort": 0,
      "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
      "buckets": null,
      "mode": "time",
      "name": null,
      "show": true,
      "values": []
      },
      "yaxes": [
      {
          "format": "decbytes",
          "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": "${DS_PROMETHEUS}",
      "fill": 2,
      "gridPos": {
      "h": 7,
      "w": 12,
      "x": 0,
      "y": 12
      },
      "id": 23,
      "legend": {
      "alignAsTable": true,
      "avg": true,
      "current": true,
      "max": true,
      "min": true,
      "rightSide": false,
      "show": true,
      "sideWidth": null,
      "total": false,
      "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": true,
      "targets": [
      {
          "expr": "jvm_memory_pool_bytes_used{pool=\"PS Eden Space\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "PS Eden Space Use",
          "refId": "A"
      },
      {
          "expr": "jvm_memory_pool_bytes_committed{pool=\"PS Eden Space\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "PS Eden Space Comm",
          "refId": "B"
      }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "PS Eden Space",
      "tooltip": {
      "shared": true,
      "sort": 0,
      "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
      "buckets": null,
      "mode": "time",
      "name": null,
      "show": true,
      "values": []
      },
      "yaxes": [
      {
          "format": "decbytes",
          "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": "${DS_PROMETHEUS}",
      "fill": 2,
      "gridPos": {
      "h": 7,
      "w": 12,
      "x": 12,
      "y": 12
      },
      "id": 24,
      "legend": {
      "alignAsTable": true,
      "avg": true,
      "current": true,
      "max": true,
      "min": true,
      "rightSide": false,
      "show": true,
      "sideWidth": null,
      "total": false,
      "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": true,
      "targets": [
      {
          "expr": "jvm_memory_pool_bytes_used{pool=\"PS Survivor Space\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "PS Survivor Space Use",
          "refId": "A"
      },
      {
          "expr": "jvm_memory_pool_bytes_committed{pool=\"PS Survivor Space\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "PS Survivor Space Comm",
          "refId": "B"
      }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "PS Survivor Space",
      "tooltip": {
      "shared": true,
      "sort": 0,
      "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
      "buckets": null,
      "mode": "time",
      "name": null,
      "show": true,
      "values": []
      },
      "yaxes": [
      {
          "format": "decbytes",
          "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": "${DS_PROMETHEUS}",
      "fill": 2,
      "gridPos": {
      "h": 7,
      "w": 12,
      "x": 0,
      "y": 19
      },
      "id": 25,
      "legend": {
      "alignAsTable": true,
      "avg": true,
      "current": true,
      "max": true,
      "min": true,
      "rightSide": false,
      "show": true,
      "sideWidth": null,
      "total": false,
      "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": true,
      "targets": [
      {
          "expr": "jvm_memory_pool_bytes_used{pool=\"PS Old Gen\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "PS Old Gen Use",
          "refId": "A"
      },
      {
          "expr": "jvm_memory_pool_bytes_committed{pool=\"PS Old Gen\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "PS Old Gen Comm",
          "refId": "B"
      }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "PS Old Gen",
      "tooltip": {
      "shared": true,
      "sort": 0,
      "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
      "buckets": null,
      "mode": "time",
      "name": null,
      "show": true,
      "values": []
      },
      "yaxes": [
      {
          "format": "decbytes",
          "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": "${DS_PROMETHEUS}",
      "fill": 2,
      "gridPos": {
      "h": 7,
      "w": 12,
      "x": 12,
      "y": 19
      },
      "id": 20,
      "legend": {
      "alignAsTable": true,
      "avg": true,
      "current": true,
      "max": true,
      "min": true,
      "rightSide": false,
      "show": true,
      "sideWidth": null,
      "total": false,
      "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": true,
      "targets": [
      {
          "expr": "jvm_memory_pool_bytes_used{pool=\"Code Cache\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "Code Cache Use",
          "refId": "A"
      },
      {
          "expr": "jvm_memory_pool_bytes_committed{pool=\"Code Cache\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "Code Cache Comm",
          "refId": "B"
      }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Code Cache",
      "tooltip": {
      "shared": true,
      "sort": 0,
      "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
      "buckets": null,
      "mode": "time",
      "name": null,
      "show": true,
      "values": []
      },
      "yaxes": [
      {
          "format": "decbytes",
          "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": "${DS_PROMETHEUS}",
      "fill": 2,
      "gridPos": {
      "h": 7,
      "w": 12,
      "x": 0,
      "y": 26
      },
      "id": 21,
      "legend": {
      "alignAsTable": true,
      "avg": true,
      "current": true,
      "max": true,
      "min": true,
      "rightSide": false,
      "show": true,
      "sideWidth": null,
      "total": false,
      "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": true,
      "targets": [
      {
          "expr": "jvm_memory_pool_bytes_used{pool=\"Metaspace\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "Metaspace Use",
          "refId": "A"
      },
      {
          "expr": "jvm_memory_pool_bytes_committed{pool=\"Metaspace\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "Metaspace Comm",
          "refId": "B"
      }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Metaspace",
      "tooltip": {
      "shared": true,
      "sort": 0,
      "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
      "buckets": null,
      "mode": "time",
      "name": null,
      "show": true,
      "values": []
      },
      "yaxes": [
      {
          "format": "decbytes",
          "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": "${DS_PROMETHEUS}",
      "fill": 2,
      "gridPos": {
      "h": 7,
      "w": 12,
      "x": 12,
      "y": 26
      },
      "id": 22,
      "legend": {
      "alignAsTable": true,
      "avg": true,
      "current": true,
      "max": true,
      "min": true,
      "rightSide": false,
      "show": true,
      "sideWidth": null,
      "total": false,
      "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": true,
      "targets": [
      {
          "expr": "jvm_memory_pool_bytes_used{pool=\"Compressed Class Space\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "Compressed Class Space Use",
          "refId": "A"
      },
      {
          "expr": "jvm_memory_pool_bytes_committed{pool=\"Compressed Class Space\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "Compressed Class Space Comm",
          "refId": "B"
      }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Compressed Class Space",
      "tooltip": {
      "shared": true,
      "sort": 0,
      "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
      "buckets": null,
      "mode": "time",
      "name": null,
      "show": true,
      "values": []
      },
      "yaxes": [
      {
          "format": "decbytes",
          "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": "${DS_PROMETHEUS}",
      "fill": 1,
      "gridPos": {
      "h": 10,
      "w": 24,
      "x": 0,
      "y": 33
      },
      "id": 17,
      "legend": {
      "alignAsTable": true,
      "avg": true,
      "current": false,
      "max": true,
      "min": true,
      "rightSide": 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,
      "stack": false,
      "steppedLine": false,
      "targets": [
      {
          "expr": "jvm_gc_collection_seconds_count{gc=\"PS Scavenge\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 1,
          "legendFormat": "PS Scavenge",
          "refId": "A"
      },
      {
          "expr": "jvm_gc_collection_seconds_sum{gc=\"PS Scavenge\",kubernetes_pod_name=~\"$instance\"} ",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 1,
          "legendFormat": "PS Scavenge SUM",
          "refId": "B"
      },
      {
          "expr": "jvm_gc_collection_seconds_count{gc=\"PS MarkSweep\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 1,
          "legendFormat": "PS MarkSweep",
          "refId": "C"
      },
      {
          "expr": "jvm_gc_collection_seconds_sum{gc=\"PS MarkSweep\",kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 1,
          "legendFormat": "PS MarkSweep SUM",
          "refId": "D"
      }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Count Gc",
      "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": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
      }
      ]
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "fill": 1,
      "gridPos": {
      "h": 10,
      "w": 24,
      "x": 0,
      "y": 43
      },
      "id": 6,
      "legend": {
      "alignAsTable": true,
      "avg": true,
      "current": true,
      "max": true,
      "min": true,
      "rightSide": 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,
      "stack": false,
      "steppedLine": false,
      "targets": [
      {
          "expr": "jvm_threads_current{kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "Current thread connection number",
          "refId": "A"
      },
      {
          "expr": "jvm_threads_started_total{kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 2,
          "legendFormat": "Total number of threads",
          "refId": "B"
      },
      {
          "expr": "jvm_threads_daemon{kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "daemon",
          "refId": "C"
      },
      {
          "expr": "jvm_threads_peak{kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "Thread peak",
          "refId": "D"
      },
      {
          "expr": "jvm_threads_deadlocked{kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "deadlocked",
          "refId": "E"
      },
      {
          "expr": "jvm_threads_deadlocked_monitor{kubernetes_pod_name=~\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "deadlocked_monitor",
          "refId": "F"
      }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "threads",
      "tooltip": {
      "shared": true,
      "sort": 0,
      "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
      "buckets": null,
      "mode": "time",
      "name": null,
      "show": true,
      "values": []
      },
      "yaxes": [
      {
          "format": "none",
          "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": "${DS_PROMETHEUS}",
      "fill": 1,
      "gridPos": {
      "h": 10,
      "w": 24,
      "x": 0,
      "y": 53
      },
      "id": 11,
      "legend": {
      "alignAsTable": true,
      "avg": true,
      "current": true,
      "max": true,
      "min": true,
      "rightSide": 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,
      "stack": false,
      "steppedLine": false,
      "targets": [
      {
          "expr": "jvm_classes_loaded{kubernetes_pod_name=\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "Classes that have been loaded",
          "refId": "A"
      },
      {
          "expr": "jvm_classes_loaded_total{kubernetes_pod_name=\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "The sum of the load classes",
          "refId": "B"
      },
      {
          "expr": "jvm_classes_unloaded_total{kubernetes_pod_name=\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "class that has been uninstalled",
          "refId": "C"
      }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Classes",
      "tooltip": {
      "shared": true,
      "sort": 0,
      "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
      "buckets": null,
      "mode": "time",
      "name": null,
      "show": true,
      "values": []
      },
      "yaxes": [
      {
          "format": "none",
          "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": "${DS_PROMETHEUS}",
      "fill": 1,
      "gridPos": {
      "h": 7,
      "w": 24,
      "x": 0,
      "y": 63
      },
      "id": 19,
      "legend": {
      "alignAsTable": true,
      "avg": true,
      "current": false,
      "max": true,
      "min": true,
      "rightSide": false,
      "show": true,
      "total": true,
      "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
      {
          "alias": "output",
          "transform": "negative-Y"
      }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
      {
          "expr": "sum(irate(tomcat_bytesreceived_total{port=\"8080\",protocol=\"http-nio\",kubernetes_pod_name=~\"$instance\"}))",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 2,
          "legendFormat": "input",
          "refId": "A"
      },
      {
          "expr": "sum(irate(tomcat_bytessent_total{port=\"8080\",protocol=\"http-nio\",kubernetes_pod_name=~\"$instance\"}))",
          "format": "time_series",
          "hide": false,
          "intervalFactor": 2,
          "legendFormat": "output",
          "refId": "B"
      }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Network",
      "tooltip": {
      "shared": true,
      "sort": 0,
      "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
      "buckets": null,
      "mode": "time",
      "name": null,
      "show": true,
      "values": []
      },
      "yaxes": [
      {
          "format": "Bps",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
      },
      {
          "format": "decbytes",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
      }
      ]
    }
],
"refresh": "30s",
"schemaVersion": 16,
"style": "dark",
"tags": [
    "JVM",
    "tomcat"
],
"templating": {
    "list": [
      {
      "allValue": "",
      "current": {},
      "datasource": "${DS_PROMETHEUS}",
      "hide": 0,
      "includeAll": true,
      "label": "Instance",
      "multi": false,
      "name": "instance",
      "options": [],
      "query": "label_values(jvm_memory_bytes_max,kubernetes_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": "tomcat",
"uid": "U3EWy1imz",
"version": 5
}

3、OK看图





页: [1]
查看完整版本: prometheus 监控 kubernetes tomcat