前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >搭建Grafana+Prometheus监控平台

搭建Grafana+Prometheus监控平台

作者头像
用户6792968
发布2022-08-30 12:17:54
发布2022-08-30 12:17:54
33400
代码可运行
举报
文章被收录于专栏:fred 随笔fred 随笔
运行总次数:0
代码可运行

本文采用二进制源码安装方式,安装环境如下

操作系统

Grafana版本

Prometheus版本

Alibaba Cloud Linux 3

8.5.4

2.36.0

1、安装Prometheus

release地址:https://github.com/prometheus/prometheus/releases

代码语言:javascript
代码运行次数:0
复制
#下载Prometheus二进制包
wget  https://ghproxy.com/https://github.com/prometheus/prometheus/releases/download/v2.36.0/prometheus-2.36.0.linux-amd64.tar.gz
tar xf prometheus-2.36.0.linux-amd64.tar.gz  -C /opt/
mv /opt/prometheus-2.36.0.linux-amd64 /opt/prometheus

#将prometheus添加至systemd管理
cat << eof >> /etc/systemd/system/prometheus.service
[Unit]
Description=logging prometheus service
Documentation=https://prometheus.io

[Service]
Type=simple
User=root
Group=root
ExecStart=/opt/prometheus/prometheus  --web.enable-lifecycle --config.file=/opt/prometheus/prometheus.yml
Restart=on-failure

[Install]
WantedBy=multi-user.target
eof
systemctl daemon-reload
systemctl start prometheus.service
systemctl enable prometheus.service
  • prometheus默认监听在9090端口,安全组与防火墙放行后可以直接访问:http://IP:9090/gragh 进行访问

2、安装Grafana面板

官方release:https://grafana.com/grafana/download

代码语言:javascript
代码运行次数:0
复制
wget https://dl.grafana.com/oss/release/grafana-8.5.4.linux-amd64.tar.gz
tar -zxvf grafana-8.5.4.linux-amd64.tar.gz  -C /opt/
mv /opt/ grafana-8.5.4/ /opt/grafana
mkdir /opt/grafana/data
sed -i 's/data\/plugins/plugins-bundled/g'    /opt/grafana/conf/defaults.ini
#将grafana添加至systemd管理
cat << eof >> /etc/systemd/system/grafana.service
[Unit]
Description=logging Grafana service
Documentation=https://grafana.com/

[Service]
Type=simple
User=root
Group=root
ExecStart=/opt/grafana/bin/grafana-server  --homepath /opt/grafana/  web
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=on-failure

[Install]
WantedBy=multi-user.target
eof
systemctl  daemon-reload
systemctl  start grafana.service
systemctl  enable  grafana.service
  • grafana默认监听在3000端口,可以访问:http://IP:3000 进行访问,默认用户密码是:admin

3、添加Prometheus数据源

  • 导入Prometheus默认的监控大屏
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、安装Prometheus
  • 2、安装Grafana面板
  • 3、添加Prometheus数据源
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档