Telegraf + Promethue + Grafana 监控平台

一、规划

1、服务器

server IP软件/插件用途备注
10.20.10.4Promethue+Grafana数据存储+web展示Grafana 展示
10.20.10.5Telegraf数据采集telegraf插件部署到远程服务器

2、软件/版本

  • Promethue

    version:2.26.0
    download:
    https://prometheus.io/download/
    
  • Telegraf

    version:1.18.1
    download:
    https://portal.influxdata.com/downloads/
    https://dl.influxdata.com/telegraf/releases/telegraf-1.18.1-1.x86_64.rpm
    
  • Grafana

    version:7.5.3
    download:https://grafana.com/grafana/download/7.5.3
    

二、部署

2.1 Promethue 部署

1、服务器上传或wget下载 prometheus 安装包

wget https://github.com/prometheus/prometheus/releases/download/v2.26.0/prometheus-2.26.0.linux-amd64.tar.gz

2、解压

tar -zxvf prometheus-2.26.0.linux-amd64.tar.gz -C /usr/local/
mv /usr/local/prometheus-2.26.0.linux-amd64/  /usr/local/prometheus

3、配置system管理

vim /lib/systemd/system/prometheus.service

[Unit]
Description=https://prometheus.io

[Service]
Restart=on-failure
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml

[Install]
WantedBy=multi-user.target

4、启动

systemctl start prometheus.service
netstat -lntp | grep 9090

5、验证

浏览器访问 http://10.20.10.4:9090/ 就可以访问到prometheus的主界面。
# http://10.20.10.4:9090/graph
# 这里只能只能查看到promethue采集到的自身服务器数据,因为还没和telegraf进行通信,所以采集不了其他服务器数据

2.2 Telegraf 部署

1、服务器上传或wget下载 Telegraf 安装包

wget https://dl.influxdata.com/telegraf/releases/telegraf-1.18.1-1.x86_64.rpm

# 该服务部署在被采集数据的服务器上,其采集到的数据将会通过API形式存储到Promethue上并通过Grafana进行展示

2、安装

yum localinstall -y telegraf-1.18.1-1.x86_64.rpm

3、启动

systemctl start telegraf.service

# 配置文件:/etc/telegraf/telegraf.conf
# 子配置文件:/etc/telegraf/telegraf.d/*.conf

4、Telegraf 配置

vim /etc/telegraf/telegraf.conf

[[outputs.prometheus_client]]
#   ## Address to listen on
    listen = ":9273"

5、重启 telegraf

systemctl restart telegraf.service

6、Promethue 配置

vim /usr/local/prometheus/prometheus.yml

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
    - targets: ['localhost:9090']
    
  - job_name: 'info'
    static_configs:
    - targets: ['10.20.10.5:9273']

7、重启 promethue

systemctl restart prometheus.service

8、再次验证 Promethue 采集的数据

浏览器访问:http://10.20.10.4:9090/graph
#在输入框输入关键字查看是否采集到其他服务器数据

2.3 Grafana 部署

1、安装

# 服务器上传或wget下载grafana-7.5.3-1.x86_64.rpm安装包。
yum localinstall -y grafana-7.5.3-1.x86_64.rpm

2、启动

systemctl start grafana-server 
systemctl enable grafana-server

3、验证

浏览器访问 http://10.20.10.4:3000/ 就到了登录界面
默认登录用户:admin
默认登录密码:admin

4、导入相关模板(或自定义)

比较简单,导入详细过程省略。
# 注意导入后的模板的变量,可能要做相关的修改。

点击此处查看更多模板

三、验证

如下图,数据采集成功:

在这里插入图片描述

四、FAQ

部署都非常简单,基本上不会出现什么问题,主要注意的是在导入 Grafana 模板时变量和数据源的修改,以及相应的参数调整。对于使用Promethue进行监控,需要对Linux系统有扎实的理论基础,因为要做很多的数学运算。

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云计算-Security

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值