I use JMeter for load testing and want to report error on CI pipeline when application though put is less than 1/sec. JMeter logs summary of results as -
2017/01/17 01:57:00 INFO - jmeter.reporters.Summariser: summary + 103 in 00:00:30 = 3.4/s Avg: 2937 Min: 48 Max: 7962 Err: 0 (0.00%) Active: 2 Started: 10 Finished: 8
2017/01/17 01:57:00 INFO - jmeter.reporters.Summariser: summary = 12218 in 01:00:03 = 3.4/s Avg: 2942 Min: 20 Max: 27317 Err: 1 (0.01%)
2017/01/17 01:57:00 INFO - jmeter.reporters.Summariser: summary + 1 in 00:00:00 = 66.7/s Avg: 3227 Min: 3227 Max: 3227 Err: 0 (0.00%) Active: 0 Started: 10 Finished: 10
2017/01/17 01:57:00 INFO - jmeter.reporters.Summariser: summary = 12219 in 01:00:03 = 3.4/s Avg: 2942 Min: 20 Max: 27317 Err: 1 (0.01%)
Herein I would capture the last line and if value of throughput is less than 1 (which is 3.4/s in the current example) then it would be reported as error. Here is the script I wrote to capture value of throughput -
grep "meter.reporters.Summariser: summary" test.log | tail -1 | awk '{print $12}' | cut -d "." -f1
and it gets me 3 which is ok. How can I improve this script?