windows安装prometheus+grafana

1.Prometheus

1.进入prometheus官网,下载prometheus包prometheus官网
windows64位下载prometheus-2.20.1.windows-amd64.tar.gz
下载后直接解压
解压后进入目录运行premetheus.exe,访问端口9090即可,需要查看监控的对象列表可以进入status>targets查看
在这里插入图片描述

若需要监控服务器资源、数据库、kafka等需要下载对应的exporter
windows_exporter可以监控windows的一些指标参数,下载地址为windows_exporter,下载msi文件直接运行即可成功安装,默认端口是9182,然后到prometheus安装目录修改配置文件prometheus.yml,修改配置文件后重启prometheus,然后就可以看到targets列表增加的项目,状态为up表示正常监控,状态为down表示未检测到
在这里插入图片描述

linux常用的有node_exporter:监控服务器资源
mysqld_exporter:监控数据库
下载后放到需要监控的机器,直接运行,然后到prometheus安装目录修改配置文件prometheus.yml,添加exporter对应的ip以及端口,node_exporter默认端口是9100,mysqld_exporter默认端口9104

2.Grafana

进入Grafana官网
windows 64位下载grafana-7.1.5.windows-amd64.msi,直接运行安装即可,安装完成后进入grafana/bin目录下,双击运行garafana-server.exe,访问地址http://localhost:3000/,默认用户名密码admin/admin
进入后添加数据源,进入datasource,选择数据源prometheus,填写基本参数
在这里插入图片描述
添加仪表板(仪表板即显示数据参数的图表样式),可以手动添加一些仪表板,自己设置参数样式,但是对于新手或者不了解这块知识的人会比较复杂,建议使用另外一种方式
在这里插入图片描述
Grafana官网有提供一些仪表板模板,仪表板地址,搜索出想要的仪表板后复制它的ID
在这里插入图片描述
再到本地Grafana导入模板,选择数据源即可显示,对于导入的模板也可以根据自己的需求修改编辑
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
友情链接:
linux安装prometheus+grafana
使用Grafana实现 Jmeter实时监控

  • 4
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
安装 PrometheusGrafana 可以分为以下几个步骤: 1. 下载 Prometheus 前往 Prometheus 官网 https://prometheus.io/download/ 下载最新的稳定版本,选择 Windows 平台的压缩包。 2. 解压 Prometheus 将下载的压缩包解压到一个目录下,例如 `C:\prometheus`。 3. 配置 Prometheus 进入 `C:\prometheus` 目录,在该目录下新建一个名为 `prometheus.yml` 的文件,在该文件中配置需要监控的目标和规则。例如: ```yaml global: scrape_interval: 15s evaluation_interval: 15s scrape_configs: - job_name: 'prometheus' scrape_interval: 5s static_configs: - targets: ['localhost:9090'] - job_name: 'node_exporter' scrape_interval: 5s static_configs: - targets: ['localhost:9100'] ``` 上述配置文件中定义了两个监控任务:`prometheus` 和 `node_exporter`。其中,`prometheus` 是用于监控 Prometheus 自身的指标,而 `node_exporter` 是用于监控节点的指标。在此配置文件中,`prometheus` 监控自己的端口为 9090,`node_exporter` 监控自己的端口为 9100。 4. 启动 Prometheus 进入 `C:\prometheus` 目录,运行以下命令启动 Prometheus: ``` ./prometheus.exe --config.file=prometheus.yml ``` 5. 下载 Grafana 前往 Grafana 官网 https://grafana.com/grafana/download?platform=windows 下载最新的 Windows 版本。 6. 安装 Grafana 将下载的 Grafana 安装包解压到一个目录下,例如 `C:\grafana`。 7. 启动 Grafana 进入 `C:\grafana\bin` 目录,运行以下命令启动 Grafana: ``` ./grafana-server.exe ``` 启动成功后可以在浏览器中访问 `http://localhost:3000/` 打开 Grafana 控制台。 8. 配置 GrafanaGrafana 控制台中添加 Prometheus 数据源。在左侧菜单栏中点击 `Configuration`,然后点击 `Data Sources`,再点击 `Add data source` 添加数据源。选择 `Prometheus` 数据源型,然后填写 Prometheus 的地址和端口号,例如 `http://localhost:9090`。保存数据源配置。 9. 创建 Dashboard 在 Grafana 控制台中创建 Dashboard 并添加 Panel。在左侧菜单栏中点击 `Create`,然后选择 `Dashboard` 创建一个新的 Dashboard。在 Dashboard 中添加 Panel,并选择数据源为 Prometheus。可以通过查询 Prometheus 中的指标来展示各种监控数据。 以上就是在 Windows 10 上安装 PrometheusGrafana 的步骤。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值