性能测试-JMeter influxdb grafana性能测试监控平台-食用指南

2023-10-26

目录

influxdb+grafana安装

influxdb+grafana启动

JMeter性能数据写入influxdb

JMeter-后端监听器

grafana配置


influxdb+grafana安装

yum install influxdb-1.7.0.x86_64.rpm
yum install grafana-7.4.3-1.x86_64.rpm

influxdb+grafana启动

#启动命令

influxd

#守护进程启动命令
nohup influxd &

#启动grafana
systemctl restart grafana-server

启动成功后,发现使用http协议,并且端口:8086

2022-11-07T16:03:57.271232Z     info    Listening on HTTP       {"log_id": "0e0iBjF0000", "service": "httpd", "addr": "[::]:8086", "https": false}
[root@centos7 upload]# influxd

 8888888           .d888 888                   8888888b.  888888b.
   888            d88P"  888                   888  "Y88b 888  "88b
   888            888    888                   888    888 888  .88P
   888   88888b.  888888 888 888  888 888  888 888    888 8888888K.
   888   888 "88b 888    888 888  888  Y8bd8P' 888    888 888  "Y88b
   888   888  888 888    888 888  888   X88K   888    888 888    888
   888   888  888 888    888 Y88b 888 .d8""8b. 888  .d88P 888   d88P
 8888888 888  888 888    888  "Y88888 888  888 8888888P"  8888888P"

2022-11-07T16:03:57.116329Z     info    InfluxDB starting       {"log_id": "0e0iBjF0000", "version": "1.7.0", "branch": "1                                                                                          .7", "commit": "dac4c6f571662c63dc0d73346787b8c7f113222a"}
2022-11-07T16:03:57.116344Z     info    Go runtime      {"log_id": "0e0iBjF0000", "version": "go1.11", "maxprocs": 1}
2022-11-07T16:03:57.270956Z     info    Using data dir  {"log_id": "0e0iBjF0000", "service": "store", "path": "/var/lib/in                                                                                          fluxdb/data"}
2022-11-07T16:03:57.271045Z     info    Compaction settings     {"log_id": "0e0iBjF0000", "service": "store", "max_concurr                                                                                          ent_compactions": 1, "throughput_bytes_per_second": 50331648, "throughput_bytes_per_second_burst": 50331648}
2022-11-07T16:03:57.271055Z     info    Open store (start)      {"log_id": "0e0iBjF0000", "service": "store", "trace_id":                                                                                           "0e0iBjql000", "op_name": "tsdb_open", "op_event": "start"}
2022-11-07T16:03:57.271076Z     info    Open store (end)        {"log_id": "0e0iBjF0000", "service": "store", "trace_id":                                                                                           "0e0iBjql000", "op_name": "tsdb_open", "op_event": "end", "op_elapsed": "0.022ms"}
2022-11-07T16:03:57.271092Z     info    Opened service  {"log_id": "0e0iBjF0000", "service": "subscriber"}
2022-11-07T16:03:57.271097Z     info    Starting monitor service        {"log_id": "0e0iBjF0000", "service": "monitor"}
2022-11-07T16:03:57.271101Z     info    Registered diagnostics client   {"log_id": "0e0iBjF0000", "service": "monitor", "n                                                                                          ame": "build"}
2022-11-07T16:03:57.271105Z     info    Registered diagnostics client   {"log_id": "0e0iBjF0000", "service": "monitor", "n                                                                                          ame": "runtime"}
2022-11-07T16:03:57.271109Z     info    Registered diagnostics client   {"log_id": "0e0iBjF0000", "service": "monitor", "n                                                                                          ame": "network"}
2022-11-07T16:03:57.271115Z     info    Registered diagnostics client   {"log_id": "0e0iBjF0000", "service": "monitor", "n                                                                                          ame": "system"}
2022-11-07T16:03:57.271123Z     info    Starting precreation service    {"log_id": "0e0iBjF0000", "service": "shard-precre                                                                                          ation", "check_interval": "10m", "advance_period": "30m"}
2022-11-07T16:03:57.271129Z     info    Starting snapshot service       {"log_id": "0e0iBjF0000", "service": "snapshot"}
2022-11-07T16:03:57.271134Z     info    Starting continuous query service       {"log_id": "0e0iBjF0000", "service": "cont                                                                                          inuous_querier"}
2022-11-07T16:03:57.271139Z     info    Starting HTTP service   {"log_id": "0e0iBjF0000", "service": "httpd", "authenticat                                                                                          ion": false}
2022-11-07T16:03:57.271144Z     info    opened HTTP access log  {"log_id": "0e0iBjF0000", "service": "httpd", "path": "std                                                                                          err"}
2022-11-07T16:03:57.271232Z     info    Listening on HTTP       {"log_id": "0e0iBjF0000", "service": "httpd", "addr": "[::                                                                                          ]:8086", "https": false}
2022-11-07T16:03:57.271245Z     info    Starting retention policy enforcement service   {"log_id": "0e0iBjF0000", "service                                                                                          ": "retention", "check_interval": "30m"}
2022-11-07T16:03:57.271420Z     info    Listening for signals   {"log_id": "0e0iBjF0000"}
2022-11-07T16:03:57.271688Z     info    Storing statistics      {"log_id": "0e0iBjF0000", "service": "monitor", "db_instan                                                                                          ce": "_internal", "db_rp": "monitor", "interval": "10s"}
2022-11-07T16:03:57.271806Z     info    Sending usage statistics to usage.influxdata.com        {"log_id": "0e0iBjF0000"}

使用nohup命令后,查询一下linux后台是否有influxdb运行起来

[root@centos7 influxdb]# ps -ef |grep influxdb
root      8332  1436  0 00:31 pts/0    00:00:00 grep --color=auto influxdb

连接influxdb数据库命令&查询数据库&创建数据库&查看有哪些表

#连接数据库命令
influx

#查询influxdb下的数据库有哪些
show databases
-----------------
name: databases
name
----
_internal

#创建数据库命令
create database "jmeter"

#使用指定的数据库
> use jmeter
Using database jmeter

#查看当前使用的数据库中的表有哪些
> show measurements

Connected to http://localhost:8086 version 1.7.0
InfluxDB shell version: 1.7.0
Enter an InfluxQL query

检查一下grafana是否有启动起来

[root@centos7 influxdb]# ps -ef |grep grafana
root     16217  1436  0 00:50 pts/0    00:00:00 grep --color=auto grafana
[root@centos7 influxdb]#

[root@centos7 influxdb]# systemctl restart grafana-server

[root@centos7 influxdb]# ps -ef |grep grafana
grafana  16798     1  9 00:51 ?        00:00:00 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=rpm cfg:default.paths.logs=/var/log/grafana cfg:default.paths.data=/var/lib/grafana cfg:default.paths.plugins=/var/lib/grafana/plugins cfg:default.paths.provisioning=/etc/grafana/provisioning
root     16829  1436  0 00:51 pts/0    00:00:00 grep --color=auto grafana

JMeter性能数据写入influxdb

JMeter-后端监听器

英文 中文 路径
Backend Listener 后端监听器 右键一个线程组-Thread Group-Add-Listener-Backend Listener

 Backend Listener implementaition:org.apache.jmeter.visualizers.backend.influxdb.influxdbBackendListenerClient

influxdbUrl:192.168.1.216:8086/write?db=jmeter,db=jmeter 就是influxdb的库名

measurements:jmeter,表的名字,默认

查看influxdb表里面的数据

JMeter测试脚本跑起来,在influxdb服务看看数据里面的数据,原来influxdb的jmeter库里面没有表,当JMeter脚本运行的时候,influxdb会自动创建好表并有数据写入

#查看influxdb数据库
> select * from jmeter
name: jmeter
time                application      avg               count countError endedT hit max maxAT meanAT min minAT pct90.0 pct9                                                                                          5.0            pct99.0            rb    sb    startedT statut transaction
----                -----------      ---               ----- ---------- ------ --- --- ----- ------ --- ----- ------- ----                                                                                          ---            -------            --    --    -------- ------ -----------
1667840498452000000 application name                                    0              0     0          0                                                                                                                                                         0               internal
1667840503119000000 application name 85.98113207547169 53    0                 53  533              69        78.6    169.                                                                                          99999999999923 533                17169 19769          all    all
1667840503119000000 application name                                    0              1     1          1                                                                                                                                                         1               internal
1667840508117000000 application name 71.42             70    0                 70  87               69        74      76                                                                                                           86.96999999999998  24014 26110          all    all
1667840508117000000 application name                                    0              1     1          1                                                                                                                                                         1               internal
1667840513118000000 application name 71.31             70    0                 70  87               68        75      77                                                                                                           86.95999999999998  24984 26110          all    all
1667840513118000000 application name                                    0              1     1          1                                                                                                                                                         1               internal
1667840518118000000 application name 72.06             69    0                 69  96               68        78      80.9                                                                                          4999999999999  96                 20788 25737          all    all
1667840518118000000 application name                                    0              1     1          1                                                                                                                                                         1               internal
1667840523117000000 application name 72.25             68    0                 68  96               68        79.9    81.9                                                                                          4999999999999  95.90999999999995  23221 25364          all    all
1667840523117000000 application name                                    0              1     1          1                                                                                                                                                         1               internal
1667840528117000000 application name 71.57             70    0                 70  86               68        76      77.9                                                                                          4999999999999  85.95999999999998  24697 26110          all    all
1667840528117000000 application name                                    0              1     1          1                                                                                                                                                         1               internal
1667840533118000000 application name 71.88             70    0                 70  104              68        77      78                                                                                                           103.81999999999991 22440 26110          all    all
1667840533118000000 application name                                    0              1     1          1                                                                                                                                                         1               internal
1667840538119000000 application name 72.21             68    0                 68  96               68        79.9    84.8                                                                                          4999999999997  95.93999999999997  22255 25364          all    all
1667840538119000000 application name                                    0              1     1          1                                                                                                                                                         1               internal
1667840543118000000 application name 72.16             69    0                 69  95               68        79      81.9                                                                                          4999999999999  94.94999999999997  23476 25737          all    all
1667840543118000000 application name                                    0              1     1          1                                                                                                                                                         1               internal
1667840548119000000 application name 70.92             71    0                 71  81               68        74      76.9                                                                                          4999999999999  81                 24273 26483          all    all
1667840548119000000 application name                                    0              1     1          1                                                                                                                                                         1               internal
1667840553118000000 application name 72.34             68    0                 68  93               68        79.9    85.8                                                                                          9999999999998  92.99              23857 25364          all    all
1667840553118000000 application name                                    0              1     1          1                                                                                                                                                         1               internal
1667840558119000000 application name 73.06             69    0                 69  92               67        82.9    85.8                                                                                          9999999999998  92                 25432 25737          all    all
1667840558119000000 application name                                    0              1     1          1                                                                                                                                                         1               internal

grafana配置

查看grafana日志,发现端口3000,http协议

http://192.168.1.216:3000/login

#grafana日志存放路径
[root@centos7 var]# cd /var/log
[root@centos7 log]# cd grafana

#实时查看grafana日志信息
[root@centos7 grafana]# tail -f grafana.log
t=2022-11-08T00:51:25+0800 lvl=info msg="Executing migration" logger=migrator id="create cache_data table"
t=2022-11-08T00:51:25+0800 lvl=info msg="Executing migration" logger=migrator id="add unique index cache_data.cache_key"
t=2022-11-08T00:51:25+0800 lvl=info msg="Executing migration" logger=migrator id="create short_url table v1"
t=2022-11-08T00:51:25+0800 lvl=info msg="Executing migration" logger=migrator id="add index short_url.org_id-uid"
t=2022-11-08T00:51:25+0800 lvl=info msg="Created default admin" logger=sqlstore user=admin
t=2022-11-08T00:51:25+0800 lvl=info msg="Created default organization" logger=sqlstore
t=2022-11-08T00:51:25+0800 lvl=info msg="Starting plugin search" logger=plugins
t=2022-11-08T00:51:25+0800 lvl=info msg="Registering plugin" logger=plugins id=input
t=2022-11-08T00:51:25+0800 lvl=info msg="External plugins directory created" logger=plugins directory=/var/lib/grafana/plu                                                                                          gins
t=2022-11-08T00:51:25+0800 lvl=info msg="HTTP Server Listen" logger=http.server address=[::]:3000 protocol=http subUrl= so                                                                                          cket=

成功打开grafana首页,提示一下如果进入不了,要关闭linux的防火墙

/usr/lib/systemd/system/firewalld.service; disabled

Active: inactive (dead)

[root@centos7 grafana]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@centos7 grafana]#

成功打开grafana首页

grafana登录成功

 grafana添加第一个数据源

使用influxdb的数据

 配置influxdb连接池选项

Query Language:InfluxQL

 URL:http://192.168.1.216:8086

Database:jmeter

其他选项保持默认,点击save&test,有显示绿色的条条(Data source is working)就可以了

 

 

 配置grafana输出的模板

查找模板:Grafana: The open observability platform | Grafana Labs

模板ID:5496(Apache JMeter Dashboard using Core InfluxdbBackendListenerClient)点击load

 grafana influxdb模板id:5496,可以下载为json,在grafana里面再导入也可以

 添加模板页面:数据库名称:influxdb,其他默认,点击import

 选择数据面板上面的自动刷新时间,或查看某时间段的数据

grafana数据面板

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

性能测试-JMeter influxdb grafana性能测试监控平台-食用指南 的相关文章

  • 操作系统如何知道缺失页面的磁盘地址?

    分页充当虚拟地址空间和物理地址空间之间的间接层 给定一个地址 操作系统 OS 内存管理单元 MMU 将其转换为主内存位置 我的问题是 主内存中不存在该页面的情况 操作系统如何知道在磁盘上哪里可以找到该页面 它在哪里存储1的信息 它不存储在页
  • 如何重新安装最新的cmake版本?

    我想在Linux环境下安装cmake的最新版本 我安装了 cmake 3 5 版 但某些应用程序不支持 我尝试通过卸载当前版本来升级它 但是当我使用 sudo apt get install cmake 重新安装时 我重新安装了相同的版本
  • Shell 脚本对文件进行计数,然后删除最旧的文件

    我是 shell 脚本新手 所以我需要一些帮助 我有一个充满备份的目录 如果我有超过 10 个备份文件 我想删除最旧的文件 以便仅留下 10 个最新的备份文件 到目前为止 我知道如何计算文件数 这看起来很简单 但是如果计数超过 10 我该如
  • VS Code 不会构建具有多个 .cpp 源文件的 C++ 程序

    请注意 我在 Ubuntu 17 10 上使用 VS Code 并使用 GCC 编译器 我在构建一个使用附加 cpp 文件的简单程序时遇到问题 我可能在这里遗漏了一些明显的东西 因为我对编程相当陌生 但我会解释到目前为止我所做的事情 这阻止
  • 输出bash脚本的结果

    例如 如果我选择运行一个 bash 脚本 该脚本将输出 回显 时间 例如CheckDate sh 我如何从 Java 运行它 然后在我的 Java 程序中打印 bash 脚本的结果 日期 试试这个代码 String result null
  • 将静态链接的 elf 二进制文件转换为动态链接的

    我有一个 elf 二进制文件 它已静态链接到 libc 我无权访问其 C 代码 我想使用 OpenOnload 库 它在用户空间中实现了套接字 因此与标准 libc 版本相比提供了更低的延迟 OpenOnload 实现标准套接字 api 并
  • 如何有效地将许多文件移动到新服务器?

    我正在更换托管提供商 需要将数百万个上传的文件传输到新服务器 所有文件都位于同一目录中 是的 你读对了 过去我这样做过 压缩源服务器中的所有文件 scp到新服务器的 zip Unzip Move directory to appropria
  • 系统调用:sys_exit()、SYS_exit 和 exit() 之间的区别

    SYS exit sys exit 和 exit 之间有什么区别 我的理解是 Linux内核提供了系统调用 这些调用在man 2 syscalls 这些系统调用的包装函数由glibc它们的名称与系统调用大多相似 我的问题 在man 2 sy
  • 无法从外部 bash 脚本正确设置 MySQL 密码

    我有两个脚本 主要的一个脚本执行一些不同的操作并调用第二个脚本 第二个脚本安装 MySQL 从我的主脚本中我做了这样的事情 read p Set the password for the database min 4 characters
  • 将文件夹中结构化的预构建文件集添加到 android out 文件夹

    我为arm编译了glibc 这与Android glibc或bionic C不同 因为我编译的glibc环境将有助于提供更多api 现在我可以在 Android 运行时将 glibc 环境复制到 system 文件夹中 并且在执行 chro
  • 使 .jmx 文件在 Windows 10 上使用 jmeter GUI 默认打开(双击文件)

    当我双击它时 我试图让我的 Windows 10 使用 jmeter GUI 打开 jmx 文件 我使用 apache jmeter 3 2 目前 为了打开 jmx 文件 我打开 jmeter jar apache jmeter 3 2 b
  • 出现错误 /usr/bin/env: 节点:权限被拒绝

    我已经在我的服务器 Centos 上完成了 ODOO v9 安装 一切都已安装成功 登录页面也可以正常工作 但登录后我收到一个包含以下错误的页面 usr bin env node Permission Denied 我尝试更改权限 但我的问
  • 为什么 com.ibm.jms.JMSTextMessage 类型的变量会打印截断的内容和省略号 (...)?

    我想了解为什么 com ibm jms JMSTextMessage 类型的变量在转换为字符串时会打印出截断的内容和省略号 我在 JMeter 的 JSR223 Sampler 中有以下代码 import com ibm msg clien
  • python kivy在矩形内添加文本

    如何在矩形内添加文本 我使用下面的代码并在画布内添加了一个标签 希望它能显示在矩形内 import kivy from kivy app import App from kivy uix anchorlayout import Anchor
  • ELF 文件头

    关于 elf 文件头的一个简单问题 我似乎找不到任何关于如何在 elf 头中添加 更改字段的有用信息 我希望能够更改幻数并向标题添加构建日期 以及可能的其他一些内容 据我了解 链接器创建标头信息 但我在 LD 脚本中没有看到任何引用它的内容
  • Python 在打开套接字时可以选择哪个网络适配器吗?

    运行 python 应用程序的目标计算机将具有三个可用的网络接口 一般来说 所有三个网络都会有很大不同 但是三个网络中的两个可能位于相似的网络上 在下面的示例中 我无法控制 ETH 2 上的目标地址 因为它是预先配置的系统 因此我被迫以编程
  • 编辑 CMakeLists.txt 以使用 -fPIC 进行编译

    我正在尝试为名为 libnifalcon 的 NOVINT Falcon 安装驱动程序 我使用 cmake 创建 make 文件 但是当我运行 make 时出现错误 Linking CXX shared library lib libnif
  • Qt 的 sysroot 和前缀选项的实际示例是什么

    我正在查看可以运行的所有选项configureQt 提供的脚本 特别是 qt everywhere opensource src 5 2 0 经过大量搜索后 我确定这些东西充其量记录很少 所以我希望我能得到一些帮助 当我查看描述时prefi
  • 不同 Perl 安装造成的混乱

    我尝试升级 Perl 却把我的电脑搞得一团糟 我目前运行的是 RHEL6 5 64 位 事情是这样的 我安装了 perl 5 10 1 并且运行良好 这是安装好的 我可以从百胜看到它 我想安装 Padre 一个 Perl IDE 但这至少需
  • 在C中获取终端宽度?

    我一直在寻找一种从 C 程序中获取终端宽度的方法 我不断想出的是这样的东西 include

随机推荐