0
点赞
收藏
分享

微信扫一扫

centos8 安装influxdb+telegraf+grafana

秦瑟读书 2022-04-17 阅读 101
自动化

端口说明

8083:访问web页面的地址,8083为默认端口;

8086:数据写入influxdb的地址,8086为默认端口;

8088:数据备份恢复地址,8088为默认端口;

#安装
yum -y install wget https://dl.influxdata.com/influxdb/releases/influxdb-1.7.8.x86_64.rpm
#启动,并设置自启
systemctl start influxdb
systemctl enable influxdb
influxd
#停止服务
systemctl stop influxdb

systemctl start influxdb

systemctl enable influxdb​​​​​​​

#打开influx数据库
influx
#创建用户
CREATE USER QGS WITH PASSWORD '111111' WITH ALL PRIVILEGES
#查询用户
SHOW USERS
#创建数据库
CREATE DATABASE QGS
#查询数据库
SHOW DATABASES

2.CentOS下安装telegraf


wget https://dl.influxdata.com/telegraf/releases/telegraf-1.20.4-1.x86_64.rpm
sudo yum localinstall telegraf-1.20.4-1.x86_64.rpm

     安装完成后配置文件的默认路径在/etc/telegraf/telegraf.conf

    修改配置文件将数据指向数据源,这里我用的是本地的Influxdb

sudo vi /etc/telegraf/telegraf.conf


# Configuration for sending metrics to InfluxDB
[[outputs.influxdb]]
## The full HTTP or UDP URL for your InfluxDB instance.
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.
# urls = ["unix:///var/run/influxdb.sock"]
# urls = ["udp://127.0.0.1:8089"]
urls = ["http://127.0.0.1:8086"]

## The target database for metrics; will be created as needed.
## For UDP url endpoint database needs to be configured on server side.
database = "telegraf"

开启telegraf服务,这时telegraf开始收集本机数据并发送到influxdb

systemctl start telegraf
[vagrant@td ~]$ influx
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> SHOW DATABASES
name: databases
name
----
_internal
test
telegraf
> USE telegraf
Using database telegraf
> SHOW MEASUREMENTS
name: measurements
name
----
cpu
disk
diskio
kernel
mem
processes
swap
system
> select * from "mem" limit 5

3 安装 grafana 

镜像地址:下载飞快

Index of /grafana/yum/rpm/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror


wget https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm/grafana-7.5.8-1.x86_64.rpm

启动  grafana

systemctl start grafana-server

systemctl enable grafana-server

浏览器访问3000端口

3.1 选择大屏模板  Dashboards | Grafana Labs

 选择模板 得到id直接导入 简单粗暴

//-----------

举报

相关推荐

0 条评论