效果图展示:
系统部署架构介绍:
以下为安装步骤,尽量使用我给出的软件包安装,之前搭建过程中遇到软件版本的问题导致安装失败。以下版本亲测可用。
1.安装环境:win10
2.所装软件如下:
influxdb1.4.2:https://pan.baidu.com/s/1cqrSsD0W-IvzF6LMnXbUXA
grafana5.4.2: https://pan.baidu.com/s/1LZvA-0Uz83ydL4cjZC3L5g
telegraf1.9.1: https://pan.baidu.com/s/15Ss8C6j6Q6ml-zb5UZdkVg
chronograf1.7.2:https://pan.baidu.com/s/1TXDq8zBzVo3rxHYOwFPx8Q(可选,用来操作influxdb的工具,不安装的话,可以通过influxdb自带的工具进行操作)
3.安装步骤:
1.先装influxdb,下载解压,运行influxd.exe,
运行influx.exe,然后在此程序打开的窗口内,用命令行的方式创建jmeter数据库,如下图所示:
(1):创建jmeter数据库
(2):查看所有数据库
(如果需要web页面展示,安装chronograf装好之后用localhost:8888登录,配置类似grafana,但是个人觉得没有必要做这一步,用命令行操作方式B格更高)。
2.装grafana,下载解压,运行bin下grafana-server.exe
在浏览器输入http://localhost:3000
用admin、admin登录,
1.创建数据源
2.导入模板
这里给出一个自己配置的模板:
https://pan.baidu.com/s/1k5C4_6XeEnS47F2c5CADdQ
完成之后就跳转到了本文首页展示的页面了
温馨提示:
grafana官网提供模板下载:
https://grafana.com/dashboards
在这里就可以下载到需要的模板。
3.jmeter配置如下:
4.运行jmeter,查看数据变化,如果有数据,则成功。
3.安装telegraf,
这是收集服务器资源的工具,需要安装在服务器上,安装好之后只需要在config改如下:
## Run telegraf in quiet mode (error log messages only).
quiet = false
## Specify the log file name. The empty string means to log to stderr.
logfile = "./telegraf.log" //日志地址修改
## Override default hostname, if empty use os.Hostname()
hostname = ""
## If set to true, do no set the "host" tag in the telegraf agent.
omit_hostname = false
###############################################################################
# OUTPUTS #
###############################################################################
# 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://localhost:8086"] //此地址为influxdb的ip地址
如果想改变抓取数据频率,则修改如下:
# Configuration for telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "2s" //默认为10
## Rounds collection interval to 'interval'
## ie, if interval="10s" then always collect on :00, :10, :20, etc.
round_interval = true
## Telegraf will send metrics to outputs in batches of at most
## metric_batch_size metrics.
## This controls the size of writes that Telegraf sends to output plugins.
metric_batch_size = 1000
## For failed writes, telegraf will cache metric_buffer_limit metrics for each
## output, and will flush this buffer on a successful write. Oldest metrics
## are dropped first when this buffer fills.
## This buffer only fills when writes fail to output plugin(s).
metric_buffer_limit = 10000
## Collection jitter is used to jitter the collection by a random amount.
## Each plugin will sleep for a random time within jitter before collecting.
## This can be used to avoid many plugins querying things like sysfs at the
## same time, which can have a measurable effect on the system.
collection_jitter = "0s"
## Default flushing interval for all outputs. Maximum flush_interval will be
## flush_interval + flush_jitter
flush_interval = "2s" //默认为10
## Jitter the flush interval by a random amount. This is primarily to avoid
## large write spikes for users running a large number of telegraf instances.
## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s
flush_jitter = "0s"
启动用如下命令telegraf -config telegraf.conf
注:如果想修改jmeter抓取频率则修改jmeter的配置文件:
Summariser - Generate Summary Results - configuration (mainly applies to non-GUI mode)
#---------------------------------------------------------------------------
#
# Comment the following property to disable the default non-GUI summariser
# [or change the value to rename it]
# (applies to non-GUI mode only)
summariser.name=summary
#
# interval between summaries (in seconds) default 30 seconds
summariser.interval=1 //改这里可以改变刷新频率
#
# Write messages to log file
#summariser.log=true
注意:
在jmeter的脚本中,事务控制器名称中不能出现“/”和因为字符“()”,否则拿不到数据