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、最大响应时间

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

相关推荐
Trouvaille ~35 分钟前
【Linux】TCP Socket编程实战(一):API详解与单连接Echo Server
linux·运维·服务器·网络·c++·tcp/ip·socket
liann11936 分钟前
3.1_网络——基础
网络·安全·web安全·http·网络安全
独行soc1 小时前
2026年渗透测试面试题总结-17(题目+回答)
android·网络·安全·web安全·渗透测试·安全狮
辣香牛肉面1 小时前
Wireshark v4.6.2 开源免费网络嗅探抓包工具中文便携版
网络·测试工具·wireshark
全栈工程师修炼指南1 小时前
Nginx | stream 四层反向代理:SSL、PREREAD 阶段模块指令浅析与实践
运维·网络·网络协议·nginx·ssl
M158227690551 小时前
TCP转LORA产品说明及应用案例
网络·网络协议·tcp/ip
旖旎夜光1 小时前
Linux(13)(中)
linux·网络
来可电子CAN青年1 小时前
CAN总线远距离传输老断网?Fx灯不闪别慌,这几招让你的通信“稳如泰山”!
网络
独行soc1 小时前
2026年渗透测试面试题总结-18(题目+回答)
android·网络·安全·web安全·渗透测试·安全狮
云小逸1 小时前
【nmap源码解析】Nmap OS识别核心模块深度解析:osscan2.cc源码剖析(1)
开发语言·网络·学习·nmap