Grafana----硬件资源监控大盘

一、 硬件资源监控大盘展示(主机名、CPU、内存、磁盘、服务应用类型)

 

二、 数据流程展示

 

三、 Telegraf

         参考《Telegraf 自动部署脚本

 

四、 Nightingale、Prometheus

        参考《夜莺监控v5.5 —— 单机版部署

 

五、 Grafana

        query配置:

 

 

        panels 代码如下:

复制代码
"panels": [
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "center",
            "displayMode": "auto",
            "filterable": true
          },
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 65
              },
              {
                "color": "red",
                "value": 85
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "CPU使用(%)"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "内存使用(%)"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "磁盘使用(%)"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "主机名"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "dark-green",
                  "mode": "continuous-BlPu"
                }
              },
              {
                "id": "custom.displayMode",
                "value": "color-background"
              },
              {
                "id": "custom.align",
                "value": "center"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 22,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 7,
      "options": {
        "footer": {
          "fields": [],
          "reducer": [
            "lastNotNull"
          ],
          "show": false
        },
        "frameIndex": 0,
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "CPU使用(%)"
          }
        ]
      },
      "pluginVersion": "8.4.5",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "CHsKN4Unz"
          },
          "exemplar": false,
          "expr": "disk_used_percent{application=~\"$application\"} - 0",
          "format": "table",
          "instant": true,
          "interval": "",
          "intervalFactor": 1,
          "legendFormat": "",
          "refId": "A"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "CHsKN4Unz"
          },
          "exemplar": false,
          "expr": "mem_used_percent{application=~\"$application\"} - 0",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "B"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "CHsKN4Unz"
          },
          "exemplar": false,
          "expr": "100 - cpu_usage_idle{cpu=\"cpu-total\",application=~\"$application\"}",
          "format": "table",
          "hide": false,
          "instant": true,
          "interval": "",
          "legendFormat": "",
          "refId": "C"
        }
      ],
      "title": "磁盘使用概览",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "Value #C": false,
              "application": true,
              "cpu": true,
              "device": true,
              "fstype": true,
              "mode": true,
              "path": true
            },
            "indexByName": {
              "Time": 0,
              "Value #A": 9,
              "Value #B": 8,
              "Value #C": 7,
              "application": 1,
              "cpu": 10,
              "device": 2,
              "fstype": 3,
              "ident": 4,
              "mode": 5,
              "path": 6
            },
            "renameByName": {
              "Value #A": "磁盘使用(%)",
              "Value #B": "内存使用(%)",
              "Value #C": "CPU使用(%)",
              "ident": "主机名"
            }
          }
        }
      ],
      "type": "table"
    }
  ],
复制代码

 

posted @   ヾ(o◕∀◕)ノヾ  阅读(404)  评论(0编辑  收藏  举报
(评论功能已被禁用)
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示