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

相关推荐
fengjianhua12251 小时前
免费PDF转换工具哪个转换效果最好?磨针PDF转换准确率评测
windows
TimberWill13 小时前
windows终端分屏设置
windows
不吃鱼的羊17 小时前
DTC错误状态异常排查
windows
hoaxxcj1 天前
DeepSeek Harness 本地部署与第三方插件排障实录:从 fetch failed 到 preset not found
人工智能·windows·开源·ai agent·deepseek
A心有千千结1 天前
Nginx网关可观测建设:打通流量入口,加速线上故障诊断
nginx·prometheus·devops
江湖人称菠萝包1 天前
【Windows】《深入浅出Windows API程序设计:核心编程篇》笔记-Chapter11-PE文件格式深入剖析
windows·笔记
普通人61 天前
win系统docker运行
windows·docker
qeen871 天前
【Linux】操作系统之进程介绍(一)
linux·笔记·学习·进程
天天喝旺仔1 天前
Prometheus + Grafana 监控告警体系搭建实战:从 Exporter 指标采集、PromQL 查询到 Alertmanager 告警落地
容器·kubernetes·grafana·prometheus·时序数据库
进击的荆棘1 天前
Linux系统——进程控制(下)
linux·运维·服务器·进程