Skip to content

Instantly share code, notes, and snippets.

@bageljp
Created June 14, 2013 16:24
Show Gist options
  • Select an option

  • Save bageljp/5783283 to your computer and use it in GitHub Desktop.

Select an option

Save bageljp/5783283 to your computer and use it in GitHub Desktop.
jmeter
#!/bin/bash
DATETIME="`date +'%Y%m%d_%H%M%S'`"
LOG="/root/logs/${DATETIME}_report.log"
OVER_LOG="/root/logs/${DATETIME}_over.log"
JMETER_LOG="/root/logs/${DATETIME}_jmeter.log"
export i1=0
export i2=0
export i3=0
export i4=0
export i5=0
/usr/local/apache-jmeter/bin/jmeter.sh -n -t jmeter_2000count_1loop.jmx -l ${JMETER_LOG} -r
echo "### Request count : `wc -l ${JMETER_LOG}`" > ${LOG}
echo "### Not 200 status : `grep -v '200,OK' ${JMETER_LOG} | wc -l`" >> ${LOG}
cat ${JMETER_LOG} | cut -d',' -f2,4 | sort -nr | while read line; do
if [ `echo $line | cut -d',' -f1` -gt 1000 ]; then
echo "$line" >> ${OVER_LOG}
export i1=$((${i1}+1))
fi
if [ `echo $line | cut -d',' -f1` -gt 2000 ]; then
echo "$line" >> ${OVER_LOG}
export i2=$((${i2}+1))
fi
if [ `echo $line | cut -d',' -f1` -gt 3000 ]; then
echo "$line" >> ${OVER_LOG}
export i3=$((${i3}+1))
fi
if [ `echo $line | cut -d',' -f1` -gt 4000 ]; then
echo "$line" >> ${OVER_LOG}
export i4=$((${i4}+1))
fi
if [ `echo $line | cut -d',' -f1` -gt 5000 ]; then
echo "$line" >> ${OVER_LOG}
export i5=$((${i5}+1))
fi
done
echo "### Over 1000ms : $i1" >> ${LOG}
echo "### Over 2000ms : $i2" >> ${LOG}
echo "### Over 3000ms : $i3" >> ${LOG}
echo "### Over 4000ms : $i4" >> ${LOG}
echo "### Over 5000ms : $i5" >> ${LOG}
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment