grafana+prometheus+windows_exporter实现windows进程资源占用的监控

grafana+prometheus+windows_exporter实现windows进程资源占用的监控@TOC

一、 管理端搭建,采用windows版本的grafana+prometheus

管理端安装部署不做本文终端,简单讲解一下,此处采用msi的grafana安装包,和免安装版本的prometheus

1.下载安装grafana

下载地址:https://grafana.com/grafana/download

  1. 安装grafana

直接下载安装包双击安装即可,此处不做特殊设置不做重点讲

  1. 管理端访问grafana

打开本机浏览器直接访问127.0.0.1:9090

默认账号admin 默认密码 admin

  1. prometheus下载

下载地址:https://prometheus.io/download/

  1. prometheus安装

免安装版本,直接解压到一个方便的运行目录即可

  1. 配置prometheus配置文件

文件名称prometheus.yml,与prometheus.exe同级,新增本机9182端口,如图(注意配置文件的缩进必须一致)

  1. 启动prometheus

双击prometheus.exe启动,注意小黑窗不能关闭,切每次修改配置文件后都要手动重启下prometheus才能生效(有不用重启的配置方式)

  1. 访问prometheus

浏览器中访问127.0.0.1:9090,即可访问

访问http://127.0.0.1:9090/targets,可以查看配置的采集设备,如果设备连接正常,会显示绿色,如图:

  1. 在grafana中新增数据源

在grafana的Configuration页面(http://127.0.0.1:3000/datasources) 新增一个数据源,新增时选择prometheus,进修改下URL即可,配置页面如下:

配置后保存。

  1. grafana导入模板

此内容是本次讲解内容,后免讲。

二、 终端采集器安装和配置

采用标准的windows_exporter,然后进行配置process监控

  1. windows_exporter下载最新版本

    下载地址:https://github.com/prometheus-community/windows_exporter/releases/tag/v0.29.2

    此处下载选择:msi安装包

  2. 双击msi安装包安装

    直接安装即可,如果修改了安装目录需要记住安装路径,默认路径(C:\Program Files\windows_exporter)

  3. 浏览访问

    浏览器访问:http://127.0.0.1:9182/metrics 查看是否启动(启动失败查看进程是否启动)

  4. 修改exporter的配置文件

    前往windows_exporter的安装目录(默认C:\Program Files\windows_exporter),新建文件config.yaml(如果已经存在则直接修改)

    编辑config.yaml文件,在文件中新增:

    复制代码
    collectors:
      enabled: cpu,cs,logical_disk,net,os,service,system,textfile,process

    其中cpu,cs,logical_disk,net,os,service,system,textfile是默认监控的,新增一个process,开启进程监控

    如下图

  5. 重启windows_exporter服务

    在进程管理中重启windows_exporter,默认为自动启动,重启后配置文件生效

    重启后再次访问http://127.0.0.1:9182/metrics

    查看页面底部是否出现process进程相关数据,如果有则证明操作生效

三、 管理端grafana中新增进程模板

  1. windows进程模板下载

    地址:https://grafana.com/grafana/dashboards/13262-services-processes/

    模板编号13262

  2. grafana中导入新模板

    登录grafana,Import dashboard http://127.0.0.1:3000/dashboard/import

    upload JSON file 选择刚才下载的json模板文件(联网下可以直接输入模版号load)

    Prometheus选择之前添加的本地Prometheus

    点import提交

  3. 打开新增的模板

    一般新增完会直接跳转到新增的模板

    在Search dashboards by name http://127.0.0.1:3000/dashboard/import?search=open中根据名称找到刚才新增的模板

  4. 查看进程数据

    前面配置没有问题的话,稍等一会即可看到数据,如果等不及可以调整一下右上角的取样时间段和刷新时间,建议查看最近5分钟,5秒刷新一次

    完毕

四、 参考及其其他相关文章

https://blog.csdn.net/csdn_chenhao/article/details/128034399

https://www.apispace.com/news/post/18997.html

相关推荐
the3clipse39 分钟前
MPC-HC 下载安装与最佳配置教程:免费开源、轻量无广告、支持 4K 硬解的 Windows 播放器
windows·播放器·安装教程·硬件加速·mpc-hc·字幕设置·lav filters
独隅1 小时前
WebStorm Windows 版 React / Next.js 实战替换指南
javascript·windows·webstorm
陈工大模型1 小时前
2026年11月最新免费解压软件横评:7-Zip 、 Win解压缩名列前茅
windows·软件工程·7-zip·压缩软件
中二骚年1 天前
Windows 安全中心 / 防火墙故障,calc和Microsoft Store,终端(管理员)无法正常打开。 原因 + 修复方案
windows·安全·microsoft
万联WANFLOW1 天前
CVE-2026-98432 等漏洞自查:AI 查出的 Linux、Windows 漏洞,运维怎么确认受不受影响
linux·运维·windows·网络安全
AlanAshley1 天前
Windows 中导致延迟的软硬件及协议比重
windows
yuezhilangniao1 天前
win10中文 以及 PowerShell 开发日常
windows·powershell
共享家95272 天前
408 操作系统第一章
服务器·数据库·windows
Sakura_j_h_2 天前
GitHub Actions 打包 Windows exe:中文编码与产物上传
windows·ci/cd·打包发布·github·pyinstaller·github actions
xixiaoyunya2 天前
搭一个浏览器即用的二进制文件分发点:目录规范与权限边界实践
网络·windows