Mac安装Prometheus + Grafana

一、安装Prometheus

1、下载安装

brew install prometheus

2、安装路径

/opt/homebrew/Cellar/prometheus/3.1.0

3、修改配置文件

默认配置文件路径:/opt/homebrew/etc/prometheus.yml

global:
  scrape_interval: 15s

scrape_configs:
  - job_name: "prometheus"
    static_configs:
    - targets: ["localhost:9090"]

3、启动方式

(1)后台运行(推荐)

cd /opt/homebrew/Cellar/prometheus/3.1.0/bin
prometheus --config.file=/opt/homebrew/etc/prometheus.yml &

(2)立即启动,并登录时启动

brew services start prometheus

(3)临时启动

/opt/homebrew/opt/prometheus/bin/prometheus_brew_services

4、启动后访问web

http://localhost:9090

二、docker安装Prometheus

1、下载

docker pull prom/prometheus

2、创建配置文件 prometheus.yml

mkdir ./prometheus

vim prometheus.yml

内容如下

global:
  scrape_interval: 15s

scrape_configs:
  - job_name: "prometheus"
    static_configs:
    - targets: ["localhost:9090"]

 3、启动服务

docker run -d --name prometheus -p 9090:9090 -v /Users/heguitang/workspace/dockerData/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus

4、浏览器访问

http://localhost:9090

 三、安装Grafana

 1、下载

brew install grafana 

2、安装路径

/opt/homebrew/Cellar/grafana/11.4.0

3、配置文件

/opt/homebrew/etc/grafana/grafana.ini

4、启动方式

(1)service方式(推荐)

brew services start grafana

(2)非service方式

/opt/homebrew/opt/grafana/bin/grafana server --config /opt/homebrew/etc/grafana/grafana.ini --homepath /opt/homebrew/opt/grafana/share/grafana --packaging\=brew cfg:default.paths.logs\=/opt/homebrew/var/log/grafana cfg:default.paths.data\=/opt/homebrew/var/lib/grafana cfg:default.paths.plugins\=/opt/homebrew/var/lib/grafana/plugins

5、浏览器访问

http://localhost:3000

账号:admin    密码:admin

6、创建数据源

(1)首页选择添加数据源

(2)添加Prometheus数据源

(3)设置名字和连接方式,并保存

7、创建看板

(1)新建看板

(2)新建看板

(3)保存看板

四、Docker安装Grafana

1、拉取镜像

docker pull grafana/grafana

2、创建文件夹

mkdir ./grafana
chmod 777 ./grafana

3、安装运行

docker run -d --name grafana -p 3000:3000 -v ./grafana:/var/lib/grafana grafana/grafana

 

 

 

 

 

 

 

 

原博客:https://blog.csdn.net/qq_37958845/article/details/117954606

 

 

posted @   Robots2  阅读(29)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 推荐几款开源且免费的 .NET MAUI 组件库
· 实操Deepseek接入个人知识库
· 易语言 —— 开山篇
· 【全网最全教程】使用最强DeepSeekR1+联网的火山引擎,没有生成长度限制,DeepSeek本体
点击右上角即可分享
微信分享提示