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.youkuaiyun.com/zhenxing_06/article/details/114264061

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值