1. Prometheus 部署
Prometheus Server 通过服务发现(Service Discovery)或静态配置的方式获取监控目标(Target),并从目标节点上的 Exporter 抓取(Scrape)指标数据。
Prometheus 自带基于文件的时间序列数据库(TSDB),用于本地持久化存储监控数据,用户可以使用 PromQL 查询语言进行数据分析,也可配置告警规则并将告警信息发送至 Alertmanager 进行进一步通知处理。
对于生命周期较短、难以被定时抓取的任务,Prometheus 提供 Pushgateway,用于接收这些任务主动推送的指标,由 Server 定期拉取数据。
最终,Prometheus 会将采集的时间序列数据存储在本地磁盘中,并结合告警规则触发告警,通过 Alertmanager 推送到邮件、钉钉、企业微信等。
此外,Prometheus 自带简洁的 Web UI,可直接执行 PromQL 查询。若需更丰富的可视化体验,可借助 Grafana 接入 Prometheus 数据源,实现图形化监控展示。
1.1 Prometheus 下载
本文以 Windows 系统为例,采用官方提供的二进制文件方式安装。
下载后解压目录如下所示:

1.2 Prometheus 启动
在解压目录中双击运行 prometheus.exe,默认监听端口为 9090。
打开浏览器访问:http://localhost:9090

若页面正常显示 Prometheus 界面,说明启动成功。
2.1 下载与运行
Windows Exporter 下载地址:👉 https://github.com/prometheus-community/windows_exporter/releases
https://github.com/prometheus-community/windows_exporter/releases
下载 .exe 文件(如:windows_exporter-0.30.4-amd64.exe),直接双击运行或者命令行启动
windows_exporter.exe --collectors.enabled "cpu,cs,logical_disk,net,os,service,system,textfile,process"
默认监听端口为 9182,浏览器访问:
http://localhost:9182/metrics
若能正常访问即表示运行成功。
2.2 配置 Prometheus 拉取 Exporter 指标
打开 Prometheus 文件夹中的 prometheus.yml 文件,使用记事本或 VS Code 编辑。
在 scrape_configs 节点中添加如下配置(请替换为本机 IP):
scrape_configs:
- job_name: 'windows'
static_configs:
- targets: ['127.0.0.1:9182']
<
543



被折叠的 条评论
为什么被折叠?



