Mac下安装Prometheus+Grafana

mac下最方便的方式,通过brew安装进行安装管理

安装prometheus

安装

brew install prometheus

prometheus配置文件默认安装路径:/usr/local/etc/prometheus.yml

配置

prometheus.yml
基于文件服务发现:

global:
  scrape_interval: 15s

scrape_configs:
  - job_name: "prometheus"
    static_configs:
    - targets: ["localhost:9090"]
  - job_name: "actuator-prometheus"
    # 多久采集一次数据
    scrape_interval: 5s
    # 采集时的超时时间
    scrape_timeout: 5s
    # 采集路径
    metrics_path: '/actuator/prometheus'
    file_sd_configs:
    - files:
      - /Users/wfbi/monitor/targets/actuator-*.yaml

/Users/wfbi/monitor/targets目录下actuator-film.yaml:

- targets:
  - localhost:8080
  labels:
    app: film
    job: film-actuator

启动

brew services start prometheus

访问

http://localhost:9090

问题

fatal: unable to access ‘https://github.com/Homebrew/homebrew-services/’: LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

解决方案:

git config --global --unset http.proxy  
git config --global --unset https.proxy

安装grafana

安装

brew install grafana

prometheus配置文件默认安装路径:/usr/local/etc/grafana/grafana.ini

启动

brew services start grafana

访问

http://localhost:3000

默认账号密码:admin/admin

添加prometheus数据源:Configuration -> Add data source -> Prometheus -> Add HTTP:URL -> Save&test

Reference

https://cloud.tencent.com/developer/article/1812416

https://blog.csdn.net/zhenxing_06/article/details/114264061

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装 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 的步骤。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值