Showing
3 changed files
with
57 additions
and
0 deletions
gor/restart_YPT_AUTO_MONITOR.sh
0 → 100755
gor/yohoPerformanceTestAuto_Gor_InfluxDB.sh
0 → 100755
1 | +#!/bin/bash | ||
2 | +if [ -f ~/.bash_profile ]; | ||
3 | +then | ||
4 | + . ~/.bash_profile | ||
5 | +fi | ||
6 | + | ||
7 | +if [[ ! $1 ]];then | ||
8 | + echo "not input tc_name" | ||
9 | + exit 1 | ||
10 | +fi | ||
11 | + | ||
12 | +INFLUXDB_IP=192.168.104.43 | ||
13 | +INFLUXDB_DB=jmeter | ||
14 | + | ||
15 | +TC_NAME=$1 | ||
16 | +GOR_LOG_PATH=/Data/logs/jmeter/gor.log | ||
17 | + | ||
18 | +IP=$(/sbin/ip addr show | grep eth | grep inet | awk '{print $2}' | awk -F '/' '{print $1}') | ||
19 | + | ||
20 | +function exeInfluxdb(){ | ||
21 | + curl -XPOST "http://${INFLUXDB_IP}:8086/write?db=${INFLUXDB_DB}" --data-binary "$1" | ||
22 | +} | ||
23 | + | ||
24 | +function uploadLoadInfo(){ | ||
25 | + v1=$(cat ${GOR_LOG_PATH} | grep output_http | tail -n 1 | awk -F ',' '{print $2}') | ||
26 | + v2=$(cat ${GOR_LOG_PATH} | grep output_http | tail -n 1 | awk -F ',' '{print $5}') | ||
27 | + exeInfluxdbStr="${IP}.${TC_NAME}.ok.count value=${v1} | ||
28 | +${IP}.${TC_NAME}.ok.pct90 value=${v2}" | ||
29 | + exeInfluxdb "$exeInfluxdbStr" | ||
30 | +} | ||
31 | + | ||
32 | +uploadLoadInfo | ||
33 | + |
-
Please register or login to post a comment