windows安装prometheus和grafana

prometheus官网
grafana

软件下载

prometheus

windows_exporter
https://github.com/prometheus-community/windows_exporter

grafana

prometheus原理


配置prometheus

解压之后prometheus-2.50.1.windows-amd64.zip修改prometheus.yml

localhost修改为127.0.0.1

双击prometheus.exe运行

访问http://127.0.0.1:9090/targets

配置windows资源采集器

以管理员身份运行windows_exporter-0.25.1-amd64

访问http://localhost:9182/metrics

创建服务,以管理员身份启动cmd

bash 复制代码
sc create windows_exporter binpath= D:\Software\prometheus\windows_exporter-0.25.1-amd64.exe type= own start= auto displayname= windows_exporter

找到服务启动即可

删除服务

bash 复制代码
sc delete windows_exporter

在prometheus.yml同级目录新建windows.yml

yml 复制代码
- targets: ["127.0.0.1:9182"]
  labels:
    instance: 127.0.0.1
    serverName: '本地windows服务器'

prometheus.yml中添加如下内容 (注意缩进)

yml 复制代码
  - job_name: "windows"
    file_sd_configs:
    - refresh_interval: 15s
      files: 
      - ".\\windows.yml"

重启prometheus端,打开http://127.0.0.1:9090/targets,windows状态为up即成功

配置Grafana

可以看到prometheus的默认界面比较单一,可看到的关键资源信息不多,下面使用Grafana展示具体资源状况

在全英文路径下解压grafana-enterprise-10.4.0.windows-amd64.zip,双击bin目录下grafana-server.exe,任务栏会新增一个黑窗户(不要关闭)

浏览器打开http://127.0.0.1:3000(默认账号密码都是admin)

第一次访问端口被占用,关闭占用的应用程序

然后让输入新的密码

安装成功,创建数据源,关联prometheus端

输入url其他默认即可


选择模板

下载完成json模板之后进行导入



大盘配置完成

参考
参考

相关推荐
龙码精神3 天前
前端嵌入Grafana 报表的自定义方案:隐藏导航栏保留筛选工具
grafana
埃博拉酱3 天前
VS Code Remote SSH 连接 Windows 服务器卡在"下载 VS Code 服务器":prcdn DNS 解析失败的诊断与 BITS 断点续传
windows·ssh·visual studio code
唐宋元明清21884 天前
.NET 本地Db数据库-技术方案选型
windows·c#
加号34 天前
windows系统下mysql多源数据库同步部署
数据库·windows·mysql
tryCbest4 天前
Windows环境下配置pip镜像源
windows·pip
呉師傅4 天前
火狐浏览器报错配置文件缺失如何解决#操作技巧#
运维·网络·windows·电脑
百事牛科技4 天前
保护文档安全:PDF限制功能详解与实操
windows·pdf
一个人旅程~4 天前
如何用命令行把win10/win11设置为长期暂停更新?
linux·windows·经验分享·电脑
一个假的前端男4 天前
[特殊字符] Flutter 安装完整指南 Windows—— 2026最新版
windows·flutter
倚肆4 天前
在 Windows Docker 中安装并配置 Nginx (映射 Windows 端口与路径)
windows·nginx·docker