elk系统生成请求数据测试承载量宕机瓶颈
Posted immense
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了elk系统生成请求数据测试承载量宕机瓶颈相关的知识,希望对你有一定的参考价值。
elk-gen-data.sh:
#!/usr/bin/bash
#----------------------------------------------------
# Comment: to generate huge test data of elk log...
# Author: aodi
# Date: 2018/09/14
# Version: 1.0
#----------------------------------------------------
# 设置第一个参数:请求url文件
URL=$1
# 设置第二个参数:请求头Authorization值
TOKEN=$(curl -X POST -d ‘userAccount=alin110‘ -d ‘userPassword=e46cdf9e5adc531287d20b931b8293e3‘\
http://newh5.430v.com/member/memberManager/login | grep token|awk -F"token\"\:\"" ‘print $2‘|awk -F"\"" ‘print $1‘)
# 设置计数
COUNT=0
# 开始时间
START_TIME=$(date)
#echo $TOKEN
#exit 0
while true
do
echo
echo -e "\033[33m -------Press CTRL+C to Exit!-------\033[0m\n"
sleep 3
for line in `cat $URL | sort --random-sort`
do
#if [[ $line =~ "http" ]]
#then
#for variable in `seq 1 1000`
#do
/usr/bin/curl -q -H ‘Authorization: ‘$TOKEN $line
COUNT=$((COUNT+1))
#done
#fi
done
done
# 结束时间
END_TIME=$(date)
echo $START_TIME" <=> "$END_TIME
echo -e "\033[31m本次共循环 $COUNT 次\033[0m"
elk-gen-data-2.sh:
#!/usr/bin/bash
#----------------------------------------------------
# Comment: to generate huge test data of elk log...
# Author: aodi
# Date: 2018/09/14
# Version: 1.0
#----------------------------------------------------
# 设置第一个参数:请求url文件
URL=$1
# 设置第二个参数:请求头Authorization值
TOKEN=$(curl -X POST -d ‘userAccount=alin111‘ -d ‘userPassword=7066ee96c27fe0a0bce1084aed3e8713‘\
http://newh5.430v.com/member/memberManager/login | grep token|awk -F"token\"\:\"" ‘print $2‘|awk -F"\"" ‘print $1‘)
# 设置计数
COUNT=0
# 开始时间
START_TIME=$(date)
#echo $TOKEN
#exit 0
# 栗子:捕获Ctrl+C中断后执行函数内语句.
#trap ‘onCtrlC‘ INT
#function onCtrlC ()
# echo ‘Ctrl+C is captured‘
#
#
#while true; do
# echo ‘I am working!‘
# sleep 1
#done
trap ‘onCtrlC‘ INT
function onCtrlC ()
echo $START_TIME" <=> "$END_TIME
echo -e "\033[31m本次共循环 $COUNT 次\033[0m"
exit 0
while true
do
echo
echo -e "\033[33m -------Press CTRL+C to Exit!-------\033[0m\n"
sleep 2
for line in `cat $URL | sort --random-sort`
do
#if [[ $line =~ "http" ]]
#then
#for variable in `seq 1 1000`
#do
/usr/bin/curl -q -H ‘Authorization: ‘$TOKEN $line
COUNT=$((COUNT+1))
#done
#fi
done
END_TIME=$(date)
done
# 结束时间
#END_TIME=$(date)
以上是关于elk系统生成请求数据测试承载量宕机瓶颈的主要内容,如果未能解决你的问题,请参考以下文章