|
|
#!/bin/bash
|
|
|
if [ -f ~/.bash_profile ];
|
|
|
then
|
|
|
. ~/.bash_profile
|
|
|
fi
|
|
|
|
|
|
if [[ ! $1 ]];then
|
|
|
echo "not input tc_name"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
INFLUXDB_IP=192.168.104.43
|
|
|
INFLUXDB_DB=jmeter
|
|
|
|
|
|
TC_NAME=$1
|
|
|
GOR_LOG_PATH=/Data/logs/jmeter/gor.log
|
|
|
|
|
|
IP=$(/sbin/ip addr show | grep eth | grep inet | awk '{print $2}' | awk -F '/' '{print $1}')
|
|
|
|
|
|
function exeInfluxdb(){
|
|
|
curl -XPOST "http://${INFLUXDB_IP}:8086/write?db=${INFLUXDB_DB}" --data-binary "$1"
|
|
|
}
|
|
|
|
|
|
function uploadLoadInfo(){
|
|
|
v1=$(cat ${GOR_LOG_PATH} | grep output_http | tail -n 1 | awk -F ',' '{print $2}')
|
|
|
v2=$(cat ${GOR_LOG_PATH} | grep output_http | tail -n 1 | awk -F ',' '{print $5}')
|
|
|
exeInfluxdbStr="${IP}.${TC_NAME}.ok.count value=${v1}
|
|
|
${IP}.${TC_NAME}.ok.pct90 value=${v2}"
|
|
|
exeInfluxdb "$exeInfluxdbStr"
|
|
|
}
|
|
|
|
|
|
uploadLoadInfo
|
|
|
|
...
|
...
|
|