Prometheus+Grafana监控部署

目录

1. Prometheus介绍

2. 下载安装

3. 安装Grafana


1. Prometheus介绍

Prometheus是一套开源的监控、报警、时间序列数据库的组合,Go语言开发。随着发展,越来越多公司和组织接受采用Prometheus,社区也十分活跃,他们便将它独立成开源项目,并且有公司来运作。google SRE的书内也曾提到跟他们BorgMon监控系统相似的实现是Prometheus。现在最常见的Kubernetes容器管理系统中,通常会搭配Prometheus进行监控。

Zabbix在监控界占有不可撼动的地位,功能强大。但是对容器监控显得力不从心。为解决监控容器的问题,引入了prometheus技术。prometheus号称是下一代监控。

2. 下载安装

官方下载                      官网文档指南

2.1 下载解压

# wget https://github.com/prometheus/prometheus/releases/download/v2.20.1/prometheus-2.20.1.linux-amd64.tar.gz

这里,我是从官方下载后上传到home目录下进行解压安装

# cd /home

# tar -zxvf prometheus-*.tar.gz

2.2 修改prometheus.yml

# cd prometheus-2.20.1.linux-amd64

# vim prometheus.yml

默认配置为9090端口,可修改配置

2.3 启动

# ./prometheus --config.file=prometheus.yml        //前台启动

#  c --config.file=prometheus.yml &     //后台启动

#  ps -ef |grep prometheus                // 进程查看

#  ./prometheus --help          //启动帮助

2.4 加入开机服务自动

# vim /etc/systemd/system/prometheus.service

[Unit]
Description=Prometheus Monitoring System
Documentation=Prometheus Monitoring System

[Service]
ExecStart=/home/prometheus-2.20.1.linux-amd64/prometheus \
  --config.file=/home/prometheus-2.20.1.linux-amd64/prometheus.yml \
  --web.listen-address=:9090

Restart=on-failure
[Install]
WantedBy=multi-user.target

 启动服务,设置开机自启,并检查服务开启状态

#  systemctl daemon-reload

#  systemctl enable prometheus

#  systemctl start prometheus

#  systemctl status prometheus

2.5 页面访问

http://172.20.32.218:9090

3. 安装Grafana

3.1 下载安装

# cd /home

# wget https://dl.grafana.com/oss/release/grafana-6.6.1.linux-amd64.tar.gz

# tar -zxvf grafana-*.linux-amd64.tar.gz

# cd grafana-6.6.1

3.2 启动

#  ./bin/grafana-server                     //前台启动

 # nohup ./bin/grafana-server &       //后台启动

3.3 访问

http://172.20.32.218:3000    默认账号/密码:admin/admin

具体使用可参考Grafana离线安装Grafana在线安装

设置DataSource,把prometheus的地址配置到如下列表中

导入prometheus模板

左上角会显示已经选择的模板

 

 

 

  • 1
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值