目录
前言
Grafana选择监控仪表盘
自定义简约型-只显示资源总览,各个主机详情
监控仪表盘JSON数据
前言
相关参考:Windows监控:基于Prometheus+Grafana监控CPU、内存、磁盘、网络、GPU信息
Grafana选择监控仪表盘
访问地址:https://grafana.com/dashboards --- serch框输入windows ---- 选择心仪模板 (注意模板所支持的数据源为prometheus) ----- 进行 ID 或者JOSN文件两种方式导入。
自定义简约型-只显示资源总览,各个主机详情
监控仪表盘JSON数据
{"annotations": {"list": [{"builtIn": 1,"datasource": "-- Grafana --","enable": true,"hide": true,"iconColor": "rgba(0, 211, 255, 1)","name": "Annotations & Alerts","type": "dashboard"}]},"description": "Windows的Prometheus监控看板展示,增加了资源汇总展示,优化了明细展示。更新支持windows_exporter 0.13.0。","editable": true,"gnetId": 10467,"graphTooltip": 1,"id": 1,"iteration": 1605338442536,"links": [{"asDropdown": true,"icon": "external link","tags": [],"targetBlank": true,"type": "dashboards"}],"panels": [{"collapsed": false,"datasource": "Prometheus","gridPos": {"h": 1,"w": 24,"x": 0,"y": 0},"id": 41,"panels": [],"title": "资源监控","type": "row"},{"columns": [],"datasource": "Prometheus","fieldConfig": {"defaults": {"custom": {}},"overrides": []},"fontSize": "90%","gridPos": {"h": 6,"w": 24,"x": 0,"y": 1},"id": 45,"pageSize": null,"showHeader": true,"sort": {"col": 0,"desc": true},"styles": [{"alias": "操作系统","align": "auto","colorMode": null,"colors": ["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],"dateFormat": "YYYY-MM-DD HH:mm:ss","decimals": 2,"mappingType": 1,"pattern": "product","preserveFormat": false,"sanitize": false,"thresholds": [],"type": "string","unit": "short","valueMaps": []},{"alias": "主机名称","align": "auto","colorMode": null,"colors": ["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],"dateFormat": "YYYY-MM-DD HH:mm:ss","decimals": 2,"link": false,"linkTooltip": "","linkUrl": "","mappingType": 1,"pattern": "hostname","preserveFormat": false,"thresholds": [],"type": "string","unit": "short"},{"alias": "主机信息","align": "auto","colorMode": null,"colors": ["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],"dateFormat": "YYYY-MM-DD HH:mm:ss","decimals": 2,"link": false,"linkTargetBlank": false,"linkTooltip": "${__cell_4}","linkUrl": "/d/Kdh0OoSGz/?var-job=${__cell_5}&var-hostname=All&var-instance=${__cell_4}","mappingType": 1,"pattern": "instance","thresholds": [],"type": "string","unit": "short"},{"alias": "CPU核数","align": "auto","colorMode": null,"colors": ["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],"dateFormat": "YYYY-MM-DD HH:mm:ss","decimals": 2,"link": false,"mappingType": 1,"pattern": "Value #B","thresholds": [],"type": "string","unit": "short"},{"alias": "总内存","align": "auto","colorMode": null,"colors": ["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],"dateFormat": "YYYY-MM-DD HH:mm:ss","decimals": null,"mappingType": 1,"pattern": "Value #C","thresholds": [],"type": "number","unit": "bytes"},{"alias": "运行时间","align": "auto","colorMode": "cell","colors": ["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],"dateFormat": "YYYY-MM-DD HH:mm:ss","decimals": null,"mappingType": 1,"pattern": "Value #D","thresholds": ["259200","432000"],"type": "number","unit": "s"},{"alias": "C盘使用率","align": "auto","colorMode": "cell","colors": ["rgba(50, 172, 45, 0.97)","rgba(237, 129, 40, 0.89)","rgba(245, 54, 54, 0.9)"],"dateFormat": "YYYY-MM-DD HH:mm:ss","decimals": 2,"mappingType": 1,"pattern": "Value #E","thresholds": ["60","80"],"type": "number","unit": "percentunit"},{"alias": "进程数","align": "auto","colorMode": null,"colors": ["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],"dateFormat": "YYYY-MM-DD HH:mm:ss","decimals": 2,"link": false,"mappingType": 1,"pattern": "Value #G","thresholds": [],"type": "string","unit": "short"},{"alias": "运行服务","align": "auto","colorMode": null,"colors": ["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],"dateFormat": "YYYY-MM-DD HH:mm:ss","decimals": 2,"mappingType": 1,"pattern": "Value #H","thresholds": [],"type": "string","unit": "short"},{"alias": "CPU使用率","align": "auto","colorMode": "cell","colors": ["rgba(50, 172, 45, 0.97)","rgba(237, 129, 40, 0.89)","rgba(245, 54, 54, 0.9)"],"dateFormat": "YYYY-MM-DD HH:mm:ss","decimals": 2,"mappingType": 1,"pattern": "Value #I","thresholds": ["50","70"],"type": "number","unit": "percent"},{"alias": "内存使用率","align": "auto","colorMode": "cell","colors": ["rgba(50, 172, 45, 0.97)","rgba(237, 129, 40, 0.89)","rgba(245, 54, 54, 0.9)"],"dateFormat": "YYYY-MM-DD HH:mm:ss","decimals": 2,"mappingType": 1,"pattern": "Value #J","thresholds": ["60","80"],"type": "number","unit": "percent"},{"alias": "CPU频率","align": "auto","colorMode": null,"colors": ["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],"dateFormat": "YYYY-MM-DD HH:mm:ss","decimals": 2,"mappingType": 1,"pattern": "Value #K","thresholds": [],"type": "number","unit": "rothz"},{"alias": "","align": "right","colorMode": null,"colors": ["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],"decimals": 2,"pattern": "/.*/","thresholds": [],"type": "hidden","unit": "short"}],"targets": [{"expr": "windows_os_info * on(instance) group_right(product) windows_cs_hostname","format": "table","instant": true,"interval": "","legendFormat": "主机名","refId": "A"},{"expr": "time() - windows_system_system_up_time","format": "table","instant": true,"interval": "","legendFormat": "运行时间","refId": "D"},{"expr": "windows_cs_logical_processors - 0","format": "table","instant": true,"interval": "","legendFormat": "","refId": "B"},{"expr": "avg by (instance) (windows_cpu_core_frequency_mhz)","format": "table","instant": true,"interval": "","legendFormat": "","refId": "K"},{"expr": "100 - (avg by (instance) (irate(windows_cpu_time_total{mode=\"idle\"}[2m])) * 100)","format": "table","instant": true,"interval": "","legendFormat": "CPU使用率","refId": "I"},{"expr": "windows_cs_physical_memory_bytes - 0","format": "table","instant": true,"interval": "","legendFormat": "总内存","refId": "C"},{"expr": "100 - 100 * windows_os_physical_memory_free_bytes / windows_cs_physical_memory_bytes","format": "table","instant": true,"interval": "","legendFormat": "内存使用率","refId": "J"},{"expr": "1 - (windows_logical_disk_free_bytes{volume=~\"C:\"}/windows_logical_disk_size_bytes{volume=~\"C:\"})","format": "table","instant": true,"interval": "","legendFormat": "c盘使用率","refId": "E"},{"expr": "windows_os_processes","format": "table","instant": true,"interval": "","legendFormat": "进程数","refId": "G"},{"expr": "sum by (instance) (windows_service_state{state=~\"running\"})","format": "table","instant": true,"interval": "","legendFormat": "运行服务","refId": "H"}],"timeFrom": null,"timeShift": null,"title": "服务器资源总览","transform": "table","type": "table-old"},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","decimals": 1,"fieldConfig": {"defaults": {"custom": {}},"overrides": []},"fill": 1,"fillGradient": 0,"gridPos": {"h": 6,"w": 8,"x": 0,"y": 7},"hiddenSeries": false,"id": 47,"legend": {"alignAsTable": true,"avg": true,"current": true,"max": true,"min": false,"rightSide": true,"show": false,"sort": "current","sortDesc": false,"total": false,"values": true},"lines": true,"linewidth": 1,"links": [],"nullPointMode": "null","paceLength": 10,"percentage": false,"pluginVersion": "7.1.5","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"expr": "100 - (avg by (instance) (irate(windows_cpu_time_total{mode=\"idle\"}[2m])) * 100)","hide": false,"interval": "","intervalFactor": 1,"legendFormat": "{{instance}}","refId": "B"}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "各主机CPU使用率","tooltip": {"shared": true,"sort": 2,"value_type": "cumulative"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "percent","label": null,"logBase": 1,"max": null,"min": "0","show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": false}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","decimals": 1,"fieldConfig": {"defaults": {"custom": {}},"overrides": []},"fill": 1,"fillGradient": 0,"gridPos": {"h": 6,"w": 8,"x": 8,"y": 7},"hiddenSeries": false,"id": 56,"legend": {"alignAsTable": true,"avg": true,"current": true,"max": true,"min": false,"rightSide": true,"show": false,"sort": "current","sortDesc": false,"total": false,"values": true},"lines": true,"linewidth": 1,"links": [],"nullPointMode": "null","paceLength": 10,"percentage": false,"pluginVersion": "7.1.5","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"expr": "utilization_gpu","hide": false,"interval": "","intervalFactor": 1,"legendFormat": "{{instance}}_GPU","refId": "B"}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "各主机GPU使用率","tooltip": {"shared": true,"sort": 2,"value_type": "cumulative"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "percent","label": null,"logBase": 1,"max": null,"min": "0","show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": false}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {"Free Physical memory": "semi-dark-green","Free physical memory": "semi-dark-green","Free virtual memory": "super-light-blue","Physical memory": "dark-red","Virtual memory": "dark-blue"},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","fieldConfig": {"defaults": {"custom": {}},"overrides": []},"fill": 1,"fillGradient": 1,"gridPos": {"h": 6,"w": 8,"x": 16,"y": 7},"hiddenSeries": false,"hideTimeOverride": false,"id": 49,"legend": {"alignAsTable": true,"avg": true,"current": true,"max": true,"min": false,"rightSide": true,"show": false,"sort": "current","sortDesc": true,"total": false,"values": true},"lines": true,"linewidth": 2,"links": [],"nullPointMode": "null","percentage": false,"pluginVersion": "7.1.5","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [{"alias": "/.*Physical.*/","linewidth": 3}],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"expr": "100.0 - 100 * windows_os_physical_memory_free_bytes / windows_cs_physical_memory_bytes","instant": false,"interval": "","legendFormat": "{{instance}}","refId": "A"}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "各主机内存使用率","tooltip": {"shared": true,"sort": 0,"value_type": "individual"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "percent","label": null,"logBase": 1,"max": null,"min": null,"show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": false}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","fieldConfig": {"defaults": {"custom": {}},"overrides": []},"fill": 1,"fillGradient": 0,"gridPos": {"h": 6,"w": 8,"x": 0,"y": 13},"hiddenSeries": false,"hideTimeOverride": false,"id": 53,"legend": {"alignAsTable": true,"avg": true,"current": true,"max": true,"min": false,"rightSide": true,"show": false,"sort": "max","sortDesc": true,"total": false,"values": true},"lines": true,"linewidth": 1,"links": [],"nullPointMode": "null as zero","percentage": false,"pluginVersion": "7.1.5","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"application": {"filter": ""},"expr": "max by (instance) (irate(windows_net_bytes_sent_total{nic!~'isatap.*|VPN.*'}[2m]))*8","format": "time_series","functions": [],"group": {"filter": ""},"hide": false,"host": {"filter": ""},"interval": "","intervalFactor": 1,"item": {"filter": ""},"legendFormat": "{{instance}}_上传","metric": "mysql_global_status_questions","mode": 0,"options": {"showDisabledItems": false},"refId": "B","step": 10},{"application": {"filter": ""},"expr": "-max by (instance) (irate(windows_net_bytes_received_total{nic!~'isatap.*|VPN.*'}[2m]))*8","format": "time_series","functions": [],"group": {"filter": ""},"hide": false,"host": {"filter": ""},"interval": "","intervalFactor": 1,"item": {"filter": ""},"legendFormat": "{{instance}}_下载","metric": "mysql_global_status_questions","mode": 0,"options": {"showDisabledItems": false},"refId": "A","step": 10}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "各主机网络详情","tooltip": {"shared": true,"sort": 2,"value_type": "individual"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "bps","label": "下载 上传","logBase": 1,"max": null,"min": null,"show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": false}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","fieldConfig": {"defaults": {"custom": {}},"overrides": []},"fill": 2,"fillGradient": 0,"gridPos": {"h": 6,"w": 8,"x": 8,"y": 13},"hiddenSeries": false,"hideTimeOverride": false,"id": 51,"legend": {"alignAsTable": true,"avg": true,"current": true,"max": true,"min": false,"rightSide": true,"show": false,"sort": "max","sortDesc": true,"total": false,"values": true},"lines": true,"linewidth": 1,"links": [],"nullPointMode": "null","percentage": false,"pluginVersion": "7.1.5","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"application": {"filter": ""},"expr": "-max by (instance) (irate(windows_logical_disk_read_bytes_total[2m]))","format": "time_series","functions": [],"group": {"filter": ""},"hide": false,"host": {"filter": ""},"interval": "","intervalFactor": 1,"item": {"filter": ""},"legendFormat": "{{instance}}_读取","metric": "mysql_global_status_questions","mode": 0,"options": {"showDisabledItems": false},"refId": "A","step": 20},{"application": {"filter": ""},"expr": "max by (instance) (irate(windows_logical_disk_write_bytes_total[2m]))","format": "time_series","functions": [],"group": {"filter": ""},"hide": false,"host": {"filter": ""},"interval": "","intervalFactor": 1,"item": {"filter": ""},"legendFormat": "{{instance}}_写入","metric": "mysql_global_status_questions","mode": 0,"options": {"showDisabledItems": false},"refId": "B","step": 20}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "各主机磁盘读写详情","tooltip": {"shared": true,"sort": 2,"value_type": "individual"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "Bps","label": "读取 写入","logBase": 1,"max": null,"min": null,"show": true},{"decimals": null,"format": "iops","label": "","logBase": 1,"max": null,"min": null,"show": false}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","fieldConfig": {"defaults": {"custom": {}},"overrides": []},"fill": 1,"fillGradient": 0,"gridPos": {"h": 6,"w": 8,"x": 16,"y": 13},"hiddenSeries": false,"hideTimeOverride": false,"id": 55,"legend": {"alignAsTable": true,"avg": true,"current": true,"max": true,"min": false,"rightSide": true,"show": false,"sort": "current","sortDesc": true,"total": false,"values": true},"lines": true,"linewidth": 1,"links": [],"nullPointMode": "null as zero","percentage": false,"pluginVersion": "7.1.5","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"application": {"filter": ""},"expr": "-max by (instance) (irate(windows_logical_disk_reads_total[2m]))","format": "time_series","functions": [],"group": {"filter": ""},"hide": false,"host": {"filter": ""},"interval": "","intervalFactor": 1,"item": {"filter": ""},"legendFormat": "{{instance}}_读取","metric": "mysql_global_status_questions","mode": 0,"options": {"showDisabledItems": false},"refId": "B","step": 20},{"application": {"filter": ""},"expr": "max by (instance) (irate(windows_logical_disk_writes_total[2m]))","format": "time_series","functions": [],"group": {"filter": ""},"hide": false,"host": {"filter": ""},"interval": "","intervalFactor": 1,"item": {"filter": ""},"legendFormat": "{{instance}}_写入","metric": "mysql_global_status_questions","mode": 0,"options": {"showDisabledItems": false},"refId": "C","step": 20}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "各主机磁盘IO详情","tooltip": {"shared": true,"sort": 2,"value_type": "individual"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "iops","label": "读取 写入","logBase": 1,"max": null,"min": null,"show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": false}],"yaxis": {"align": false,"alignLevel": null}}],"refresh": false,"schemaVersion": 26,"style": "dark","tags": ["Prometheus","windows_exporter"],"templating": {"list": [{"allValue": null,"current": {"selected": false,"text": "Win-76","value": "Win-76"},"datasource": "Prometheus","definition": "label_values(windows_cs_hostname, job)","hide": 0,"includeAll": false,"label": "JOB","multi": false,"name": "job","options": [],"query": "label_values(windows_cs_hostname, job)","refresh": 1,"regex": "","skipUrlSync": false,"sort": 1,"tagValuesQuery": "","tags": [],"tagsQuery": "","type": "query","useTags": false},{"allValue": null,"current": {"selected": false,"text": "All","value": "$__all"},"datasource": "Prometheus","definition": "label_values(windows_cs_hostname{job=~\"$job\"}, hostname)","hide": 0,"includeAll": true,"label": "主机名","multi": false,"name": "hostname","options": [],"query": "label_values(windows_cs_hostname{job=~\"$job\"}, hostname)","refresh": 1,"regex": "","skipUrlSync": false,"sort": 5,"tagValuesQuery": "","tags": [],"tagsQuery": "","type": "query","useTags": false},{"allValue": null,"current": {"selected": false,"text": "10.0.50.76:9182","value": "10.0.50.76:9182"},"datasource": "Prometheus","definition": "label_values(windows_cs_hostname{job=~\"$job\",hostname=~\"$hostname\"}, instance)","hide": 0,"includeAll": false,"label": "instance","multi": false,"name": "instance","options": [],"query": "label_values(windows_cs_hostname{job=~\"$job\",hostname=~\"$hostname\"}, instance)","refresh": 1,"regex": "","skipUrlSync": false,"sort": 5,"tagValuesQuery": "","tags": [],"tagsQuery": "","type": "query","useTags": false},{"allValue": null,"current": {"selected": false,"text": "wangyanfei","value": "wangyanfei"},"datasource": "Prometheus","definition": "label_values(windows_cs_hostname{job=~\"$job\",instance=~\"$instance\"}, hostname)","hide": 2,"includeAll": false,"label": "展示使用的主机名","multi": false,"name": "show_hostname","options": [],"query": "label_values(windows_cs_hostname{job=~\"$job\",instance=~\"$instance\"}, hostname)","refresh": 1,"regex": "","skipUrlSync": false,"sort": 0,"tagValuesQuery": "","tags": [],"tagsQuery": "","type": "query","useTags": false}]},"time": {"from": "now-5m","to": "now"},"timepicker": {"refresh_intervals": ["10s","30s","1m","5m","15m","30m","1h","2h","1d"],"time_options": ["5m","15m","1h","6h","12h","24h","2d","7d","30d"]},"timezone": "","title": "Webvr","uid": "Kdh0OoSGz","version": 17
}