Windows 环境下 Prometheus 安装指南
目录
确认系统环境
下载 Prometheus
解压安装包
配置 Prometheus
启动 Prometheus
访问 Prometheus Web 界面
确认系统环境
确保你的 Windows 系统满足 Prometheus 的运行要求(推荐 Windows 10 或更高版本)。
下载 Prometheus
打开 Prometheus 官方下载页面,找到适用于 Windows 的最新版本。
下载 prometheus-<版本号>.windows-amd64.zip
文件,例如 prometheus-2.45.4.windows-amd64.zip
。
解压安装包
在 D:\
盘根目录下创建一个名为 prometheus
的文件夹,路径为 D:\prometheus
。
将下载的 prometheus-<版本号>.windows-amd64.zip
文件解压到 D:\prometheus
文件夹中。
配置 Prometheus
打开 D:\prometheus\prometheus.yml
文件,根据需要修改配置内容。以下是一个简单的示例配置:
global:
scrape_interval: 15s # 数据抓取间隔
evaluation_interval: 15s # 规则评估间隔
scrape_configs:
- job_name: 'prometheus' # 监控 Prometheus 自身
static_configs:
- targets: ['localhost:9090']
启动 Prometheus
打开 PowerShell,切换到 D:\prometheus
cd D:\prometheus
运行 prometheus.exe
.\prometheus.exe
访问 Prometheus Web 界面
在浏览器地址栏输入 http://localhost:9090
,访问 Prometheus 的 Web 界面。
在 Prometheus 界面中,点击左侧菜单栏的 Status -> Targets,查看已配置的监控目标是否正常抓取数据。