telegraf1.8+influxdb1.6+grafana5.2 环境搭建 结合JMeter3.2
telegraf1.8+influxdb1.6+grafana5.2 环境搭建 结合JMeter3.2
参考地址:https://blog.csdn.net/laisinanvictor/article/details/80007356
1)配置yum源
#配置yum源 /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
2)安装telegraf
#收集系统和服务的统计数据 , 并写入到 InfluxDB数据库 , 在需要监控的机器上安装
yum -y install telegraf
#配置文件路径
/etc/telegraf/telegraf.conf
#设置开机时启动
systemctl enable telegraf.service
#启动
systemctl start telegraf
systemctl status telegraf
#例子:配置Telegraf(这里用不到,所以不用配置)
[root@monitor src]# vim /etc/telegraf/telegraf.conf
## 修改内容如下
# Configuration for influxdb server to send metrics to
[[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"]
urls = ["http://10.1.5.49:8086"]
## The target database for metrics; will be created as needed.
# database = "telegraf"
database = "ip_214_70_stat"
systemctl restart telegraf
#卸载telegraf(重装时需要卸载)
rm -rf telegraf
rm -rf /etc/systemd/system/multi-user.target.wants/telegraf.service
#检查Telegraf配置
systemctl status telegraf
#状态是running说明配置加载成功
3)安装influxdb
#时序数据库,默认端口为Web端8083,API端8086,默认登陆信息admin 使用方式有点类似MySQL
#新版本 web界面功能被去掉了
#安装
yum -y install influxdb
#设置开机时启动
systemctl enable influxdb.service
#启动
systemctl start influxdb
systemctl status influxdb
#增加8083 8086端口,允许他通过防火强 influxdb:8083 8086
firewall-cmd --zone=public --add-port=8083/tcp --permanent
firewall-cmd --zone=public --add-port=8086/tcp --permanent
#重新加载防火强
firewall-cmd --reload
#查看通过防火强的端口
firewall-cmd --zone=public --list-ports
#重启防火强
systemctl restart firewalld
4)创建 Influxdb数据库
[root@monirot src]# influx
Connected to http://localhost:8086 version 1.6.3
InfluxDB shell version: 1.6.3
#重启influxdb
systemctl restart influxdb
#查看数据
打开 Influxdb 查询界面:http://你的ip地址:8086 , 输入查询语句seclect * from cpu可查询到 CPU 相关信息。
访问 influxdb
http://ip:8086/
5)安装Grafana
#访问各类数据源,自定义报表,显示图表等等, 用于提供界面监控,默认端口为3000,默认登陆信息admin
地址:https://grafana.com/grafana/download?platform=linux
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.4-1.x86_64.rpm
sudo yum -y localinstall grafana-5.2.4-1.x86_64.rpm
yum -y install fontconfig
yum -y install freetype*
yum -y install urw-fonts
安装路径 /usr/sbin/grafana-server
init.d路径 /etc/init.d/grafana-server
环境变量文件路径 /etc/sysconfig/grafana-server
ini 文件路径 /etc/grafana/grafana.ini
Installs systemd service (if systemd is available) name grafana-server.service
日志文件路径 /var/log/grafana/grafana.log
sqllite3库路径 /var/lib/grafana/grafana.db
systemctl daemon-reload
systemctl start grafana-server
systemctl status grafana-server
#设置开机时启动
systemctl enable grafana-server.service
#启动
systemctl start grafana-server
systemctl status grafana-server
随机启动
sudo systemctl enable grafana-server.service
#安装ssh服务
yum -y install openssh-server.x86_64
#增加3000端口,允许他通过防火强 Grafana:3000
firewall-cmd --zone=public --add-port=3000/tcp --permanent
#重新加载防火强
firewall-cmd --reload
#查看通过防火强的端口
firewall-cmd --zone=public --list-ports
#重启防火强
systemctl restart firewalld
#重启
systemctl restart grafana-server
#配置Grafana
http://192.168.169.131:3000 账号:admin 密码:admin 新密码为 123456
6)将JMeter压测后的结果数据,通过Grafana界面展示出来
#6-1修改influxdb配置文件
vim /etc/influxdb/influxdb.conf
#打开8086端口
[http]
# Determines whether HTTP endpoint is enabled.
enabled = true
# The bind address used by the HTTP service.
bind-address = ":8086"
# Determines whether user authentication is enabled over HTTP/HTTPS.
auth-enabled = false
#在以下地方新增 influx_db 数据库,配置好 监控 influx_db 端口号默认为 2003
[[graphite]]
# Determines whether the graphite endpoint is enabled.
enabled = true
database = "influx_db"
retention-policy = "" #influxdb上数据保存策略,参考后面设置
bind-address = ":2003"
protocol = "tcp"
consistency-level = "one"
#influxdb上数据保存策略(该步骤可忽略)
name 策略名 duration持续时间 0 无限制 shardGroupDuration shardGroup存储时间 replicaN副本个数 default 默认策略
1、新建数据保存策略
CREATE RETENTION POLICY "30d_jmeter" ON "influx_db" DURATION 30d REPLICATION 1 DEFAULT
2、删除初始策略
DROP RETENTION POLICY "autogen" ON "influx_db"
3、显示已有策略
SHOW RETENTION POLICIES on influx_db
#保存文件后,再次启动 influxdb
systemctl start influxdb
#6-2创建jmeter数据库
[root@monitor jmeter3.2]# influx
Connected to http://localhost:8086 version 1.6.3
InfluxDB shell version: 1.6.3
> create database influx_db
> use influx_db
Using database influx_db
> create user "admin" with password '123456' with all privileges
> create database graphite_db
> use graphite_db
Using database graphite_db
> create user "admin" with password '123456' with all privileges
> create database ip_214_70_stat
> use ip_214_70_stat
Using database ip_214_70_stat
> create user "admin" with password '123456' with all privileges
> show databases
name: databases
name
----
influx_db
_internal
ip_214_70_stat
> exit
#6-3在jmeter脚本文件中,新增监听器:Backend Listener
方式1:
Backend Listener implementation:保持默认 org.apache.jmeter.visualizers.backend.graphite.GraphiteBackendListenerClient
Async Quenue size:取数据的间隔 5000毫秒
graphiteMetricsSender:保持默认 org.apache.jmeter.visualizers.backend.graphite.TextGraphiteMetricsSender
graphiteHost:influxdb机器的IP地址 ip
graphitePort:influxdb中配置的端口号 默认 2003
rootMetricsPrefix:influxdb中配置的表名 jmeter. 不要更改该名字
summaryOnly:改成 false 是否统计总量
samplersList:改成 .* 请求的URL关键字.*
useRegexpForSamplersList:改成 true
percentiles:保持默认 90;95;99
#要配置对应某个请求的话,需要配置一下三项,否则保持默认就行
summaryOnly:改成 false
samplersList:改成 .*请求的URL关键字.* #summaryOnly=true,此处设置则失效,与请求的URL进行匹配,支持正则表达式,就是请求的名称是什么,这里就要配置的好去对应它
useRegexpForSamplersList:改成 true
方式2:
Backend Listener implementation:保持默认 org.apache.jmeter.visualizers.backend.influxdb.influxdbBackendListenerClient
Async Quenue size:取数据的间隔 5000毫秒
graphiteMetricsSender:保持默认 org.apache.jmeter.visualizers.backend.influxdb.HttpMetricsSender
graphiteHost:influxdb机器的IP地址 ip http://ip:8086/write?db=influx_db
application:应用名 比如:某某系统接口测试 influx_db
measurement: jmeter
summaryOnly:改成 false 是否统计总量
samplersRegex:.* 正则表达式
percentiles:保持默认 50;90;95;99
testTitle:influx_db_testTitle
eventTags:influx_db_eventTags
#6-4访问grafana http://ip:3000/
#修改配置文件
vim /etc/grafana/grafana.ini
#打开一下注释
[server]
# Protocol (http, https, socket)
protocol = http
# The ip address to bind to, empty will bind to all interfaces
;http_addr =
# The http port to use
http_port = 3000
[security]
# default admin user, created on startup
admin_user = admin
# default admin password, can be changed before first start of grafana, or in profile settings
admin_password = 123456
#配置数据库 ,保存后退出
#8086端口 是Grafana用来从数据库取数据的端口 2003端口是JMeter往数据库里面发数据的端口
name:name 随意取值
type:influxDB
HTTP
URL:http://ip:8086
Access:Server(Default)
InfluxDB Details
Database:influx_db
#创建jmeter数据库时,指定的用户,该用户可访问该jmeter数据库
user:admin Password:123456
Min time interval:10秒
#配置数据库面板 Home->dashboard->Graph->Edit
#在编辑中,选择数据库 Data Source :middleground
#压测运行完成,到图标里面就可以看到对应数据库了
jmeter.all.h.count 所有请求的TPS
jmeter.<请求名称>.h.count 对应<请求名称>的TPS
jmeter.all.ok.pct99 99%的请求响应时间
jmeter.<请求名称>.ok.pct99 对应<请求名称>99%的请求响应时间
jmeter.all.test.startedT 线程数
#安装jmeter模板,进入下面网站,选择influxdb 搜索jmeter
https://grafana.com/dashboards
选择JMeter Load Testby NovaTec-APM,之后下载Download JSON
下载文件JMeter-InfluxDB-Writer-plugin-1.2.jar 放到lib\ext目录下
在grafana中,上传刚下载的json文件到dashboard,将2个josn文件上传到grafana,导入到 dashboard 中
业务资源:资源监控面板配置参考这个文件:https://grafana.com/dashboards/4026 或https://grafana.com/dashboards/1152 或https://grafana.com/dashboards/5496(使用该模板,要用jm5.0) 通过jmeter搜索
硬件资源:资源监控面板配置参考这个文件:https://grafana.com/dashboards/3967 或https://grafana.com/dashboards/928 通过System搜索
yum -y install sysstat
telegraf.conf 配置新增以下内容
[global_tags]
[agent]
interval = "15s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "15s"
flush_jitter = "0s"
precision = ""
debug = false
quiet = false
logfile = ""
hostname = ""
omit_hostname = false
[[outputs.influxdb]]
retention_policy = ""
write_consistency = "any"
timeout = "5s"
username = "my login"
password = "my password"
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = true
report_active = true
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs"]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]
[[inputs.net]]
[[inputs.netstat]]
[[inputs.sysstat]]
activities = ["DISK"]
[inputs.sysstat.options]
-C = "cpu"
-B = "paging"
-b = "io"
-d = "disk"
"-n ALL" = "network"
"-P ALL" = "per_cpu"
-q = "queue"
-r = "mem_util"
-S = "swap_util"
-u = "cpu_util"
-v = "inode"
-W = "swap"
-w = "task"
telegraf1.8+influxdb1.6+grafana5.2 环境搭建 结合JMeter3.2的更多相关文章
- 项目实战 Prometheus环境搭建
项目摘要: 本文是搭建一套prometheus环境的教程. 前期准备:准备三台虚拟机,本文以centos7为例. 项目具体实施:分别进入每台虚拟机设置hostname:# hostnamectl se ...
- .NET Core系列 : 1、.NET Core 环境搭建和命令行CLI入门
2016年6月27日.NET Core & ASP.NET Core 1.0在Redhat峰会上正式发布,社区里涌现了很多文章,我也计划写个系列文章,原因是.NET Core的入门门槛相当高, ...
- Azure Service Fabric 开发环境搭建
微服务体系结构是一种将服务器应用程序构建为一组小型服务的方法,每个服务都按自己的进程运行,并通过 HTTP 和 WebSocket 等协议相互通信.每个微服务都在特定的界定上下文(每服务)中实现特定的 ...
- rnandroid环境搭建
react-native 环境搭建具体步骤这个大家已经玩烂了,这个主要是记录下来自己做win7系统遇到的坑 1.com.android.ddmlib.installexception 遇到这个问题,在 ...
- python开发环境搭建
虽然网上有很多python开发环境搭建的文章,不过重复造轮子还是要的,记录一下过程,方便自己以后配置,也方便正在学习中的同事配置他们的环境. 1.准备好安装包 1)上python官网下载python运 ...
- springMVC初探--环境搭建和第一个HelloWorld简单项目
注:此篇为学习springMVC时,做的笔记整理. MVC框架要做哪些事情? a,将url映射到java类,或者java类的方法上 b,封装用户提交的数据 c,处理请求->调用相关的业务处理—& ...
- 【定有惊喜】android程序员如何做自己的API接口?php与android的良好交互(附环境搭建),让前端数据动起来~
一.写在前面 web开发有前端和后端之分,其实android还是有前端和后端之分.android开发就相当于手机app的前端,一般都是php+android或者jsp+android开发.androi ...
- Nexus(一)环境搭建
昨天,成功搭建了自己的 Maven 环境(详见:Maven(一)环境搭建),今天就来研究和探讨下 Nexus 的搭建! 使用背景: 安装环境:Windows 10 -64位 JDK版本:1.7 Mav ...
- 「译」JUnit 5 系列:环境搭建
原文地址:http://blog.codefx.org/libraries/junit-5-setup/ 原文日期:15, Feb, 2016 译文首发:Linesh 的博客:环境搭建 我的 Gith ...
随机推荐
- Autofac依赖注入框架使用
简介: Autofac是一款IOC框架,比较于其他的IOC框架,如Spring.NET,Unity,Castle等等所包含的,它很轻量级性能上非常高 控制反转和依赖注入: 控制反转 IOC(Inver ...
- [poj1830]开关问题(高斯消元)
题意:求高斯消元中自由元的个数,输出1<<ans; #include<cstdio> #include<cstdlib> #include<cstring&g ...
- dpdk学习笔记2
一 了解dpdk准备知识 1 NAT NAT技术是为了缓解IPV4地址枯竭得问题,通过使用NAT技术,一个机构如学校可以只用单一得公网IP来范文互联网,在外界看来只有一台接入公网得设备.NAT分为两种 ...
- 【机器学习】支持向量机SVM
关于支持向量机SVM,这里也只是简单地作个要点梳理,尤其是要注意的是SVM的SMO优化算法.核函数的选择以及参数调整.在此不作过多阐述,单从应用层面来讲,重点在于如何使用libsvm,但对其原理算法要 ...
- Go中函数作为值、类型传递。
在Go中函数也是一种变量,我们可以通过type来定义它,它的类型就是所有拥有相同的参数,相同的返回值的一种类型 type typeName func(input1 inputType1 , input ...
- 编译出arm Android环境下的C++可执行文件
要想编译出arm环境的C++可执行文件主要就是利用交叉编译器进行编译.编译过程本身都大同小异. 1.安装交叉编译器,交叉编译器的安装方法大致有下面几种: A.debian/ubuntu 系统可以直接输 ...
- jzoj6005. 【PKUWC2019模拟2019.1.17】数学 (生成函数+FFT+抽代+高精)
题面 题解 幸好咱不是在晚上做的否则咱就不用睡觉了--都什么年代了居然还会出高精的题-- 先考虑如果暴力怎么做,令\(G(x)\)为\(F(n,k)\)的生成函数,那么不难发现\[G^R(x)=\pr ...
- Python学习笔记(字典)
今天学习一个python中的基本类型--字典(dictionary) 字典这种数据结构有点像我们平常用的通讯录,有一个名字和这个名字对应的信息.在字典中,名字叫做“键”,对应的内容信息叫做“值”.字典 ...
- mac 增加/usr/bin目录的操作无权限
起因:想要往/usr/bin目录下拷贝文件,提示: operation not permitted 解决办法: 1. 重启,启动中长安command+r进入恢复模式 2.顶部菜单拉中打开终端 3. 输 ...
- Mac客户端CentOS服务器 SSH免密码登陆
假定有2个服务器A(127.0.0.1)和B(192.168.0.1),A作为客户端来登录服务器B 1.在服务器A下使用 ssh-keygen -t ras -P 会在-/.ssh目录下'生成公钥(i ...