天天看點

Jmeter +InfluxDB+ Graphite+Telegraf

InfluxDB:http://docs.influxdata.com/influxdb/v1.7/introduction/installation

一、安裝:InfluxDB

建立InfluxDB下載下傳源

cat << EOF | tee /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

EOF

使用yum下載下傳InfluxDB

yum install -y influxdb

沒雲得用apt-get安裝

apt-get install -y influxdb

啟動InfluxDB

[[email protected] ~]#sudo service influxdb start

#重新開機:/bin/systemctl restart influxdb.service

進入InfluxDB

[[email protected] ~]#influx

檢視資料庫

[[email protected] ~]#show databases;

建立庫

[[email protected] ~]#create database“JMeter”;

進入庫

[[email protected] ~]#use JMeter;

建立使用者名&密碼

[[email protected] ~]#create user “JMeter”with password‘123456’with all privileges;

修改InfluxDB的配置,主要配置jmeter存儲的資料庫與端口号

[[email protected] ~]# vi /etc/influxdb/influxdb.conf

# 找到graphite并且修改它的庫與端口

[[graphite]]

enabled = true

    database = "JMeter"   JMeter代表的是庫名,後續采集到的資料存放庫

    retention-policy = ""

    bind-address = ":2003"

    protocol = "tcp"

    consistency-level = "one"

    batch-size = 5000

    batch-pending = 10

    batch-timeout = "1s"

    udp-read-buffer = 0

    separator = "."

# 找到http并且修改它的庫與端口

[[http]]

enabled=true

bind-adress=”:8086”

auth-enabled=true

使用以下-config選項将程序指向正确的配置檔案

[[email protected] ~]# influxd -config /etc/influxdb/influxdb.conf

下載下傳連接配接工具

https://blog.csdn.net/x541211190/article/details/83152068

二、安裝Telegraf,監控cpu、記憶體、磁盤

安裝

yum -y install telegraf

進入cd /etc/telegraf 配置 隻收集cpu, 記憶體和硬碟的資料

telegraf -sample-config -input-filter cpu:mem:disk -output-filter influxdb > telegraf.conf

編輯vi telegraf.conf 設定将資料傳遞寫入influxdb伺服器

[[outputs.influxdb]]

urls = ["http://127.0.0.1:8086"]

database = "telegraf"

啟動服務

service telegraf start

原文:https://www.jianshu.com/p/dfd329d30891

三、安裝:Graphite

官網位址:https://grafana.com/grafana/download

下載下傳安裝

wget https://dl.grafana.com/oss/release/grafana-5.4.2-1.x86_64.rpm

sudo yum grafana-5.4.2-1.x86_64.rpm

啟動Grafana

[[email protected] ~]# /etc/init.d/grafana-server restart

打開浏覽器,通路虛拟機IP“http://IP:3000”

輸入使用者名,密碼登入系統。使用者名與密碼都是"admin"

添加InfluxDB資料庫配置。輸入帳号密碼“admin / admin”,點選Test & Save 提示“Success”說明成功了

導入模闆

https://grafana.com/dashboards/4026

https://grafana.com/dashboards/3351

四、jmeter得配置,配置完成後正常使用即可

配置“Backend Listener”,主要配置Host,如下圖

繼續閱讀