Grafana-自定义界面
本文最后更新于 822 天前,其中的信息可能已经有所发展或是发生改变。

Grafana-自定义界面

主要三个模块

  1. 服务器资源
  2. 服务用到中间件(mysql,nginx,nacos)
  3. java服务列表

下面是效果图

image-20221020093639829

引入json

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "description": "test dashboard",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 28,
  "iteration": 1666229703720,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "panels": [],
      "title": "资源总览:实例:$instance",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "jQJdz8iVk"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "decimals": 1,
          "mappings": [],
          "max": 100,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "启动(天)"
            },
            "properties": [
              {
                "id": "unit",
                "value": "none"
              },
              {
                "id": "custom.width",
                "value": 90
              },
              {
                "id": "decimals"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "总内存"
            },
            "properties": [
              {
                "id": "unit",
                "value": "bytes"
              },
              {
                "id": "custom.width",
                "value": 67
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "blue",
                  "mode": "fixed"
                }
              },
              {
                "id": "custom.displayMode",
                "value": "color-text"
              },
              {
                "id": "decimals",
                "value": 0
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "总核数"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 60
              },
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-YlRd"
                }
              },
              {
                "id": "custom.displayMode",
                "value": "color-text"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "环境"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 40
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "IP"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 150
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "5分钟负载"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 88
              },
              {
                "id": "decimals",
                "value": 2
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-GrYlRd"
                }
              },
              {
                "id": "custom.displayMode",
                "value": "color-text"
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "/.*使用率.*/"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percent"
              },
              {
                "id": "custom.displayMode",
                "value": "gradient-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-GrYlRd"
                }
              },
              {
                "id": "custom.width",
                "value": 120
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "磁盘最大读取"
            },
            "properties": [
              {
                "id": "unit",
                "value": "bytes"
              },
              {
                "id": "custom.displayMode",
                "value": "color-background"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "orange",
                      "value": 10485760
                    },
                    {
                      "color": "red",
                      "value": 20485760
                    }
                  ]
                }
              },
              {
                "id": "custom.width",
                "value": 120
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "磁盘最大写入"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 120
              },
              {
                "id": "unit",
                "value": "bytes"
              },
              {
                "id": "custom.displayMode",
                "value": "color-background"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "orange",
                      "value": 10485760
                    },
                    {
                      "color": "red",
                      "value": 20485760
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "TCP连接数"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "color-background"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "#EAB839",
                      "value": 1000
                    },
                    {
                      "color": "red",
                      "value": 2000
                    }
                  ]
                }
              },
              {
                "id": "custom.width",
                "value": 88
              },
              {
                "id": "decimals"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "待关闭的TCP连接数"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "color-text"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "orange",
                      "value": 5000
                    },
                    {
                      "color": "red",
                      "value": 20000
                    }
                  ]
                }
              },
              {
                "id": "custom.width",
                "value": 150
              },
              {
                "id": "decimals"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "下载带宽"
            },
            "properties": [
              {
                "id": "unit",
                "value": "binbps"
              },
              {
                "id": "custom.displayMode",
                "value": "color-background-solid"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "blue",
                      "value": 31457280
                    },
                    {
                      "color": "yellow",
                      "value": 52428800
                    },
                    {
                      "color": "red",
                      "value": 104857600
                    }
                  ]
                }
              },
              {
                "id": "decimals"
              },
              {
                "id": "custom.width",
                "value": 88
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "上传带宽"
            },
            "properties": [
              {
                "id": "unit",
                "value": "binbps"
              },
              {
                "id": "custom.displayMode",
                "value": "color-background-solid"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "blue",
                      "value": 31457280
                    },
                    {
                      "color": "#EAB839",
                      "value": 52428800
                    },
                    {
                      "color": "red",
                      "value": 104857600
                    }
                  ]
                }
              },
              {
                "id": "custom.width",
                "value": 98
              },
              {
                "id": "decimals"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "操作系统"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 87
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 14,
        "w": 24,
        "x": 0,
        "y": 1
      },
      "id": 4,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "frameIndex": 1,
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "磁盘分区使用率"
          }
        ]
      },
      "pluginVersion": "8.5.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "sum(time() - node_boot_time_seconds{})by(ip)/86400",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "运行时间",
          "range": false,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "node_memory_MemTotal_bytes - 0",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "总内存",
          "range": false,
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "count(node_cpu_seconds_total{mode='system'}) by (ip)",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "总核数",
          "range": false,
          "refId": "C"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "max(node_load5)by(ip)",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "5分钟负载",
          "range": false,
          "refId": "D"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "(1 - avg(rate(node_cpu_seconds_total{mode=\"idle\"}[$interval])) by (ip)) * 100",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "CPU使用率",
          "range": false,
          "refId": "E"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "max(1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes))by(ip)* 100",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "内存使用率",
          "range": false,
          "refId": "F"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "max((node_filesystem_size_bytes{fstype=~\"ext.?|xfs|rootfs\"}-node_filesystem_free_bytes{fstype=~\"ext.?|xfs\"}) *100/(node_filesystem_avail_bytes {fstype=~\"ext.?|xfs\"}+(node_filesystem_size_bytes{fstype=~\"ext.?|xfs\"}-node_filesystem_free_bytes{fstype=~\"ext.?|xfs\"})))by(ip)",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "磁盘分区使用率",
          "range": false,
          "refId": "G"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "max(rate(node_disk_read_bytes_total[$interval])) by (ip)",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "磁盘最大读取",
          "range": false,
          "refId": "H"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "max(rate(node_disk_written_bytes_total{}[$interval])) by (ip)",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "磁盘最大写入",
          "range": false,
          "refId": "I"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "max(node_netstat_Tcp_CurrEstab)by(ip)",
          "format": "table",
          "hide": true,
          "instant": true,
          "legendFormat": "tcp连接数",
          "range": false,
          "refId": "J"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "max(node_sockstat_TCP_tw)by(ip) - 0",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "待关闭的TCP连接数",
          "range": false,
          "refId": "K"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "max(irate(node_network_receive_bytes_total{}[$interval])*8) by (ip)",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "下载带宽",
          "range": false,
          "refId": "L"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "max(irate(node_network_transmit_bytes_total{}[$interval])*8) by (ip)",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "上传带宽",
          "range": false,
          "refId": "M"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "(max(node_filefd_allocated)by(ip)/max(node_filefd_maximum)by(ip)) *100",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "文件数使用率",
          "range": false,
          "refId": "N"
        }
      ],
      "title": "服务器资源总览表【主机总数:$total】",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "ip",
                "Value #A",
                "os",
                "Value #B",
                "Value #C",
                "Value #D",
                "Value #E",
                "Value #F",
                "Value #G",
                "Value #H",
                "Value #I",
                "Value #K",
                "Value #L",
                "Value #M",
                "Value #N"
              ]
            }
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {
              "Value #A": 2,
              "Value #B": 3,
              "Value #C": 4,
              "Value #D": 5,
              "Value #E": 6,
              "Value #F": 7,
              "Value #G": 8,
              "Value #H": 10,
              "Value #I": 11,
              "Value #K": 12,
              "Value #L": 13,
              "Value #M": 14,
              "Value #N": 9,
              "ip": 0,
              "os": 1
            },
            "renameByName": {
              "Value #A": "启动(天)",
              "Value #B": "总内存",
              "Value #C": "总核数",
              "Value #D": "5分钟负载",
              "Value #E": "CPU使用率",
              "Value #F": "内存使用率",
              "Value #G": "磁盘分区使用率",
              "Value #H": "磁盘最大读取",
              "Value #I": "磁盘最大写入",
              "Value #J": "TCP连接数",
              "Value #K": "待关闭的TCP连接数",
              "Value #L": "下载带宽",
              "Value #M": "上传带宽",
              "Value #N": "文件数使用率",
              "env": "环境",
              "ip": "IP",
              "job": "",
              "os": "操作系统"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 15
      },
      "id": 10,
      "panels": [],
      "title": "服务中间件状态 for $instance",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "jQJdz8iVk"
      },
      "description": "**MySQL Uptime**\n\nThe amount of time since the last restart of the MySQL server process.",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 1,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "orange",
                "value": 300
              },
              {
                "color": "green",
                "value": 3600
              }
            ]
          },
          "unit": "s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 0,
        "y": 16
      },
      "id": 12,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "8.5.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "mysql_global_status_uptime{ip=\"$instance\"}",
          "format": "time_series",
          "hide": false,
          "instant": false,
          "interval": "5m",
          "legendFormat": "",
          "range": true,
          "refId": "A"
        }
      ],
      "title": "MySQL Uptime",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "jQJdz8iVk"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "options": {
                "0": {
                  "color": "red",
                  "index": 1,
                  "text": "DOWN"
                },
                "1": {
                  "color": "green",
                  "index": 0,
                  "text": "UP"
                }
              },
              "type": "value"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 3,
        "x": 3,
        "y": 16
      },
      "id": 14,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "8.5.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "expr": "mysql_up{ip=\"$instance\"}",
          "refId": "A"
        }
      ],
      "title": "Mysql Status",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "jQJdz8iVk"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "options": {
                "from": 1,
                "result": {
                  "color": "green",
                  "index": 0,
                  "text": "UP"
                },
                "to": 99999
              },
              "type": "range"
            },
            {
              "options": {
                "from": 0,
                "result": {
                  "color": "red",
                  "index": 1,
                  "text": "DOWN"
                },
                "to": 0
              },
              "type": "range"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 4,
        "x": 6,
        "y": 16
      },
      "id": 18,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "8.5.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "expr": "nacos_monitor{name=\"configCount\",ip=\"$instance\"}",
          "refId": "A"
        }
      ],
      "title": "Nacos Status",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "jQJdz8iVk"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "options": {
                "0": {
                  "color": "red",
                  "index": 1,
                  "text": "DOWN"
                },
                "1": {
                  "color": "green",
                  "index": 0,
                  "text": "UP"
                }
              },
              "type": "value"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 2,
        "w": 4,
        "x": 10,
        "y": 16
      },
      "id": 20,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "8.5.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "expr": "nginx_up{ip=~\"$instance\"}",
          "refId": "A"
        }
      ],
      "title": "NGINX Status",
      "type": "stat"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 18
      },
      "id": 6,
      "panels": [],
      "title": "程序服务列表",
      "type": "row"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "jQJdz8iVk"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "decimals": 1,
          "mappings": [],
          "max": 100,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "启动时间"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dateTimeAsIso"
              },
              {
                "id": "custom.width",
                "value": 188
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "运行状态"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "0": {
                        "color": "red",
                        "index": 1,
                        "text": "DOWN"
                      },
                      "1": {
                        "color": "green",
                        "index": 2,
                        "text": "UP"
                      },
                      "null": {
                        "color": "red",
                        "index": 0,
                        "text": "DOWN"
                      }
                    },
                    "type": "value"
                  }
                ]
              },
              {
                "id": "custom.displayMode",
                "value": "color-background"
              },
              {
                "id": "custom.width",
                "value": 100
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "运行(天)"
            },
            "properties": [
              {
                "id": "unit",
                "value": "none"
              },
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "custom.width",
                "value": 88
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "连接端口"
            },
            "properties": [
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "custom.width",
                "value": 88
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "jvm堆内存使用率"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percent"
              },
              {
                "id": "custom.displayMode",
                "value": "gradient-gauge"
              },
              {
                "id": "color",
                "value": {
                  "mode": "continuous-GrYlRd"
                }
              },
              {
                "id": "custom.width",
                "value": 150
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "当前启动的线程数"
            },
            "properties": [
              {
                "id": "decimals"
              },
              {
                "id": "custom.displayMode",
                "value": "color-text"
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 500
                    },
                    {
                      "color": "orange",
                      "value": 1000
                    },
                    {
                      "color": "red",
                      "value": 2000
                    }
                  ]
                }
              },
              {
                "id": "custom.width",
                "value": 188
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "服务名"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 288
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 24,
        "x": 0,
        "y": 19
      },
      "id": 8,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true
      },
      "pluginVersion": "8.5.9",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "process_start_time_seconds{job=\"java\",ip=\"$instance\"}*1000",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "启动时间",
          "range": false,
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "up{job=\"java\",ip=\"$instance\"}",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "状态",
          "range": false,
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "(time() - process_start_time_seconds{job=\"java\",ip=\"$instance\"})/86400",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "运行时间",
          "range": false,
          "refId": "D"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "max(tomcat_connector_port{job=\"java\",ip=\"$instance\"})by(service,ip)",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "连接端口",
          "range": false,
          "refId": "C"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "jvm_memory_bytes_used{area=\"heap\",job=\"java\",ip=\"$instance\"} / jvm_memory_bytes_max{area=\"heap\",job=\"java\",ip=\"$instance\"} * 100",
          "format": "table",
          "hide": false,
          "instant": true,
          "legendFormat": "jvm堆内存使用率",
          "range": false,
          "refId": "E"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "jQJdz8iVk"
          },
          "editorMode": "code",
          "exemplar": false,
          "expr": "jvm_threads_current{job=\"java\",ip=\"$instance\"}",
          "format": "table",
          "hide": true,
          "instant": true,
          "legendFormat": "当前启动的线程数",
          "range": false,
          "refId": "F"
        }
      ],
      "title": "物联网服务列表【服务总数:$jvm_total】",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "service",
                "Value #A",
                "Value #B",
                "Value #D",
                "Value #C",
                "Value #E"
              ]
            }
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "service": false
            },
            "indexByName": {
              "Value #A": 1,
              "Value #B": 2,
              "Value #C": 4,
              "Value #D": 3,
              "service": 0
            },
            "renameByName": {
              "Value": "启动时间",
              "Value #A": "启动时间",
              "Value #B": "运行状态",
              "Value #C": "连接端口",
              "Value #D": "运行(天)",
              "Value #E": "jvm堆内存使用率",
              "Value #F": "当前启动的线程数",
              "service": "服务名"
            }
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": "",
  "schemaVersion": 36,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "auto": false,
        "auto_count": 30,
        "auto_min": "10s",
        "current": {
          "selected": false,
          "text": "30s",
          "value": "30s"
        },
        "hide": 0,
        "label": "间隔",
        "name": "interval",
        "options": [
          {
            "selected": true,
            "text": "30s",
            "value": "30s"
          },
          {
            "selected": false,
            "text": "1m",
            "value": "1m"
          },
          {
            "selected": false,
            "text": "5m",
            "value": "5m"
          },
          {
            "selected": false,
            "text": "10m",
            "value": "10m"
          },
          {
            "selected": false,
            "text": "30m",
            "value": "30m"
          },
          {
            "selected": false,
            "text": "1h",
            "value": "1h"
          },
          {
            "selected": false,
            "text": "6h",
            "value": "6h"
          },
          {
            "selected": false,
            "text": "12h",
            "value": "12h"
          },
          {
            "selected": false,
            "text": "1d",
            "value": "1d"
          },
          {
            "selected": false,
            "text": "7d",
            "value": "7d"
          },
          {
            "selected": false,
            "text": "14d",
            "value": "14d"
          }
        ],
        "query": "30s,1m,5m,10m,30m,1h,6h,12h,1d,7d,14d",
        "queryValue": "",
        "refresh": 2,
        "skipUrlSync": false,
        "type": "interval"
      },
      {
        "current": {
          "selected": true,
          "text": "10.80.210.85",
          "value": "10.80.210.85"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "jQJdz8iVk"
        },
        "definition": "label_values(node_uname_info,ip)",
        "hide": 0,
        "includeAll": false,
        "label": "IP",
        "multi": false,
        "name": "instance",
        "options": [],
        "query": {
          "query": "label_values(node_uname_info,ip)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 5,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": "12",
          "value": "12"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "jQJdz8iVk"
        },
        "definition": "query_result(count(node_uname_info{}))",
        "hide": 2,
        "includeAll": false,
        "label": "主机数",
        "multi": false,
        "name": "total",
        "options": [],
        "query": {
          "query": "query_result(count(node_uname_info{}))",
          "refId": "StandardVariableQuery"
        },
        "refresh": 2,
        "regex": "/{} (.*) .*/",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": "5",
          "value": "5"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "jQJdz8iVk"
        },
        "definition": "query_result(count(jvm_info{job=\"java\",ip=\"$instance\"}))",
        "hide": 2,
        "includeAll": false,
        "label": "jvm主机数",
        "multi": false,
        "name": "jvm_total",
        "options": [],
        "query": {
          "query": "query_result(count(jvm_info{job=\"java\",ip=\"$instance\"}))",
          "refId": "StandardVariableQuery"
        },
        "refresh": 2,
        "regex": "/{} (.*) .*/",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "browser",
  "title": "test-no-env dashboard",
  "uid": "cxAH_QI4k",
  "version": 23,
  "weekStart": ""
}
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇