telegraf、influxdb、grafana安装配置及后端监听器操作

InfluxDB(时序数据库),常用的一种使用场景:监控数据统计。

grafana,用作监控页面的前端展示。

telegraf,数据采集器。

ITG及快捷启动百度网盘:百度网盘

链接: 提取码: 0000

其他地址链接:https://repos.influxdata.com/rhel/7/x86_64/stable/

一、Influxdb安装及配置

下载:wget https://dl.influxdata.com/influxdb/releases/influxdb-1.7.9.x86_64.rpm

解压:yum localinstall influxdb-1.7.9.x86_64.rpm

启动:systemctl start influxd

查看开启状态和端口号:

默认情况下,InfluxDB会使用如下的端口:

  • TCP8086端口是服务器监听端口,对HTTP API响应
  • TCP8088端口是RPC服务端口,用于数据备份和保存
bash 复制代码
systemctl status influxd  
netstat -tnlp

创建 Influxdb 数据库:

bash 复制代码
influx
create database telegraf  或者 create database jmeter
show databases
exit

默认端口是 8086

二、Telegraf安装及配置

  1. 下载与安装
bash 复制代码
wget http://get.influxdb.org/telegraf/telegraf-0.12.1-1.x86_64.rpm
yum localinstall telegraf-0.12.1-1.x86_64.rpm

Tips:如果上面没反应或者报错,使用百度云盘先上传到所在服务器中

链接: telegraf 百度云盘

提取码: 0000

在使用命令安装(有y按y)

bash 复制代码
yum localinstall telegraf-1.7.3-1.x86_64.rpm
  1. 配置
bash 复制代码
vi /etc/telegraf/telegraf.conf

输入 /urls

输入 i

修改内容如下

urls = ["http://localhost:8086"] #infulxdb 地址

database = "telegraf" #数据库

retention_policy = "" 必须设置为空

输入 :wq

  1. 启动 Telegraf

    systemctl restart telegraf

  2. 检查 Telegraf 配置,出现如下running代表配置成功

    service telegraf status

三、grafana导入模板是 5496

Name可以更改为: RT_TPS_ERROR

用来展示并监控聚合报告的数据,点击Import

四、Grafana安装与配置参考之前博文

  1. grafana安装参考:https://blog.csdn.net/m0_44974332/article/details/138510220?spm=1001.2014.3001.5502

启动/停止/状态

systemctl start influxd

systemctl start telegraf

systemctl start grafana-server

systemctl stop influxd

systemctl stop telegraf

systemctl stop grafana-server

systemctl status influxd

systemctl status telegraf

systemctl status grafana-server

常用命令

firewall-cmd --state ##查看防火墙运行状态,是否是 running

firewall-cmd --reload ##重新载入配置,比如添加规则之后,需要执行此命令

firewall-cmd --list-ports ##列出开放的端口

firewall-cmd --add-port=3000/tcp --permanent ##永久添加 3000 端口

systemctl stop firewalld ##关闭防火墙

systemctl start firewalld ##开启防火墙

systemctl status firewalld ##查看防火墙状态

systemctl restart firewalld ##重启防火墙

systemctl disable firewalld ##开机关闭防火墙,即永久关闭

第二种方法:

如果启动telegraf、influxdb后grafanf一直统计不到数据

排查原因:

  1. 把8086端口加入防火墙
    firewall-cmd --add-port=8086/tcp --permanent
    firewall-cmd --reload
  2. 先卸载之前的telegraf、influxdb,通过
bash 复制代码
whereis telegraf
whereis influxdb

找到的所有数据通过:rm -rf 路径 删除

  1. 更改telegraf、influxdb版本
bash 复制代码
wget https://repos.influxdata.com/rhel/7/x86_64/stable/influxdb-1.8.2.x86_64.rpm
wget https://repos.influxdata.com/rhel/7/x86_64/stable/telegraf-1.0.0.x86_64.rpm

安装

bash 复制代码
sudo yum localinstall influxdb-1.8.2.x86_64.rpm
sudo yum localinstall telegraf-1.0.0.x86_64.rpm
  1. 不需要更改配置文件,直接启动这两个服务
bash 复制代码
systemctl start influxd
systemctl start telegraf
systemctl start grafana-server    //如果grafana没启动页顺便启动

jmeter添加后端监听器


grafana配置,然后导入模板和上面配置一致

查看压测结果

主要查看吞吐量和响应时间

Throughout:单接口压测也可以更改为QPS,会依QPS为指标。混合场景压测更改为TPS,会依TPS为指标

Response Times:响应时间,从右侧可以查看出平均、90、96、99、最大响应时间

其他指标比如错误率等也可以关注

相关推荐
沐风ya5 分钟前
Reactor介绍,如何从简易版本的epoll修改成Reactor模型(demo版本代码+详细介绍)
网络
SUGERBOOM9 分钟前
【网络安全】网络基础第一阶段——第一节:网络协议基础---- OSI与TCP/IP协议
网络·网络协议·web安全
petaexpress26 分钟前
常用的k8s容器网络模式有哪些?
网络·容器·kubernetes
m0_609000423 小时前
向日葵好用吗?4款稳定的远程控制软件推荐。
运维·服务器·网络·人工智能·远程工作
suifen_5 小时前
RK3229_Android9.0_Box 4G模块EC200A调试
网络
铁松溜达py6 小时前
编译器/工具链环境:GCC vs LLVM/Clang,MSVCRT vs UCRT
开发语言·网络
衍生星球10 小时前
【网络安全】对称密码体制
网络·安全·网络安全·密码学·对称密码
掘根10 小时前
【网络】高级IO——poll版本TCP服务器
网络·数据库·sql·网络协议·tcp/ip·mysql·网络安全
友友马11 小时前
『 Linux 』HTTP(一)
linux·运维·服务器·网络·c++·tcp/ip·http