主机监控之CPU、内存、磁盘、网络

本文介绍了如何进行主机监控,重点关注CPU、内存、磁盘和网络的监控。通过提供的基础模板,你可以快速将这些监控项集成到你的系统中,无需深入理解其实现细节。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

将下面的内容复制粘贴到主机监控基础模板 "rows":[] 中,作为列表的三个元素即可。建议先不要考虑这些监控项是怎么做出来的,先用起来。

{
    "collapse": false, 
    "height": 151, 
    "panels": [
        {
            "cacheTimeout": null, 
            "colorBackground": false, 
            "colorValue": true, 
            "colors": [
                "rgba(50, 172, 45, 0.97)", 
                "rgba(237, 129, 40, 0.89)", 
                "rgba(245, 54, 54, 0.9)"
            ], 
            "datasource": "${DS_PROMETHEUS}", 
            "decimals": null, 
            "description": "Busy state of all CPU cores together", 
            "format": "percent", 
            "gauge": {
                "maxValue": 100, 
                "minValue": 0, 
                "show": true, 
                "thresholdLabels": false, 
                "thresholdMarkers": true
            }, 
            "id": 20, 
            "interval": null, 
            "links": [ ], 
            "mappingType": 1, 
            "mappingTypes": [
                {
                    "name": "value to text", 
                    "value": 1
                }, 
                {
                    "name": "range to text", 
                    "value": 2
                }
            ], 
            "maxDataPoints": 100, 
            "minSpan": 1, 
            "nullPointMode": "null", 
            "nullText": null, 
            "postfix": "", 
            "postfixFontSize": "50%", 
            "prefix": "", 
            "prefixFontSize": "50%", 
            "rangeMaps": [
                {
                    "from": "null", 
                    "text": "N/A", 
                    "to": "null"
                }
            ], 
            "span": 2, 
            "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)", 
                "full": false, 
                "lineColor": "rgb(31, 120, 193)", 
                "show": true
            }, 
            "tableColumn": "", 
            "targets": [
                {
                    "expr": "(((count(count(node_cpu_seconds_total{instance=~\"$node:$port\",job=~\"$job\"}) by (cpu))) - avg(sum by (mode)(irate(node_cpu_seconds_total{mode='idle',instance=~\"$node:$port\",job=~\"$job\"}[5m])))) * 100) / count(count(node_cpu_seconds_total{instance=~\"$node:$port\",job=~\"$job\"}) by (cpu))", 
                    "hide": false, 
                    "intervalFactor": 1, 
                    "legendFormat": "", 
                    "refId": "A", 
                    "step": 900
                }
            ], 
            "thresholds": "85,95", 
            "title": "CPU Busy", 
            "type": "singlestat", 
            "valueFontSize": "80%", 
            "valueMaps": [
                {
                    "op": "=", 
                    "text": "N/A", 
                    "value": "null"
                }
            ], 
            "valueName": "current"
        }, 
        {
            "cacheTimeout": null, 
            "colorBackground": false, 
            "colorValue": true, 
            "colors": [
                "rgba(50, 172, 45, 0.97)", 
                "rgba(237, 129, 40, 0.89)", 
                "rgba(245, 54, 54, 0.9)"
            ], 
            "datasource": "${DS_PROMETHEUS}", 
            "decimals": 0, 
            "description": "Non available RAM memory", 
            "format": "percent", 
            "gauge": {
                "maxValue": 100, 
                "minValue": 0, 
                "show": true, 
                "thresholdLabels": false, 
                "thresholdMarkers": true
            }, 
            "hideTimeOverride": false, 
            "id": 16, 
            "interval": null, 
            "links": [ ], 
            "mappingType": 1, 
            "mappingTypes": [
                {
                    "name": "value to text", 
                    "value": 1
                }, 
                {
                    "name": "range to text", 
                    "value": 2
                }
            ], 
            "maxDataPoints": 100, 
            "minSpan": 2, 
            "nullPointMode": "null", 
            "nullText": null, 
            "postfix": "", 
            "postfixFontSize": "50%", 
            "prefix": "", 
            "prefixFontSize": "50%", 
            "rangeMaps": [
                {
                    "from": "null", 
                    "text": "N/A", 
                    "to": "null"
                }
            ], 
            "span": 2, 
            "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)", 
                "full": false, 
                "lineColor": "rgb(31, 120, 193)", 
                "show": true
            }, 
            "tableColumn": "", 
            "targets": [
                {
                    "expr": "((node_memory_MemTotal_bytes{instance=~\"$node:$port\",job=~\"$job\"} - node_memory_MemFree_bytes{instance=~\"$node:$port\",job=~\"$job\"}) / (node_memory_MemTotal_bytes{instance=~\"$node:$port\",job=~\"$job\"} )) * 100", 
                    "format": "time_series", 
                    "hide": true, 
                    "intervalFactor": 1, 
                    "refId": "A", 
                    "step": 900
                }, 
                {
                    "expr": "100 - ((node_memory_MemAvailable_bytes{instance=~\"$node:$port\",job=~\"$job\"} * 100) / node_memory_MemTotal_bytes{instance=~\"$node:$port\",job=~\"$job\"})", 
                    "format": "time_series", 
                    "hide": false, 
                    "intervalFactor": 1, 
                    "refId": "B", 
                    "step": 900
                }
            ], 
            "thresholds": "80,90", 
            "title": "Used RAM Memory", 
            "type": "singlestat", 
            "valueFontSize": "80%", 
            "valueMaps": [ ], 
            "valueName": "current"
        }, 
        {
            "cacheTimeout": null, 
            "colorBackground": false, 
            "colorValue": true, 
            "colors": [
                "rgba(50, 172, 45, 0.97)", 
                "rgba(237, 129, 40, 0.89)", 
                "rgba(245, 54, 54, 0.9)"
            ], 
            "datasource": "${DS_PROMETHEUS}", 
            "decimals": null, 
            "description": "Used Swap", 
            "format": "percent", 
            "gauge": {
                "maxValue": 100, 
                "minValue": 0, 
                "show": true, 
                "thresholdLabels": false, 
                "thresholdMarkers": true
            }, 
            "id": 21, 
            "interval": null, 
            "links": [ ], 
            "mappingType": 1, 
            "mappingTypes": [
                {
                    "name": "value to text", 
                    "value": 1
                }, 
                {
                    "name": "range to text", 
                    "value": 2
                }
            ], 
            "maxDataPoints": 100, 
            "minSpan": 2, 
            "nullPointMode": "null", 
            "nullText": null, 
            "postfix": "", 
            "postfixFontSize": "50%", 
            "prefix": "", 
            "prefixFontSize": "50%", 
            "rangeMaps": [
                {
                    "from": "null", 
                    "text": "N/A", 
                    "to": "null"
                }
            ], 
            "span": 2, 
            "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)", 
                "full": false, 
                "lineColor": "rgb(31, 120, 193)", 
                "show": true
            }, 
            "tableColumn": "", 
            "targets": [
                {
                    "expr": "((node_memory_SwapTotal_bytes{instance=~\"$node:$port\",job=~\"$job\"} - node_memory_SwapFree_bytes{instance=~\"$node:$port\",job=~\"$job\"}) / (node_memory_SwapTotal_bytes{instance=~\"$node:$port\",job=~\"$job\"} )) * 100", 
                    "intervalFactor": 1, 
                    "refId": "A", 
                    "step": 900
                }
            ], 
            "thresholds": "10,25", 
            "title": "Used SWAP", 
            "type": "singlestat", 
            "valueFontSize": "80%", 
            "valueMaps": [
                {
                    "op": "=", 
                    "text": "N/A", 
                    "value": "null"
                }
            ], 
            "valueName": "current"
        }, 
        {
            "cacheTimeout": null, 
            "colorBackground": false, 
            "colorValue": true, 
            "colors": [
                "rgba(50, 172, 45, 0.97)", 
                "rgba(237, 129, 40, 0.89)", 
                "rgba(245, 54, 54, 0.9)"
            ], 
            "datasource": "${DS_PROMETHEUS}", 
            "decimals": null, 
            "description": "Used Root FS", 
            "format": "percent", 
            "gauge": {
                "maxValue": 100, 
                "minValue": 0, 
                "show": true, 
                "thresholdLabels": false, 
                "thresholdMarkers": true
            }, 
            "id": 154, 
            "interval": null, 
            "links": [ ], 
            "mappingType": 1, 
            "mappingTypes": [
                {
                    "name": "value to text", 
                    "value": 1
                }, 
                {
                    "name": "range to text", 
                    "value": 2
                }
            ], 
            "maxDataPoints": 100, 
            "minSpan": 2, 
            "nullPointMode": "null", 
            "nullText": null, 
            "postfix": "", 
            "postfixFontSize": "50%", 
            "prefix": "", 
            "prefixFontSize": "50%", 
            "rangeMaps": [
                {
                    "from": "null", 
                    "text": "N/A", 
                    "to": "null"
                }
            ], 
            "span": 2, 
            "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)", 
                "full": false, 
                "lineColor": "rgb(31, 120, 193)", 
                "show": true
            }, 
            "tableColumn": "", 
            "targets": [
                {
                    "expr": "100 - ((node_filesystem_avail_bytes{instance=~\"$node:$port\",job=~\"$job\",mountpoint=\"/\",fstype!=\"rootfs\"} * 100) / node_filesystem_size_bytes{instance=~\"$node:$port\",job=~\"$job\",mountpoint=\"/\",fstype!=\"rootfs\"})", 
                    "format": "time_series", 
                    "intervalFactor": 1, 
                    "refId": "A", 
                    "step": 900
                }
            ], 
            "thresholds": "80,90", 
            "title": "Used Root FS", 
            "type": "singlestat", 
            "valueFontSize": "80%", 
            "valueMaps": [
                {
                    "op": "=", 
                    "text": "N/A", 
                    "value": "null"
                }
            ], 
            "valueName": "current"
        }, 
        {
            "cacheTimeout": null, 
            "colorBackground": false, 
            "colorValue": true, 
            "colors": [
                "rgba(50, 172, 45, 0.97)", 
                "rgba(237, 129, 40, 0.89)", 
                "rgba(245, 54, 54, 0.9)"
            ], 
            "datasource": "${DS_PROMETHEUS}", 
            "decimals": null, 
            "description": "Busy state of all CPU cores together (1 min average)", 
            "format": "percent", 
            "gauge": {
                "maxValue": 100, 
                "minValue": 0, 
                "show": true, 
                "thresholdLabels": false, 
                "thresholdMarkers": true
            }, 
            "id": 19, 
            "interval": null, 
            "links": [ ], 
            "mappingType": 1, 
            "mappingTypes": [
                {
                    "name": "value to text", 
                    "value": 1
                }, 
                {
                    "name": "range to text", 
                    "value": 2
                }
            ], 
            "maxDataPoints": 100, 
            "minSpan": 1, 
            "nullPointMode": "null", 
            "nullText": null, 
            "postfix": "", 
            "postfixFontSize": "50%", 
            "prefix": "", 
            "prefixFontSize": "50%", 
            "rangeMaps": [
                {
                    "from": "null", 
                    "text": "N/A", 
                    "to": "null"
                }
            ], 
            "span": 2, 
            "sparkline": {
                "fillColor": "rgba(31, 118, 189, 0.18)", 
                "full": false, 
                "lineColor": "rgb(31, 120, 193)", 
                "show": true
            }, 
            "tableColumn": "", 
            "targets": [
                {
                    "expr": "avg(node_load1{instance=~\"$node:$port\",job=~\"$job\"}) /  count(count(node_cpu_seconds_total{instance=~\"$node:$port\",job=~\"$job\"}) by (cpu)) * 100", 
                    "hide": false, 
                    "intervalFactor": 1, 
                    "refId": "A", 
                    "step": 900
                }
            ], 
            "thresholds": "85, 95", 
            "title": "CPU System Load (1m avg)", 
            "type": "singlestat", 
            "valueFontSize": "80%", 
            "valueMaps": [
                {
                    "op": "=", 
                    "text": "N/A", 
                    "value": "null"
                }
            ], 
            "valueName": "current"
        }, 
        {
            "cacheTimeout": null, 
            "colorBackground": false, 
            "colorValue": true, 
            "colors": [
                "rgba(50, 172, 45, 0.97)", 
                "rgba(237, 129, 40, 0.89)", 
              
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值