0

Platform: RHEL7

Situation:

  • A JMeter report file is being appended with new results every 5 minutes by crontab script
  • Another awk script looks for response time greater than 500ms and sends email alerts

Problem Statement:

  • The requirement is to scan only newly added lines in the report file. Presently, the awk script is reading the complete report every time
    and sends alerts even for older events. awk -F "," '$4 != 200 || $14> 500' results.jtl
  • Good-to-Have if the awk script can read from the end of the file up to line read last time. This shall help in creating an alert for the latest event first.

Any suggestion shall be a great help.

Masud Jahan
  • 3,418
  • 2
  • 22
  • 35
Jony Hu
  • 13
  • 2
  • 4
    Have you used `tail -f` command? – tkhm Nov 25 '16 at 06:28
  • Let's try this. `tail -f results.jtl | awk -F "," '$4 != 200 || $14> 500'` – tkhm Nov 25 '16 at 06:35
  • @tkhm I would think that since the script is scheduled in cron and runs periodically, _italic_tail -f_italic_ command may not work. – Jony Hu Nov 25 '16 at 07:05
  • Does the log file ever get truncated to remove the oldest lines or does it just keep growing forever (hint: it can't so how is that avoided?)? [edit] your question to include concise, testable sample input and expected output. – Ed Morton Nov 25 '16 at 16:16

1 Answers1

1

Any reason for not using:

  • Duration Assertion: for failing samples which response times are over 500 ms
  • If Controller: with condition ${JMeterThread.last_sample_ok} which checks whether last sampler is successful or not
  • SMTP Request Sampler: to send an email when there is a failure
Dmitri T
  • 159,985
  • 5
  • 83
  • 133