Complex Output Filtering

Hi,

I have this command on my linux jmap -heap $pid | grep '%\|:' the output of which is like below:

I need a smart way to check if any of these memory usage crosses 95%, 90% and 85% i need to triggerAlert accordingly.

I know how to trigger email alerts however I need a good way to check if memory crosses these landmarks [85%, 90%, 95%]

Thus, in this example the below should be triggered for an Alert

awk '!prev {prev=$0;next} /used/ && $1+0>85{print prev ORS $0;next}{prev=$0}' myFile

You can probably eliminate the need for a 'grep' and incorporate it all in one awk.

1 Like

Amazing !! - Resolved!!

perl -ne '/used/ and $_>85 and print "$save$_"; $save=$_' myFile