type
status
date
slug
summary
tags
category
icon
password
一、Prometheus
Prometheus(普罗米修斯)是一套比较完备的监控报警系统,其主要架构设计如图:

1. 主要是由以下组件构成:
- Prometheus server:服务中心,主要负责拉取和存储时序书库(Prometheus有自带的时序数据库)
- Client Libraries:客户端库,主要用于和具体的服务进行集成,采集监控数据,例如Micrometer
- Push gateway:另外一种数据push的采集方式(Prometheus默认使用pull的方式主动采集应用数据),用于适配一些没有长期稳定的进程 的服务
- Exporter:用于针对某些特定服务的数据采集工具,例如:mysql/kafka/HA等..
- Alert Manager:Prometheus的监控告警工具,主要通过webhook和其他告警系统进行集成告警,能够进行告警规则的配置
- 其他工具
同时,Prometheus也有一套自己的查询语法,用于已经采集的数据的结果查询,具体可以参考:
前言windows_exporter
windows_exporter是一个用于收集Windows操作系统指标的开源软件,它是Prometheus生态系统中的一个组件。类似于node_exporter,windows_exporter负责在Windows主机上运行,并公开各种与Windows系统相关的指标供Prometheus收集。
windows_exporter可以提供各种关于Windows主机的指标,如CPU使用率、内存使用情况、磁盘空间、网络流量、进程信息等。它还可以提供更详细的指标,如系统服务状态、Windows事件日志、性能计数器等。这些指标可以帮助系统管理员了解Windows主机的性能和健康状况,并及时采取措施来优化和修复问题。
类似于node_exporter,windows_exporter通过HTTP或者HTTPS暴露一个或多个端点,Prometheus会定期从这些端点拉取指标数据,并进行存储、分析和可视化。借助Prometheus的查询语言,用户可以根据这些指标来构建监控规则和警报条件,以便及时发现和解决Windows主机的问题。
通过Powershell一键安装windows_exporter监控数据采集
- wmi_exporter dowload
- Windows操作系统采集(如CPU,内存,硬盘,网络等)
- Windows 高版本建议安装最新的Windows_exporter
- 采集端口9182
- 防火墙不要关闭,防火墙规整默认安装完成会自动创建
执行一键安装



安装完成查看版本安装时间等等
- 控制面板\所有控制面板项\程序和功能

自动生成的系统服务
- 控制面板\所有控制面板项\管理工具\服务

访问采集信息

Prometheus 软件下载
安装普罗米修斯监控
Prometheus(由go语言(golang)开发)是一套开源的监控&报警&时间序列数据库的组合,适合监控docker容器和Windows服务器
下载并解压:prometheus-2.52.0.windows-amd64.zip

双击运行文件 prometheus.exe,会弹出如下cmd窗口,先不要关闭!不然访问不到


在prometheus.yml同级目录新建windows.yml
关闭并重启 prometheus.exe cmd窗口
打开 http://localhost:9090/targets,查看 windows状态为up即成功

Prometheus 采集配置
Grafana图形展示
Import>10467>Prometheus
prometheus监控 windows主机报警规则
Grafana
下载

解压 grafana-enterprise-10.4.0.windows-amd64.zip,解压后双击bin目录下 grafana-server.exe,弹出如下cmd窗口,不要关闭!


打开浏览器,访问 http://localhost:3000(账号密码默认是admin,首次登录要改新的密码)
(第一次访问端口可能会被占用,先关闭占用端口的应用程序)

登录进来,进入界面

创建数据源,关联 prometheus

输入 URL,其他默认即可

保存成功

选择 Grafana 模板

Download JSON(下载JSON模板文件到本地)

打开浏览器,访问 http://localhost:3000/dashboards,点击 Create Dashboard

点击 Import dashboard

导入下载的JSON模板文件,点击 Import

至此,监控系统配置完成

参考
- 作者:胡凯
- 链接:https://hukai.fun/article/monitor
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。