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

相关推荐
飞Link1 小时前
Windows 环境下 LaTeX 的安装配置教程
windows·vscode
R.lin2 小时前
windows MySQL解压版安装教程
windows·mysql·adb
常家壮2 小时前
Windows隐藏账号创建完全指南:技术原理与安全实践
windows·安全·渗透测试·后门·windows隐藏账号
真上帝的左手5 小时前
18. 操作系统-Windows-命令提示符
windows
GHL2842710907 小时前
文件重命名(C++源码)
前端·c++·windows
fred_kang8 小时前
win11上使用SecoClient登录报错出现的SV无法连接至服务器信息
windows
丁劲犇10 小时前
Visual C++下使用Win32 API为Release模式导出崩溃堆栈
c++·windows·crash·dump·离线调试·vc·崩溃堆栈
半夏知半秋10 小时前
kibana介绍与部署(Windows详细版)
大数据·运维·windows·学习·搜索引擎·全文检索
spencer_tseng10 小时前
Insufficient permissions [windows]
windows·acrobat 9.0
浪潮IT馆11 小时前
win11安装Git
windows·git